Commit 6884841a authored by oliver@apple.com's avatar oliver@apple.com

Refactor PutPropertySlot to be aware of custom properties

https://bugs.webkit.org/show_bug.cgi?id=126187

Reviewed by Antti Koivisto.

Source/JavaScriptCore:

Refactor PutPropertySlot, making the constructor take the thisValue
used as a target.  This results in a wide range of boilerplate changes
to pass the new parameter.

* API/JSObjectRef.cpp:
(JSObjectSetProperty):
* dfg/DFGOperations.cpp:
(JSC::DFG::operationPutByValInternal):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* runtime/Arguments.cpp:
(JSC::Arguments::putByIndex):
* runtime/ArrayPrototype.cpp:
(JSC::putProperty):
(JSC::arrayProtoFuncPush):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::putToPrimitiveByIndex):
* runtime/JSCell.cpp:
(JSC::JSCell::putByIndex):
* runtime/JSFunction.cpp:
(JSC::JSFunction::put):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::putByIndex):
* runtime/JSONObject.cpp:
(JSC::Walker::walk):
* runtime/JSObject.cpp:
(JSC::JSObject::putByIndex):
(JSC::JSObject::putDirectNonIndexAccessor):
(JSC::JSObject::deleteProperty):
* runtime/JSObject.h:
(JSC::JSObject::putDirect):
* runtime/Lookup.h:
(JSC::putEntry):
(JSC::lookupPut):
* runtime/PutPropertySlot.h:
(JSC::PutPropertySlot::PutPropertySlot):
(JSC::PutPropertySlot::setCustomProperty):
(JSC::PutPropertySlot::thisValue):
(JSC::PutPropertySlot::isCacheable):

Source/WebCore:

Update the bindings code generation and custom objects
to the new function signatures

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject setValue:forKey:]):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::putByIndex):
* bridge/NP_jsobject.cpp:
(_NPN_SetProperty):

Source/WebKit/mac:

Update for new method signatures.

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::setProperty):

Source/WebKit2:

Update for new method signatures.

* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::setProperty):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161220 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9775655d
...@@ -331,7 +331,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope ...@@ -331,7 +331,7 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
PropertyDescriptor desc(jsValue, attributes); PropertyDescriptor desc(jsValue, attributes);
jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false); jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false);
} else { } else {
PutPropertySlot slot; PutPropertySlot slot(jsObject);
jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot); jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot);
} }
......
2013-12-23 Oliver Hunt <oliver@apple.com>
Refactor PutPropertySlot to be aware of custom properties
https://bugs.webkit.org/show_bug.cgi?id=126187
Reviewed by Antti Koivisto.
Refactor PutPropertySlot, making the constructor take the thisValue
used as a target. This results in a wide range of boilerplate changes
to pass the new parameter.
* API/JSObjectRef.cpp:
(JSObjectSetProperty):
* dfg/DFGOperations.cpp:
(JSC::DFG::operationPutByValInternal):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* runtime/Arguments.cpp:
(JSC::Arguments::putByIndex):
* runtime/ArrayPrototype.cpp:
(JSC::putProperty):
(JSC::arrayProtoFuncPush):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::putToPrimitiveByIndex):
* runtime/JSCell.cpp:
(JSC::JSCell::putByIndex):
* runtime/JSFunction.cpp:
(JSC::JSFunction::put):
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::putByIndex):
* runtime/JSONObject.cpp:
(JSC::Walker::walk):
* runtime/JSObject.cpp:
(JSC::JSObject::putByIndex):
(JSC::JSObject::putDirectNonIndexAccessor):
(JSC::JSObject::deleteProperty):
* runtime/JSObject.h:
(JSC::JSObject::putDirect):
* runtime/Lookup.h:
(JSC::putEntry):
(JSC::lookupPut):
* runtime/PutPropertySlot.h:
(JSC::PutPropertySlot::PutPropertySlot):
(JSC::PutPropertySlot::setCustomProperty):
(JSC::PutPropertySlot::thisValue):
(JSC::PutPropertySlot::isCacheable):
2014-01-01 Filip Pizlo <fpizlo@apple.com> 2014-01-01 Filip Pizlo <fpizlo@apple.com>
Rationalize DFG DCE Rationalize DFG DCE
......
...@@ -110,7 +110,7 @@ ALWAYS_INLINE static void JIT_OPERATION operationPutByValInternal(ExecState* exe ...@@ -110,7 +110,7 @@ ALWAYS_INLINE static void JIT_OPERATION operationPutByValInternal(ExecState* exe
} }
if (isName(property)) { if (isName(property)) {
PutPropertySlot slot(strict); PutPropertySlot slot(baseValue, strict);
if (direct) { if (direct) {
RELEASE_ASSERT(baseValue.isObject()); RELEASE_ASSERT(baseValue.isObject());
asObject(baseValue)->putDirect(*vm, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot); asObject(baseValue)->putDirect(*vm, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot);
...@@ -122,7 +122,7 @@ ALWAYS_INLINE static void JIT_OPERATION operationPutByValInternal(ExecState* exe ...@@ -122,7 +122,7 @@ ALWAYS_INLINE static void JIT_OPERATION operationPutByValInternal(ExecState* exe
// Don't put to an object if toString throws an exception. // Don't put to an object if toString throws an exception.
Identifier ident(exec, property.toString(exec)->value(exec)); Identifier ident(exec, property.toString(exec)->value(exec));
if (!vm->exception()) { if (!vm->exception()) {
PutPropertySlot slot(strict); PutPropertySlot slot(baseValue, strict);
if (direct) { if (direct) {
RELEASE_ASSERT(baseValue.isObject()); RELEASE_ASSERT(baseValue.isObject());
asObject(baseValue)->putDirect(*vm, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot); asObject(baseValue)->putDirect(*vm, jsCast<NameInstance*>(property.asCell())->privateName(), value, slot);
...@@ -399,7 +399,7 @@ void JIT_OPERATION operationPutByValBeyondArrayBoundsStrict(ExecState* exec, JSO ...@@ -399,7 +399,7 @@ void JIT_OPERATION operationPutByValBeyondArrayBoundsStrict(ExecState* exec, JSO
return; return;
} }
PutPropertySlot slot(true); PutPropertySlot slot(array, true);
array->methodTable()->put( array->methodTable()->put(
array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot);
} }
...@@ -414,7 +414,7 @@ void JIT_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState* exec, ...@@ -414,7 +414,7 @@ void JIT_OPERATION operationPutByValBeyondArrayBoundsNonStrict(ExecState* exec,
return; return;
} }
PutPropertySlot slot(false); PutPropertySlot slot(array, false);
array->methodTable()->put( array->methodTable()->put(
array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot);
} }
...@@ -431,7 +431,7 @@ void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsStrict(ExecState* exe ...@@ -431,7 +431,7 @@ void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsStrict(ExecState* exe
return; return;
} }
PutPropertySlot slot(true); PutPropertySlot slot(array, true);
array->methodTable()->put( array->methodTable()->put(
array, exec, Identifier::from(exec, index), jsValue, slot); array, exec, Identifier::from(exec, index), jsValue, slot);
} }
...@@ -448,7 +448,7 @@ void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsNonStrict(ExecState* ...@@ -448,7 +448,7 @@ void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsNonStrict(ExecState*
return; return;
} }
PutPropertySlot slot(false); PutPropertySlot slot(array, false);
array->methodTable()->put( array->methodTable()->put(
array, exec, Identifier::from(exec, index), jsValue, slot); array, exec, Identifier::from(exec, index), jsValue, slot);
} }
...@@ -494,7 +494,7 @@ void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsStrict(ExecState* exe ...@@ -494,7 +494,7 @@ void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsStrict(ExecState* exe
return; return;
} }
PutPropertySlot slot(true); PutPropertySlot slot(array, true);
array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot); array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot);
} }
...@@ -508,7 +508,7 @@ void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsNonStrict(ExecState* ...@@ -508,7 +508,7 @@ void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsNonStrict(ExecState*
return; return;
} }
PutPropertySlot slot(false); PutPropertySlot slot(array, false);
array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot); array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot);
} }
......
...@@ -798,7 +798,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J ...@@ -798,7 +798,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J
JSValue JSONPValue = JSONPData[entry].m_value.get(); JSValue JSONPValue = JSONPData[entry].m_value.get();
if (JSONPPath.size() == 1 && JSONPPath[0].m_type == JSONPPathEntryTypeDeclare) { if (JSONPPath.size() == 1 && JSONPPath[0].m_type == JSONPPathEntryTypeDeclare) {
globalObject->addVar(callFrame, JSONPPath[0].m_pathEntryName); globalObject->addVar(callFrame, JSONPPath[0].m_pathEntryName);
PutPropertySlot slot; PutPropertySlot slot(globalObject);
globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot); globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot);
result = jsUndefined(); result = jsUndefined();
continue; continue;
...@@ -833,7 +833,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J ...@@ -833,7 +833,7 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J
return jsUndefined(); return jsUndefined();
} }
} }
PutPropertySlot slot; PutPropertySlot slot(baseObject);
switch (JSONPPath.last().m_type) { switch (JSONPPath.last().m_type) {
case JSONPPathEntryTypeCall: { case JSONPPathEntryTypeCall: {
JSValue function = baseObject.get(callFrame, JSONPPath.last().m_pathEntryName); JSValue function = baseObject.get(callFrame, JSONPPath.last().m_pathEntryName);
...@@ -1162,14 +1162,14 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue ...@@ -1162,14 +1162,14 @@ JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue
for (unsigned i = 0; i < numVariables; ++i) { for (unsigned i = 0; i < numVariables; ++i) {
const Identifier& ident = codeBlock->variable(i); const Identifier& ident = codeBlock->variable(i);
if (!variableObject->hasProperty(callFrame, ident)) { if (!variableObject->hasProperty(callFrame, ident)) {
PutPropertySlot slot; PutPropertySlot slot(variableObject);
variableObject->methodTable()->put(variableObject, callFrame, ident, jsUndefined(), slot); variableObject->methodTable()->put(variableObject, callFrame, ident, jsUndefined(), slot);
} }
} }
for (int i = 0; i < numFunctions; ++i) { for (int i = 0; i < numFunctions; ++i) {
FunctionExecutable* function = codeBlock->functionDecl(i); FunctionExecutable* function = codeBlock->functionDecl(i);
PutPropertySlot slot; PutPropertySlot slot(variableObject);
variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(vm, function, scope), slot); variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(vm, function, scope), slot);
} }
} }
......
...@@ -239,7 +239,7 @@ void JIT_OPERATION operationPutByIdStrict(ExecState* exec, StructureStubInfo*, E ...@@ -239,7 +239,7 @@ void JIT_OPERATION operationPutByIdStrict(ExecState* exec, StructureStubInfo*, E
NativeCallFrameTracer tracer(vm, exec); NativeCallFrameTracer tracer(vm, exec);
Identifier ident(vm, uid); Identifier ident(vm, uid);
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext());
JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot);
} }
...@@ -249,7 +249,7 @@ void JIT_OPERATION operationPutByIdNonStrict(ExecState* exec, StructureStubInfo* ...@@ -249,7 +249,7 @@ void JIT_OPERATION operationPutByIdNonStrict(ExecState* exec, StructureStubInfo*
NativeCallFrameTracer tracer(vm, exec); NativeCallFrameTracer tracer(vm, exec);
Identifier ident(vm, uid); Identifier ident(vm, uid);
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext());
JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot);
} }
...@@ -259,7 +259,7 @@ void JIT_OPERATION operationPutByIdDirectStrict(ExecState* exec, StructureStubIn ...@@ -259,7 +259,7 @@ void JIT_OPERATION operationPutByIdDirectStrict(ExecState* exec, StructureStubIn
NativeCallFrameTracer tracer(vm, exec); NativeCallFrameTracer tracer(vm, exec);
Identifier ident(vm, uid); Identifier ident(vm, uid);
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext());
asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot);
} }
...@@ -269,7 +269,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState* exec, StructureStu ...@@ -269,7 +269,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState* exec, StructureStu
NativeCallFrameTracer tracer(vm, exec); NativeCallFrameTracer tracer(vm, exec);
Identifier ident(vm, uid); Identifier ident(vm, uid);
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext());
asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot);
} }
...@@ -283,7 +283,7 @@ void JIT_OPERATION operationPutByIdStrictOptimize(ExecState* exec, StructureStub ...@@ -283,7 +283,7 @@ void JIT_OPERATION operationPutByIdStrictOptimize(ExecState* exec, StructureStub
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSValue baseValue = JSValue::decode(encodedBase); JSValue baseValue = JSValue::decode(encodedBase);
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext());
baseValue.put(exec, ident, value, slot); baseValue.put(exec, ident, value, slot);
...@@ -306,7 +306,7 @@ void JIT_OPERATION operationPutByIdNonStrictOptimize(ExecState* exec, StructureS ...@@ -306,7 +306,7 @@ void JIT_OPERATION operationPutByIdNonStrictOptimize(ExecState* exec, StructureS
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSValue baseValue = JSValue::decode(encodedBase); JSValue baseValue = JSValue::decode(encodedBase);
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext());
baseValue.put(exec, ident, value, slot); baseValue.put(exec, ident, value, slot);
...@@ -329,7 +329,7 @@ void JIT_OPERATION operationPutByIdDirectStrictOptimize(ExecState* exec, Structu ...@@ -329,7 +329,7 @@ void JIT_OPERATION operationPutByIdDirectStrictOptimize(ExecState* exec, Structu
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSObject* baseObject = asObject(JSValue::decode(encodedBase)); JSObject* baseObject = asObject(JSValue::decode(encodedBase));
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseObject, true, exec->codeBlock()->putByIdContext());
baseObject->putDirect(exec->vm(), ident, value, slot); baseObject->putDirect(exec->vm(), ident, value, slot);
...@@ -352,7 +352,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(ExecState* exec, Stru ...@@ -352,7 +352,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(ExecState* exec, Stru
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSObject* baseObject = asObject(JSValue::decode(encodedBase)); JSObject* baseObject = asObject(JSValue::decode(encodedBase));
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseObject, false, exec->codeBlock()->putByIdContext());
baseObject->putDirect(exec->vm(), ident, value, slot); baseObject->putDirect(exec->vm(), ident, value, slot);
...@@ -375,7 +375,7 @@ void JIT_OPERATION operationPutByIdStrictBuildList(ExecState* exec, StructureStu ...@@ -375,7 +375,7 @@ void JIT_OPERATION operationPutByIdStrictBuildList(ExecState* exec, StructureStu
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSValue baseValue = JSValue::decode(encodedBase); JSValue baseValue = JSValue::decode(encodedBase);
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext());
baseValue.put(exec, ident, value, slot); baseValue.put(exec, ident, value, slot);
...@@ -395,7 +395,7 @@ void JIT_OPERATION operationPutByIdNonStrictBuildList(ExecState* exec, Structure ...@@ -395,7 +395,7 @@ void JIT_OPERATION operationPutByIdNonStrictBuildList(ExecState* exec, Structure
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSValue baseValue = JSValue::decode(encodedBase); JSValue baseValue = JSValue::decode(encodedBase);
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext());
baseValue.put(exec, ident, value, slot); baseValue.put(exec, ident, value, slot);
...@@ -415,7 +415,7 @@ void JIT_OPERATION operationPutByIdDirectStrictBuildList(ExecState* exec, Struct ...@@ -415,7 +415,7 @@ void JIT_OPERATION operationPutByIdDirectStrictBuildList(ExecState* exec, Struct
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSObject* baseObject = asObject(JSValue::decode(encodedBase)); JSObject* baseObject = asObject(JSValue::decode(encodedBase));
PutPropertySlot slot(true, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseObject, true, exec->codeBlock()->putByIdContext());
baseObject->putDirect(exec->vm(), ident, value, slot); baseObject->putDirect(exec->vm(), ident, value, slot);
...@@ -435,7 +435,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictBuildList(ExecState* exec, Str ...@@ -435,7 +435,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictBuildList(ExecState* exec, Str
JSValue value = JSValue::decode(encodedValue); JSValue value = JSValue::decode(encodedValue);
JSObject* baseObject = asObject(JSValue::decode(encodedBase)); JSObject* baseObject = asObject(JSValue::decode(encodedBase));
PutPropertySlot slot(false, exec->codeBlock()->putByIdContext()); PutPropertySlot slot(baseObject, false, exec->codeBlock()->putByIdContext());
baseObject ->putDirect(exec->vm(), ident, value, slot); baseObject ->putDirect(exec->vm(), ident, value, slot);
...@@ -469,12 +469,12 @@ static void putByVal(CallFrame* callFrame, JSValue baseValue, JSValue subscript, ...@@ -469,12 +469,12 @@ static void putByVal(CallFrame* callFrame, JSValue baseValue, JSValue subscript,
} else } else
baseValue.putByIndex(callFrame, i, value, callFrame->codeBlock()->isStrictMode()); baseValue.putByIndex(callFrame, i, value, callFrame->codeBlock()->isStrictMode());
} else if (isName(subscript)) { } else if (isName(subscript)) {
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode()); PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode());
baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
} else { } else {
Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode()); PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode());
baseValue.put(callFrame, property, value, slot); baseValue.put(callFrame, property, value, slot);
} }
} }
...@@ -486,12 +486,12 @@ static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue s ...@@ -486,12 +486,12 @@ static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue s
uint32_t i = subscript.asUInt32(); uint32_t i = subscript.asUInt32();
baseObject->putDirectIndex(callFrame, i, value); baseObject->putDirectIndex(callFrame, i, value);
} else if (isName(subscript)) { } else if (isName(subscript)) {
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode()); PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
} else { } else {
Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(callFrame->codeBlock()->isStrictMode()); PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
baseObject->putDirect(callFrame->vm(), property, value, slot); baseObject->putDirect(callFrame->vm(), property, value, slot);
} }
} }
...@@ -1668,7 +1668,7 @@ void JIT_OPERATION operationPutToScope(ExecState* exec, Instruction* bytecodePC) ...@@ -1668,7 +1668,7 @@ void JIT_OPERATION operationPutToScope(ExecState* exec, Instruction* bytecodePC)
return; return;
} }
PutPropertySlot slot(codeBlock->isStrictMode()); PutPropertySlot slot(scope, codeBlock->isStrictMode());
scope->methodTable()->put(scope, exec, ident, value, slot); scope->methodTable()->put(scope, exec, ident, value, slot);
if (exec->vm().exception()) if (exec->vm().exception())
......
...@@ -578,7 +578,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_id) ...@@ -578,7 +578,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_id)
const Identifier& ident = codeBlock->identifier(pc[2].u.operand); const Identifier& ident = codeBlock->identifier(pc[2].u.operand);
JSValue baseValue = LLINT_OP_C(1).jsValue(); JSValue baseValue = LLINT_OP_C(1).jsValue();
PutPropertySlot slot(codeBlock->isStrictMode(), codeBlock->putByIdContext()); PutPropertySlot slot(baseValue, codeBlock->isStrictMode(), codeBlock->putByIdContext());
if (pc[8].u.operand) if (pc[8].u.operand)
asObject(baseValue)->putDirect(vm, ident, LLINT_OP_C(3).jsValue(), slot); asObject(baseValue)->putDirect(vm, ident, LLINT_OP_C(3).jsValue(), slot);
else else
...@@ -734,14 +734,14 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val) ...@@ -734,14 +734,14 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val)
} }
if (isName(subscript)) { if (isName(subscript)) {
PutPropertySlot slot(exec->codeBlock()->isStrictMode()); PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode());
baseValue.put(exec, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); baseValue.put(exec, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
LLINT_END(); LLINT_END();
} }
Identifier property(exec, subscript.toString(exec)->value(exec)); Identifier property(exec, subscript.toString(exec)->value(exec));
LLINT_CHECK_EXCEPTION(); LLINT_CHECK_EXCEPTION();
PutPropertySlot slot(exec->codeBlock()->isStrictMode()); PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode());
baseValue.put(exec, property, value, slot); baseValue.put(exec, property, value, slot);
LLINT_END(); LLINT_END();
} }
...@@ -759,12 +759,12 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val_direct) ...@@ -759,12 +759,12 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val_direct)
uint32_t i = subscript.asUInt32(); uint32_t i = subscript.asUInt32();
baseObject->putDirectIndex(exec, i, value); baseObject->putDirectIndex(exec, i, value);
} else if (isName(subscript)) { } else if (isName(subscript)) {
PutPropertySlot slot(exec->codeBlock()->isStrictMode()); PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
} else { } else {
Identifier property(exec, subscript.toString(exec)->value(exec)); Identifier property(exec, subscript.toString(exec)->value(exec));
if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception. if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception.
PutPropertySlot slot(exec->codeBlock()->isStrictMode()); PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
baseObject->putDirect(exec->vm(), property, value, slot); baseObject->putDirect(exec->vm(), property, value, slot);
} }
} }
...@@ -1368,7 +1368,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_to_scope) ...@@ -1368,7 +1368,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_to_scope)
if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident)) if (modeAndType.mode() == ThrowIfNotFound && !scope->hasProperty(exec, ident))
LLINT_THROW(createUndefinedVariableError(exec, ident)); LLINT_THROW(createUndefinedVariableError(exec, ident));
PutPropertySlot slot(codeBlock->isStrictMode()); PutPropertySlot slot(scope, codeBlock->isStrictMode());
scope->methodTable()->put(scope, exec, ident, value, slot); scope->methodTable()->put(scope, exec, ident, value, slot);
// Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time. // Covers implicit globals. Since they don't exist until they first execute, we didn't know how to cache them at compile time.
......
...@@ -187,7 +187,7 @@ void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue va ...@@ -187,7 +187,7 @@ void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue va
if (thisObject->trySetArgument(exec->vm(), i, value)) if (thisObject->trySetArgument(exec->vm(), i, value))
return; return;
PutPropertySlot slot(shouldThrow); PutPropertySlot slot(thisObject, shouldThrow);
JSObject::put(thisObject, exec, Identifier::from(exec, i), value, slot); JSObject::put(thisObject, exec, Identifier::from(exec, i), value, slot);
} }
......
...@@ -160,7 +160,7 @@ static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index) ...@@ -160,7 +160,7 @@ static JSValue getProperty(ExecState* exec, JSObject* obj, unsigned index)
static void putProperty(ExecState* exec, JSObject* obj, PropertyName propertyName, JSValue value) static void putProperty(ExecState* exec, JSObject* obj, PropertyName propertyName, JSValue value)
{ {
PutPropertySlot slot; PutPropertySlot slot(obj);
obj->methodTable()->put(obj, exec, propertyName, value, slot); obj->methodTable()->put(obj, exec, propertyName, value, slot);
} }
...@@ -501,7 +501,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec) ...@@ -501,7 +501,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
if (length + n >= length) if (length + n >= length)
thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->uncheckedArgument(n), true); thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->uncheckedArgument(n), true);
else { else {
PutPropertySlot slot; PutPropertySlot slot(thisObj);
Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec)); Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec));
thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot); thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot);
} }
......
...@@ -172,7 +172,7 @@ void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue ...@@ -172,7 +172,7 @@ void JSValue::putToPrimitive(ExecState* exec, PropertyName propertyName, JSValue
void JSValue::putToPrimitiveByIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow) void JSValue::putToPrimitiveByIndex(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
{ {
if (propertyName > MAX_ARRAY_INDEX) { if (propertyName > MAX_ARRAY_INDEX) {
PutPropertySlot slot(shouldThrow); PutPropertySlot slot(*this, shouldThrow);
putToPrimitive(exec, Identifier::from(exec, propertyName), value, slot); putToPrimitive(exec, Identifier::from(exec, propertyName), value, slot);
return; return;
} }
......
...@@ -96,7 +96,7 @@ void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue ...@@ -96,7 +96,7 @@ void JSCell::put(JSCell* cell, ExecState* exec, PropertyName identifier, JSValue
void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value, bool shouldThrow) void JSCell::putByIndex(JSCell* cell, ExecState* exec, unsigned identifier, JSValue value, bool shouldThrow)
{ {
if (cell->isString()) { if (cell->isString()) {
PutPropertySlot slot(shouldThrow); PutPropertySlot slot(cell, shouldThrow);
JSValue(cell).putToPrimitive(exec, Identifier::from(exec, identifier), value, slot);