Skip to content

Commit

Permalink
Merge r241862 - [JSC] Remove WatchpointSet creation for SymbolTable e…
Browse files Browse the repository at this point in the history
…ntries 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):
  • Loading branch information
Constellation authored and carlosgcampos committed Mar 5, 2019
1 parent 638760d commit 1b37245
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
19 changes: 19 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions Source/JavaScriptCore/runtime/SymbolTable.cpp
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Source/JavaScriptCore/runtime/SymbolTable.h
Expand Up @@ -229,7 +229,7 @@ struct SymbolTableEntry {

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
Expand Down Expand Up @@ -291,8 +291,6 @@ struct SymbolTableEntry {

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.
Expand All @@ -312,10 +310,12 @@ struct SymbolTableEntry {
// 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();
}

Expand Down

0 comments on commit 1b37245

Please sign in to comment.