Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (173705 => 173706)
--- trunk/Source/_javascript_Core/ChangeLog 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-09-17 22:34:14 UTC (rev 173706)
@@ -1,3 +1,38 @@
+2014-09-17 Michael Saboff <msab...@apple.com>
+
+ Change CallFrame to use Callee instead of JSScope to implement vm()
+ https://bugs.webkit.org/show_bug.cgi?id=136894
+
+ Reviewed by Geoffrey Garen.
+
+ Added JSCell::vm() method that can be used on any JSObject. Changed CallFrame::vm() to
+ use JSCell::vm with the Callee. Made similar changes in the LLInt.
+ In support of this, changed JSGlobalObject::init() to take a VM& parameter, as there is
+ a chicken/egg problem with trying to use the Callee in the global exec before the Callee
+ has been create. Besides, the vm is readily available in finishCreation(), the caller of
+ init().
+
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm:
+ Changed the calculation of CallFrame::VM to use the Callee instead of JSScope.
+
+ * runtime/JSCell.h:
+ * runtime/JSCellInlines.h:
+ (JSC::JSCell::vm): New method for getting VM from the pointer.
+ (JSC::ExecState::vm): Moved this method from JSScope.h to here since this file
+ contains the implementation of JSCell::vm(), this file is included by all users
+ of CallFrame::vm, and lastly putting it in CallFrameInlines.h required changing
+ many other .h files and possible the WebCore generator generate-bindings.pl.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::init):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::finishCreation):
+ Changed init() to take a VM parameter.
+
+ * runtime/JSScope.h:
+ (JSC::ExecState::vm): Deleted.
+
2014-09-16 Filip Pizlo <fpi...@apple.com>
Unreviewed, disable native inlining because it causes build failures.
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (173705 => 173706)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2014-09-17 22:34:14 UTC (rev 173706)
@@ -387,7 +387,7 @@
end
_handleUncaughtException:
- loadp ScopeChain + PayloadOffset[cfr], t3
+ loadp Callee + PayloadOffset[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
@@ -689,7 +689,7 @@
end
macro branchIfException(label)
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
bieq VM::m_exception + TagOffset[t3], EmptyValueTag, .noException
@@ -2036,7 +2036,7 @@
# the interpreter's throw trampoline (see _llint_throw_trampoline).
# The throwing code must have known that we were throwing to the interpreter,
# and have set VM::targetInterpreterPCForThrow.
- loadp ScopeChain + PayloadOffset[cfr], t3
+ loadp Callee + PayloadOffset[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
@@ -2124,6 +2124,7 @@
loadi ScopeChain + PayloadOffset[t0], t1
storei CellTag, ScopeChain + TagOffset[cfr]
storei t1, ScopeChain + PayloadOffset[cfr]
+ loadi Callee + PayloadOffset[t0], t1
if X86 or X86_WIN
subp 8, sp # align stack pointer
andp MarkedBlockMask, t1
@@ -2135,13 +2136,13 @@
loadp JSFunction::m_executable[t1], t1
checkStackPointerAlignment(t3, 0xdead0001)
call executableOffsetToFunction[t1]
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
addp 8, sp
elsif ARM or ARMv7 or ARMv7_TRADITIONAL or C_LOOP or MIPS or SH4
subp 8, sp # align stack pointer
- # t1 already contains the ScopeChain.
+ # t1 already contains the Callee.
andp MarkedBlockMask, t1
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t1], t1
storep cfr, VM::topCallFrame[t1]
@@ -2158,7 +2159,7 @@
else
call executableOffsetToFunction[t1]
end
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
addp 8, sp
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (173705 => 173706)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2014-09-17 22:34:14 UTC (rev 173706)
@@ -327,7 +327,7 @@
_handleUncaughtException:
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
@@ -578,7 +578,7 @@
end
macro branchIfException(label)
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
btqz VM::m_exception[t3], .noException
@@ -1892,7 +1892,7 @@
# the interpreter's throw trampoline (see _llint_throw_trampoline).
# The throwing code must have known that we were throwing to the interpreter,
# and have set VM::targetInterpreterPCForThrow.
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
loadp VM::callFrameForThrow[t3], cfr
@@ -1952,7 +1952,7 @@
const arg2 = t1 # t1 = rdx
const temp = t0
end
- loadp ScopeChain[cfr], t0
+ loadp Callee[cfr], t0
andp MarkedBlockMask, t0
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t0], t0
storep cfr, VM::topCallFrame[t0]
@@ -1970,11 +1970,11 @@
if X86_64_WIN
addp 32, sp
end
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
elsif ARM64 or C_LOOP
- loadp ScopeChain[cfr], t0
+ loadp Callee[cfr], t0
andp MarkedBlockMask, t0
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t0], t0
storep cfr, VM::topCallFrame[t0]
@@ -1993,7 +1993,7 @@
call executableOffsetToFunction[t1]
end
restoreReturnAddressBeforeReturn(t3)
- loadp ScopeChain[cfr], t3
+ loadp Callee[cfr], t3
andp MarkedBlockMask, t3
loadp MarkedBlock::m_weakSet + WeakSet::m_vm[t3], t3
else
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (173705 => 173706)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2014-09-17 22:34:14 UTC (rev 173706)
@@ -104,6 +104,8 @@
const char* className() const;
+ VM* vm() const;
+
// Extracting the value.
JS_EXPORT_PRIVATE bool getString(ExecState*, String&) const;
JS_EXPORT_PRIVATE String getString(ExecState*) const; // null string if not a string
Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (173705 => 173706)
--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h 2014-09-17 22:34:14 UTC (rev 173706)
@@ -33,6 +33,7 @@
#include "JSDestructibleObject.h"
#include "JSObject.h"
#include "JSString.h"
+#include "MarkedBlock.h"
#include "Structure.h"
#include <wtf/CompilationThread.h>
@@ -111,6 +112,17 @@
visitor.appendUnbarrieredPointer(&structure);
}
+inline VM* JSCell::vm() const
+{
+ return MarkedBlock::blockFor(this)->vm();
+}
+
+inline VM& ExecState::vm() const
+{
+ ASSERT(callee()->vm());
+ return *callee()->vm();
+}
+
template<typename T>
void* allocateCell(Heap& heap, size_t size)
{
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (173705 => 173706)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2014-09-17 22:34:14 UTC (rev 173706)
@@ -199,9 +199,9 @@
m_globalThis.set(vm, this, globalThis);
}
-void JSGlobalObject::init()
+void JSGlobalObject::init(VM& vm)
{
- ASSERT(vm().currentThreadIsHoldingAPILock());
+ ASSERT(vm.currentThreadIsHoldingAPILock());
JSGlobalObject::globalExec()->init(0, 0, this, CallFrame::noCaller(), 0, 0);
@@ -215,8 +215,7 @@
#endif
ExecState* exec = JSGlobalObject::globalExec();
- VM& vm = exec->vm();
-
+
m_functionPrototype.set(vm, this, FunctionPrototype::create(vm, FunctionPrototype::createStructure(vm, this, jsNull()))); // The real prototype will be set once ObjectPrototype is created.
m_calleeStructure.set(vm, this, JSCallee::createStructure(vm, this, jsNull()));
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (173705 => 173706)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h 2014-09-17 22:34:14 UTC (rev 173706)
@@ -303,7 +303,7 @@
Base::finishCreation(vm);
structure()->setGlobalObject(vm, this);
m_experimentsEnabled = m_globalObjectMethodTable->_javascript_ExperimentsEnabled(this);
- init();
+ init(vm);
setGlobalThis(vm, JSProxy::create(vm, JSProxy::createStructure(vm, this, prototype(), PureForwardingProxyType), this));
}
@@ -312,7 +312,7 @@
Base::finishCreation(vm);
structure()->setGlobalObject(vm, this);
m_experimentsEnabled = m_globalObjectMethodTable->_javascript_ExperimentsEnabled(this);
- init();
+ init(vm);
setGlobalThis(vm, thisValue);
}
@@ -604,7 +604,7 @@
JS_EXPORT_PRIVATE void setGlobalThis(VM&, JSObject* globalThis);
- JS_EXPORT_PRIVATE void init();
+ JS_EXPORT_PRIVATE void init(VM&);
void createThrowTypeError(VM&);
Modified: trunk/Source/_javascript_Core/runtime/JSScope.h (173705 => 173706)
--- trunk/Source/_javascript_Core/runtime/JSScope.h 2014-09-17 22:06:03 UTC (rev 173705)
+++ trunk/Source/_javascript_Core/runtime/JSScope.h 2014-09-17 22:34:14 UTC (rev 173706)
@@ -236,12 +236,6 @@
return jsCast<JSScope*>(jsValue());
}
-inline VM& ExecState::vm() const
-{
- ASSERT(scope()->vm());
- return *scope()->vm();
-}
-
inline JSGlobalObject* ExecState::lexicalGlobalObject() const
{
return scope()->globalObject();