[JSC] Remove WatchpointSet creation for SymbolTable entries if VM::canUseJIT() return...
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 05:59:53 +0000 (05:59 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2019 05:59:53 +0000 (05:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194891

Reviewed by Geoffrey Garen.

WatchpointSet in SymbolTable is used to fold the value into a constant in JIT tiers. And it is
not useful under the non-JIT mode. This patch avoids creation of WatchpointSet in SymbolTable
if VM::canUseJIT() returns false.

* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/SymbolTable.cpp:
(JSC::SymbolTableEntry::addWatchpoint): Deleted.
* runtime/SymbolTable.h:
(JSC::SymbolTableEntry::isWatchable const):
(JSC::SymbolTableEntry::watchpointSet):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
Source/JavaScriptCore/runtime/SymbolTable.cpp
Source/JavaScriptCore/runtime/SymbolTable.h

index d47fd8b..fcab6e3 100644 (file)
@@ -1,3 +1,22 @@
+2019-02-20  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Remove WatchpointSet creation for SymbolTable entries if VM::canUseJIT() returns false
+        https://bugs.webkit.org/show_bug.cgi?id=194891
+
+        Reviewed by Geoffrey Garen.
+
+        WatchpointSet in SymbolTable is used to fold the value into a constant in JIT tiers. And it is
+        not useful under the non-JIT mode. This patch avoids creation of WatchpointSet in SymbolTable
+        if VM::canUseJIT() returns false.
+
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/SymbolTable.cpp:
+        (JSC::SymbolTableEntry::addWatchpoint): Deleted.
+        * runtime/SymbolTable.h:
+        (JSC::SymbolTableEntry::isWatchable const):
+        (JSC::SymbolTableEntry::watchpointSet):
+
 2019-02-20  Mark Lam  <mark.lam@apple.com>
 
         Add code to validate expected GC activity modelled by doesGC() against what the runtime encounters.
index ff1ce58..9bb10d1 100644 (file)
@@ -2274,7 +2274,9 @@ llintOpWithMetadata(op_put_to_scope, OpPutToScope, macro (size, get, dispatch, m
         get(m_value, t0)
         loadConstantOrVariable(size, t0, t1, t2)
         loadp OpPutToScope::Metadata::m_watchpointSet[t5], t3
+        btpz t3, .noVariableWatchpointSet
         notifyWrite(t3, .pDynamic)
+    .noVariableWatchpointSet:
         loadp OpPutToScope::Metadata::m_operand[t5], t0
         storei t1, TagOffset[t0]
         storei t2, PayloadOffset[t0]
index 4582540..7ba94b6 100644 (file)
@@ -2310,8 +2310,10 @@ llintOpWithMetadata(op_put_to_scope, OpPutToScope, macro (size, get, dispatch, m
         get(m_value, t0)
         loadConstantOrVariable(size, t0, t1)
         loadp OpPutToScope::Metadata::m_watchpointSet[t5], t2
-        loadp OpPutToScope::Metadata::m_operand[t5], t0
+        btpz t2, .noVariableWatchpointSet
         notifyWrite(t2, .pDynamic)
+    .noVariableWatchpointSet:
+        loadp OpPutToScope::Metadata::m_operand[t5], t0
         storeq t1, [t0]
     end
 
index 25a2a73..c93607e 100644 (file)
@@ -70,11 +70,6 @@ void SymbolTableEntry::prepareToWatch()
     entry->m_watchpoints = adoptRef(new WatchpointSet(ClearWatchpoint));
 }
 
-void SymbolTableEntry::addWatchpoint(Watchpoint* watchpoint)
-{
-    fatEntry()->m_watchpoints->add(watchpoint);
-}
-
 SymbolTableEntry::FatEntry* SymbolTableEntry::inflateSlow()
 {
     FatEntry* entry = new FatEntry(m_bits);
index 59691b2..8e80d4b 100644 (file)
@@ -229,7 +229,7 @@ public:
     
     bool isWatchable() const
     {
-        return (m_bits & KindBitsMask) == ScopeKindBits;
+        return (m_bits & KindBitsMask) == ScopeKindBits && VM::canUseJIT();
     }
     
     // Asserts if the offset is anything but a scope offset. This structures the assertions
@@ -291,8 +291,6 @@ public:
     
     void prepareToWatch();
     
-    void addWatchpoint(Watchpoint*);
-    
     // This watchpoint set is initialized clear, and goes through the following state transitions:
     // 
     // First write to this var, in any scope that has this symbol table: Clear->IsWatched.
@@ -312,10 +310,12 @@ public:
     // initializes that var in just one of them. This means that a compilation could constant-fold to one
     // of the scopes that still has an undefined value for this variable. That's fine, because at that
     // point any write to any of the instances of that variable would fire the watchpoint.
+    //
+    // Note that watchpointSet() returns nullptr if JIT is disabled.
     WatchpointSet* watchpointSet()
     {
         if (!isFat())
-            return 0;
+            return nullptr;
         return fatEntry()->m_watchpoints.get();
     }