diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp | 76 |
1 files changed, 67 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp b/Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp index 80400cb26..3cdc9bc3a 100644 --- a/Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp +++ b/Source/JavaScriptCore/dfg/DFGDesiredWatchpoints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,18 +30,46 @@ #include "ArrayBufferNeuteringWatchpoint.h" #include "CodeBlock.h" -#include "Operations.h" +#include "JSCInlines.h" namespace JSC { namespace DFG { void ArrayBufferViewWatchpointAdaptor::add( - CodeBlock* codeBlock, JSArrayBufferView* view, Watchpoint* watchpoint) + CodeBlock* codeBlock, JSArrayBufferView* view, CommonData& common) { + Watchpoint* watchpoint = common.watchpoints.add(codeBlock); ArrayBufferNeuteringWatchpoint* neuteringWatchpoint = ArrayBufferNeuteringWatchpoint::create(*codeBlock->vm()); neuteringWatchpoint->set()->add(watchpoint); codeBlock->addConstant(neuteringWatchpoint); - codeBlock->vm()->heap.addReference(neuteringWatchpoint, view->buffer()); + // FIXME: We don't need to set this watchpoint at all for shared buffers. + // https://bugs.webkit.org/show_bug.cgi?id=164108 + codeBlock->vm()->heap.addReference(neuteringWatchpoint, view->possiblySharedBuffer()); +} + +void InferredValueAdaptor::add( + CodeBlock* codeBlock, InferredValue* inferredValue, CommonData& common) +{ + codeBlock->addConstant(inferredValue); // For common users, it doesn't really matter if it's weak or not. If references to it go away, we go away, too. + inferredValue->add(common.watchpoints.add(codeBlock)); +} + +void AdaptiveStructureWatchpointAdaptor::add( + CodeBlock* codeBlock, const ObjectPropertyCondition& key, CommonData& common) +{ + switch (key.kind()) { + case PropertyCondition::Equivalence: + common.adaptiveInferredPropertyValueWatchpoints.add(key, codeBlock)->install(); + break; + default: + common.adaptiveStructureWatchpoints.add(key, codeBlock)->install(); + break; + } +} + +void InferredTypeAdaptor::add(CodeBlock* codeBlock, const DesiredInferredType& key, CommonData& common) +{ + key.add(common.watchpoints.add(codeBlock)); } DesiredWatchpoints::DesiredWatchpoints() { } @@ -57,33 +85,63 @@ void DesiredWatchpoints::addLazily(InlineWatchpointSet& set) m_inlineSets.addLazily(&set); } +void DesiredWatchpoints::addLazily(InferredValue* inferredValue) +{ + m_inferredValues.addLazily(inferredValue); +} + void DesiredWatchpoints::addLazily(JSArrayBufferView* view) { m_bufferViews.addLazily(view); } -void DesiredWatchpoints::addLazily(CodeOrigin codeOrigin, ExitKind exitKind, WatchpointSet* set) +void DesiredWatchpoints::addLazily(const ObjectPropertyCondition& key) { - m_sets.addLazily(codeOrigin, exitKind, set); + m_adaptiveStructureSets.addLazily(key); } -void DesiredWatchpoints::addLazily(CodeOrigin codeOrigin, ExitKind exitKind, InlineWatchpointSet& set) +void DesiredWatchpoints::addLazily(const DesiredInferredType& key) { - m_inlineSets.addLazily(codeOrigin, exitKind, &set); + m_inferredTypes.addLazily(key); +} + +bool DesiredWatchpoints::consider(Structure* structure) +{ + if (!structure->dfgShouldWatch()) + return false; + addLazily(structure->transitionWatchpointSet()); + return true; } void DesiredWatchpoints::reallyAdd(CodeBlock* codeBlock, CommonData& commonData) { m_sets.reallyAdd(codeBlock, commonData); m_inlineSets.reallyAdd(codeBlock, commonData); + m_inferredValues.reallyAdd(codeBlock, commonData); m_bufferViews.reallyAdd(codeBlock, commonData); + m_adaptiveStructureSets.reallyAdd(codeBlock, commonData); + m_inferredTypes.reallyAdd(codeBlock, commonData); } bool DesiredWatchpoints::areStillValid() const { return m_sets.areStillValid() && m_inlineSets.areStillValid() - && m_bufferViews.areStillValid(); + && m_inferredValues.areStillValid() + && m_bufferViews.areStillValid() + && m_adaptiveStructureSets.areStillValid() + && m_inferredTypes.areStillValid(); +} + +void DesiredWatchpoints::dumpInContext(PrintStream& out, DumpContext* context) const +{ + out.print("Desired watchpoints:\n"); + out.print(" Watchpoint sets: ", inContext(m_sets, context), "\n"); + out.print(" Inline watchpoint sets: ", inContext(m_inlineSets, context), "\n"); + out.print(" Inferred values: ", inContext(m_inferredValues, context), "\n"); + out.print(" Buffer views: ", inContext(m_bufferViews, context), "\n"); + out.print(" Object property conditions: ", inContext(m_adaptiveStructureSets, context), "\n"); + out.print(" Inferred types: ", inContext(m_inferredTypes, context), "\n"); } } } // namespace JSC::DFG |