WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
it begins
c-backup.diff (text/plain), 56.56 KB, created by
Saam Barati
on 2016-02-14 15:15:19 PST
(
hide
)
Description:
it begins
Filename:
MIME Type:
Creator:
Saam Barati
Created:
2016-02-14 15:15:19 PST
Size:
56.56 KB
patch
obsolete
>Index: Source/JavaScriptCore/API/JSCallbackObjectFunctions.h >=================================================================== >--- Source/JavaScriptCore/API/JSCallbackObjectFunctions.h (revision 196560) >+++ Source/JavaScriptCore/API/JSCallbackObjectFunctions.h (working copy) >@@ -268,7 +268,7 @@ void JSCallbackObject<Parent>::put(JSCel > > if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { > if (StaticFunctionEntry* entry = staticFunctions->get(name)) { >- PropertySlot getSlot(thisObject); >+ PropertySlot getSlot(thisObject, PropertySlot::TrapType::VMInquiry); // FIXME: is this correct? > if (Parent::getOwnPropertySlot(thisObject, exec, propertyName, getSlot)) > return Parent::put(thisObject, exec, propertyName, value, slot); > if (entry->attributes & kJSPropertyAttributeReadOnly) >@@ -605,7 +605,7 @@ EncodedJSValue JSCallbackObject<Parent>: > JSCallbackObject* thisObj = asCallbackObject(thisValue); > > // Check for cached or override property. >- PropertySlot slot2(thisObj); >+ PropertySlot slot2(thisObj, PropertySlot::TrapType::VMInquiry); // FIXME: is this correct? > if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2)) > return JSValue::encode(slot2.getValue(exec, propertyName)); > >Index: Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (revision 196560) >+++ Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (working copy) >@@ -1318,6 +1318,10 @@ > 797E07A91B8FCFB9008400BA /* JSGlobalLexicalEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 797E07A71B8FCFB9008400BA /* JSGlobalLexicalEnvironment.cpp */; }; > 797E07AA1B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 797E07A81B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 799EF7C41C56ED96002B0534 /* B3PCToOriginMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 799EF7C31C56ED96002B0534 /* B3PCToOriginMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 79B00CBC1C6AB07E0088C65D /* ProxyConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79B00CB81C6AB07E0088C65D /* ProxyConstructor.cpp */; }; >+ 79B00CBD1C6AB07E0088C65D /* ProxyConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 79B00CB91C6AB07E0088C65D /* ProxyConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 79B00CBE1C6AB07E0088C65D /* ProxyObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79B00CBA1C6AB07E0088C65D /* ProxyObject.cpp */; }; >+ 79B00CBF1C6AB07E0088C65D /* ProxyObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 79B00CBB1C6AB07E0088C65D /* ProxyObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 79C4B15D1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79C4B15B1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.cpp */; }; > 79C4B15E1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 79C4B15C1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 79CFC6F01C33B10000C768EA /* LLIntPCRanges.h in Headers */ = {isa = PBXBuildFile; fileRef = 79CFC6EF1C33B10000C768EA /* LLIntPCRanges.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -3525,6 +3529,10 @@ > 797E07A71B8FCFB9008400BA /* JSGlobalLexicalEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalLexicalEnvironment.cpp; sourceTree = "<group>"; }; > 797E07A81B8FCFB9008400BA /* JSGlobalLexicalEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalLexicalEnvironment.h; sourceTree = "<group>"; }; > 799EF7C31C56ED96002B0534 /* B3PCToOriginMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3PCToOriginMap.h; path = b3/B3PCToOriginMap.h; sourceTree = "<group>"; }; >+ 79B00CB81C6AB07E0088C65D /* ProxyConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyConstructor.cpp; sourceTree = "<group>"; }; >+ 79B00CB91C6AB07E0088C65D /* ProxyConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyConstructor.h; sourceTree = "<group>"; }; >+ 79B00CBA1C6AB07E0088C65D /* ProxyObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyObject.cpp; sourceTree = "<group>"; }; >+ 79B00CBB1C6AB07E0088C65D /* ProxyObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyObject.h; sourceTree = "<group>"; }; > 79C4B15B1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGLiveCatchVariablePreservationPhase.cpp; path = dfg/DFGLiveCatchVariablePreservationPhase.cpp; sourceTree = "<group>"; }; > 79C4B15C1BA2158F00FD592E /* DFGLiveCatchVariablePreservationPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGLiveCatchVariablePreservationPhase.h; path = dfg/DFGLiveCatchVariablePreservationPhase.h; sourceTree = "<group>"; }; > 79CFC6EF1C33B10000C768EA /* LLIntPCRanges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntPCRanges.h; path = llint/LLIntPCRanges.h; sourceTree = "<group>"; }; >@@ -6008,6 +6016,10 @@ > 65C02FBB0637462A003E7EE6 /* Protect.h */, > 14D844A216AA2C7000A65AF0 /* PrototypeMap.cpp */, > 14D844A316AA2C7000A65AF0 /* PrototypeMap.h */, >+ 79B00CB81C6AB07E0088C65D /* ProxyConstructor.cpp */, >+ 79B00CB91C6AB07E0088C65D /* ProxyConstructor.h */, >+ 79B00CBA1C6AB07E0088C65D /* ProxyObject.cpp */, >+ 79B00CBB1C6AB07E0088C65D /* ProxyObject.h */, > 0F5780A118FE1E98001E72D9 /* PureNaN.h */, > 0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */, > 147B84620E6DE6B1004775A4 /* PutPropertySlot.h */, >@@ -7061,7 +7073,9 @@ > 0FEC85761BDACDC70080FF74 /* AirCode.h in Headers */, > 0F3730931C0D67EE00052BFA /* AirUseCounts.h in Headers */, > 0F4570391BE44C910062A629 /* AirEliminateDeadCode.h in Headers */, >+ 79B00CBD1C6AB07E0088C65D /* ProxyConstructor.h in Headers */, > 799EF7C41C56ED96002B0534 /* B3PCToOriginMap.h in Headers */, >+ 79B00CBF1C6AB07E0088C65D /* ProxyObject.h in Headers */, > 792CB34A1C4EED5C00D13AF3 /* PCToCodeOriginMap.h in Headers */, > 79CFC6F01C33B10000C768EA /* LLIntPCRanges.h in Headers */, > 79D5CD5B1C1106A900CECA07 /* SamplingProfiler.h in Headers */, >@@ -8953,6 +8967,7 @@ > A77A423F17A0BBFD00A8DB81 /* DFGClobberize.cpp in Sources */, > A77A424117A0BBFD00A8DB81 /* DFGClobberSet.cpp in Sources */, > 0F3C1F1A1B868E7900ABB08B /* DFGClobbersExitState.cpp in Sources */, >+ 79B00CBC1C6AB07E0088C65D /* ProxyConstructor.cpp in Sources */, > 0F04396D1B03DC0B009598B7 /* DFGCombinedLiveness.cpp in Sources */, > 0FF0F19D16B72A08005DF95B /* DFGCommon.cpp in Sources */, > 0FEA0A31170D40BF00BB722C /* DFGCommonData.cpp in Sources */, >@@ -9014,6 +9029,7 @@ > 46D4DCBD1C5AB2D500D8D321 /* JSBoundSlotBaseFunction.cpp in Sources */, > 0FF2CD5B1B61A4F8004955A8 /* DFGMultiGetByOffsetData.cpp in Sources */, > A737810D1799EA2E00817533 /* DFGNaturalLoops.cpp in Sources */, >+ 79B00CBE1C6AB07E0088C65D /* ProxyObject.cpp in Sources */, > 792CB3491C4EED5C00D13AF3 /* PCToCodeOriginMap.cpp in Sources */, > 0FF0F19C16B72A03005DF95B /* DFGNode.cpp in Sources */, > 0FB3878F1BFBC44D00E3AB1E /* AirOptimizeBlockOrder.cpp in Sources */, >Index: Source/JavaScriptCore/debugger/DebuggerScope.cpp >=================================================================== >--- Source/JavaScriptCore/debugger/DebuggerScope.cpp (revision 196560) >+++ Source/JavaScriptCore/debugger/DebuggerScope.cpp (working copy) >@@ -209,7 +209,7 @@ JSValue DebuggerScope::caughtValue(ExecS > SymbolTable* catchSymbolTable = catchEnvironment->symbolTable(); > RELEASE_ASSERT(catchSymbolTable->size() == 1); > PropertyName errorName(catchSymbolTable->begin(catchSymbolTable->m_lock)->key.get()); >- PropertySlot slot(m_scope.get()); >+ PropertySlot slot(m_scope.get(), PropertySlot::TrapType::Get); > bool success = catchEnvironment->getOwnPropertySlot(catchEnvironment, exec, errorName, slot); > RELEASE_ASSERT(success && slot.isValue()); > return slot.getValue(exec, errorName); >Index: Source/JavaScriptCore/interpreter/Interpreter.cpp >=================================================================== >--- Source/JavaScriptCore/interpreter/Interpreter.cpp (revision 196560) >+++ Source/JavaScriptCore/interpreter/Interpreter.cpp (working copy) >@@ -877,7 +877,7 @@ JSValue Interpreter::execute(ProgramExec > switch (JSONPPath[i].m_type) { > case JSONPPathEntryTypeDot: { > if (i == 0) { >- PropertySlot slot(globalObject); >+ PropertySlot slot(globalObject, PropertySlot::TrapType::Get); > if (!globalObject->getPropertySlot(callFrame, JSONPPath[i].m_pathEntryName, slot)) { > if (entry) > return callFrame->vm().throwException(callFrame, createUndefinedVariableError(callFrame, JSONPPath[i].m_pathEntryName)); >@@ -1225,7 +1225,7 @@ JSValue Interpreter::execute(EvalExecuta > JSGlobalLexicalEnvironment* globalLexicalEnvironment = jsCast<JSGlobalObject*>(variableObject)->globalLexicalEnvironment(); > for (unsigned i = 0; i < numVariables; ++i) { > const Identifier& ident = codeBlock->variable(i); >- PropertySlot slot(globalLexicalEnvironment); >+ PropertySlot slot(globalLexicalEnvironment, PropertySlot::TrapType::VMInquiry); > if (JSGlobalLexicalEnvironment::getOwnPropertySlot(globalLexicalEnvironment, callFrame, ident, slot)) { > return checkedReturn(callFrame->vm().throwException(callFrame, > createTypeError(callFrame, makeString("Can't create duplicate global variable in eval: '", String(ident.impl()), "'")))); >@@ -1234,7 +1234,7 @@ JSValue Interpreter::execute(EvalExecuta > > for (int i = 0; i < numFunctions; ++i) { > FunctionExecutable* function = codeBlock->functionDecl(i); >- PropertySlot slot(globalLexicalEnvironment); >+ PropertySlot slot(globalLexicalEnvironment, PropertySlot::TrapType::VMInquiry); > if (JSGlobalLexicalEnvironment::getOwnPropertySlot(globalLexicalEnvironment, callFrame, function->name(), slot)) { > return checkedReturn(callFrame->vm().throwException(callFrame, > createTypeError(callFrame, makeString("Can't create duplicate global variable in eval: '", String(function->name().impl()), "'")))); >Index: Source/JavaScriptCore/jit/JITOperations.cpp >=================================================================== >--- Source/JavaScriptCore/jit/JITOperations.cpp (revision 196560) >+++ Source/JavaScriptCore/jit/JITOperations.cpp (working copy) >@@ -158,7 +158,7 @@ EncodedJSValue JIT_OPERATION operationGe > stubInfo->tookSlowPath = true; > > JSValue baseValue = JSValue::decode(base); >- PropertySlot slot(baseValue); >+ PropertySlot slot(baseValue, PropertySlot::TrapType::Get); > Identifier ident = Identifier::fromUid(vm, uid); > return JSValue::encode(baseValue.get(exec, ident, slot)); > } >@@ -169,7 +169,7 @@ EncodedJSValue JIT_OPERATION operationGe > NativeCallFrameTracer tracer(vm, exec); > > JSValue baseValue = JSValue::decode(base); >- PropertySlot slot(baseValue); >+ PropertySlot slot(baseValue, PropertySlot::TrapType::Get); > Identifier ident = Identifier::fromUid(vm, uid); > return JSValue::encode(baseValue.get(exec, ident, slot)); > } >@@ -181,7 +181,7 @@ EncodedJSValue JIT_OPERATION operationGe > Identifier ident = Identifier::fromUid(vm, uid); > > JSValue baseValue = JSValue::decode(base); >- PropertySlot slot(baseValue); >+ PropertySlot slot(baseValue, PropertySlot::TrapType::Get); > > bool hasResult = baseValue.getPropertySlot(exec, ident, slot); > if (stubInfo->considerCaching()) >@@ -203,7 +203,7 @@ EncodedJSValue JIT_OPERATION operationIn > AccessType accessType = static_cast<AccessType>(stubInfo->accessType); > > Identifier ident = Identifier::fromUid(vm, key); >- PropertySlot slot(base); >+ PropertySlot slot(base, PropertySlot::TrapType::Has); // FIXME: what does "in" go under Has or GetOwnProperty? > bool result = asObject(base)->getPropertySlot(exec, ident, slot); > > RELEASE_ASSERT(accessType == stubInfo->accessType); >@@ -1885,7 +1885,7 @@ EncodedJSValue JIT_OPERATION operationGe > // ModuleVar is always converted to ClosureVar for get_from_scope. > ASSERT(getPutInfo.resolveType() != ModuleVar); > >- PropertySlot slot(scope); >+ PropertySlot slot(scope, PropertySlot::TrapType::Get); > if (!scope->getPropertySlot(exec, ident, slot)) { > if (getPutInfo.resolveMode() == ThrowIfNotFound) > vm.throwException(exec, createUndefinedVariableError(exec, ident)); >@@ -1937,7 +1937,7 @@ void JIT_OPERATION operationPutToScope(E > && jsDynamicCast<JSGlobalLexicalEnvironment*>(scope) > && getPutInfo.initializationMode() != Initialization) { > // When we can't statically prove we need a TDZ check, we must perform the check on the slow path. >- PropertySlot slot(scope); >+ PropertySlot slot(scope, PropertySlot::TrapType::Get); > JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot); > if (slot.getValue(exec, ident) == jsTDZValue()) { > exec->vm().throwException(exec, createTDZError(exec)); >Index: Source/JavaScriptCore/llint/LLIntSlowPaths.cpp >=================================================================== >--- Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (revision 196560) >+++ Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (working copy) >@@ -551,7 +551,7 @@ LLINT_SLOW_PATH_DECL(slow_path_get_by_id > CodeBlock* codeBlock = exec->codeBlock(); > const Identifier& ident = codeBlock->identifier(pc[3].u.operand); > JSValue baseValue = LLINT_OP_C(2).jsValue(); >- PropertySlot slot(baseValue); >+ PropertySlot slot(baseValue, PropertySlot::PropertySlot::TrapType::Get); > > JSValue result = baseValue.get(exec, ident, slot); > LLINT_CHECK_EXCEPTION(); >@@ -602,7 +602,7 @@ LLINT_SLOW_PATH_DECL(slow_path_get_argum > CodeBlock* codeBlock = exec->codeBlock(); > const Identifier& ident = codeBlock->identifier(pc[3].u.operand); > JSValue baseValue = LLINT_OP(2).jsValue(); >- PropertySlot slot(baseValue); >+ PropertySlot slot(baseValue, PropertySlot::TrapType::Get); > LLINT_RETURN(baseValue.get(exec, ident, slot)); > } > >@@ -1413,7 +1413,7 @@ LLINT_SLOW_PATH_DECL(slow_path_get_from_ > // ModuleVar is always converted to ClosureVar for get_from_scope. > ASSERT(getPutInfo.resolveType() != ModuleVar); > >- PropertySlot slot(scope); >+ PropertySlot slot(scope, PropertySlot::TrapType::Get); > if (!scope->getPropertySlot(exec, ident, slot)) { > if (getPutInfo.resolveMode() == ThrowIfNotFound) > LLINT_RETURN(exec->vm().throwException(exec, createUndefinedVariableError(exec, ident))); >@@ -1461,7 +1461,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_to_sc > && jsDynamicCast<JSGlobalLexicalEnvironment*>(scope) > && getPutInfo.initializationMode() != Initialization) { > // When we can't statically prove we need a TDZ check, we must perform the check on the slow path. >- PropertySlot slot(scope); >+ PropertySlot slot(scope, PropertySlot::TrapType::Get); > JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot); > if (slot.getValue(exec, ident) == jsTDZValue()) > LLINT_THROW(createTDZError(exec)); >Index: Source/JavaScriptCore/runtime/ArrayPrototype.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ArrayPrototype.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/ArrayPrototype.cpp (working copy) >@@ -151,7 +151,7 @@ static ALWAYS_INLINE JSValue getProperty > { > if (JSValue result = object->tryGetIndexQuickly(index)) > return result; >- PropertySlot slot(object); >+ PropertySlot slot(object, PropertySlot::TrapType::Get); > if (!object->getPropertySlot(exec, index, slot)) > return JSValue(); > return slot.getValue(exec, index); >Index: Source/JavaScriptCore/runtime/CommonIdentifiers.h >=================================================================== >--- Source/JavaScriptCore/runtime/CommonIdentifiers.h (revision 196560) >+++ Source/JavaScriptCore/runtime/CommonIdentifiers.h (working copy) >@@ -52,6 +52,7 @@ > macro(NumberFormat) \ > macro(Object) \ > macro(Promise) \ >+ macro(Proxy) \ > macro(RangeError) \ > macro(ReferenceError) \ > macro(Reflect) \ >Index: Source/JavaScriptCore/runtime/JSCJSValueInlines.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSCJSValueInlines.h (revision 196560) >+++ Source/JavaScriptCore/runtime/JSCJSValueInlines.h (working copy) >@@ -705,7 +705,7 @@ inline JSValue JSValue::toThis(ExecState > > ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, PropertyName propertyName) const > { >- PropertySlot slot(asValue()); >+ PropertySlot slot(asValue(), PropertySlot::TrapType::Get); > return get(exec, propertyName, slot); > } > >@@ -732,7 +732,7 @@ ALWAYS_INLINE bool JSValue::getPropertyS > > ALWAYS_INLINE JSValue JSValue::get(ExecState* exec, unsigned propertyName) const > { >- PropertySlot slot(asValue()); >+ PropertySlot slot(asValue(), PropertySlot::TrapType::Get); > return get(exec, propertyName, slot); > } > >Index: Source/JavaScriptCore/runtime/JSFunction.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSFunction.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSFunction.cpp (working copy) >@@ -430,7 +430,7 @@ void JSFunction::getOwnNonIndexPropertyN > if (!thisObject->isHostOrBuiltinFunction() && mode.includeDontEnumProperties()) { > VM& vm = exec->vm(); > // Make sure prototype has been reified. >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > thisObject->methodTable(vm)->getOwnPropertySlot(thisObject, exec, vm.propertyNames->prototype, slot); > > propertyNames.add(vm.propertyNames->arguments); >@@ -451,7 +451,7 @@ void JSFunction::put(JSCell* cell, ExecS > if (propertyName == exec->propertyNames().prototype) { > // Make sure prototype has been reified, such that it can only be overwritten > // following the rules set out in ECMA-262 8.12.9. >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > thisObject->methodTable(exec->vm())->getOwnPropertySlot(thisObject, exec, propertyName, slot); > if (thisObject->m_rareData) > thisObject->m_rareData->clear("Store to prototype property of a function"); >@@ -501,7 +501,7 @@ bool JSFunction::defineOwnProperty(JSObj > if (propertyName == exec->propertyNames().prototype) { > // Make sure prototype has been reified, such that it can only be overwritten > // following the rules set out in ECMA-262 8.12.9. >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > thisObject->methodTable(exec->vm())->getOwnPropertySlot(thisObject, exec, propertyName, slot); > if (thisObject->m_rareData) > thisObject->m_rareData->clear("Store to prototype property of a function"); >@@ -511,7 +511,7 @@ bool JSFunction::defineOwnProperty(JSObj > bool valueCheck; > if (propertyName == exec->propertyNames().arguments) { > if (thisObject->jsExecutable()->isStrictMode()) { >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) > thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor); > return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); >@@ -519,7 +519,7 @@ bool JSFunction::defineOwnProperty(JSObj > valueCheck = !descriptor.value() || sameValue(exec, descriptor.value(), retrieveArguments(exec, thisObject)); > } else if (propertyName == exec->propertyNames().caller) { > if (thisObject->jsExecutable()->isStrictMode()) { >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) > thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor); > return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); >Index: Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h (revision 196560) >+++ Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h (working copy) >@@ -150,7 +150,7 @@ static JSObject* constructGenericTypedAr > if (isTypedView(object->classInfo()->typedArrayStorageType)) > length = jsCast<JSArrayBufferView*>(object)->length(); > else { >- PropertySlot lengthSlot(object); >+ PropertySlot lengthSlot(object, PropertySlot::TrapType::Get); > object->getPropertySlot(exec, vm.propertyNames->length, lengthSlot); > > JSValue iteratorFunc = object->get(exec, vm.propertyNames->iteratorSymbol); >Index: Source/JavaScriptCore/runtime/JSGlobalObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSGlobalObject.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSGlobalObject.cpp (working copy) >@@ -128,6 +128,8 @@ > #include "ObjectConstructor.h" > #include "ObjectPrototype.h" > #include "ParserError.h" >+#include "ProxyConstructor.h" >+#include "ProxyObject.h" > #include "ReflectObject.h" > #include "RegExpConstructor.h" > #include "RegExpMatchesArray.h" >@@ -366,6 +368,7 @@ void JSGlobalObject::init(VM& vm) > > m_moduleRecordStructure.set(vm, this, JSModuleRecord::createStructure(vm, this, m_objectPrototype.get())); > m_moduleNamespaceObjectStructure.set(vm, this, JSModuleNamespaceObject::createStructure(vm, this, jsNull())); >+ m_proxyObjectStructure.set(vm, this, ProxyObject::createStructure(vm, this, m_objectPrototype.get())); > > #if ENABLE(WEBASSEMBLY) > m_wasmModuleStructure.set(vm, this, JSWASMModule::createStructure(vm, this)); >@@ -454,6 +457,8 @@ m_ ## lowerName ## Prototype->putDirectW > putDirectWithoutTransition(vm, vm.propertyNames->SyntaxError, m_syntaxErrorConstructor.get(), DontEnum); > putDirectWithoutTransition(vm, vm.propertyNames->TypeError, m_typeErrorConstructor.get(), DontEnum); > putDirectWithoutTransition(vm, vm.propertyNames->URIError, m_URIErrorConstructor.get(), DontEnum); >+ >+ putDirectWithoutTransition(vm, vm.propertyNames->Proxy, ProxyConstructor::create(vm, ProxyConstructor::createStructure(vm, this, m_functionPrototype.get())), DontEnum); > > > #define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ >@@ -626,7 +631,7 @@ void JSGlobalObject::put(JSCell* cell, E > bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow) > { > JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::VMInquiry); > // silently ignore attempts to add accessors aliasing vars. > if (descriptor.isAccessorDescriptor() && symbolTableGet(thisObject, propertyName, slot)) > return false; >Index: Source/JavaScriptCore/runtime/JSGlobalObject.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSGlobalObject.h (revision 196560) >+++ Source/JavaScriptCore/runtime/JSGlobalObject.h (working copy) >@@ -277,6 +277,7 @@ protected: > WriteBarrier<Structure> m_regExpMatchesArrayStructure; > WriteBarrier<Structure> m_moduleRecordStructure; > WriteBarrier<Structure> m_moduleNamespaceObjectStructure; >+ WriteBarrier<Structure> m_proxyObjectStructure; > #if ENABLE(WEBASSEMBLY) > WriteBarrier<Structure> m_wasmModuleStructure; > #endif >@@ -529,6 +530,7 @@ public: > Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); } > Structure* moduleRecordStructure() const { return m_moduleRecordStructure.get(); } > Structure* moduleNamespaceObjectStructure() const { return m_moduleNamespaceObjectStructure.get(); } >+ Structure* proxyObjectStructure() const { return m_proxyObjectStructure.get(); } > #if ENABLE(WEBASSEMBLY) > Structure* wasmModuleStructure() const { return m_wasmModuleStructure.get(); } > #endif >@@ -719,7 +721,7 @@ inline JSGlobalObject* asGlobalObject(JS > > inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName) > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::VMInquiry); > if (Base::getOwnPropertySlot(this, exec, propertyName, slot)) > return true; > bool slotIsWriteable; >Index: Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSModuleEnvironment.cpp (working copy) >@@ -83,7 +83,7 @@ bool JSModuleEnvironment::getOwnProperty > if (resolution.type == JSModuleRecord::Resolution::Type::Resolved) { > // When resolveImport resolves the resolution, the imported module environment must have the binding. > JSModuleEnvironment* importedModuleEnvironment = resolution.moduleRecord->moduleEnvironment(); >- PropertySlot redirectSlot(importedModuleEnvironment); >+ PropertySlot redirectSlot(importedModuleEnvironment, PropertySlot::TrapType::Get); > bool result = importedModuleEnvironment->methodTable(exec->vm())->getOwnPropertySlot(importedModuleEnvironment, exec, resolution.localName, redirectSlot); > ASSERT_UNUSED(result, result); > ASSERT(redirectSlot.isValue()); >Index: Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp (working copy) >@@ -106,7 +106,7 @@ static EncodedJSValue callbackGetter(Exe > JSModuleRecord* targetModule = resolution.moduleRecord; > JSModuleEnvironment* targetEnvironment = targetModule->moduleEnvironment(); > >- PropertySlot trampolineSlot(targetEnvironment); >+ PropertySlot trampolineSlot(targetEnvironment, PropertySlot::TrapType::Get); > if (!targetEnvironment->methodTable(exec->vm())->getOwnPropertySlot(targetEnvironment, exec, resolution.localName, trampolineSlot)) > return JSValue::encode(jsUndefined()); > >Index: Source/JavaScriptCore/runtime/JSONObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSONObject.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSONObject.cpp (working copy) >@@ -466,7 +466,7 @@ bool Stringifier::Holder::appendNextProp > if (m_isJSArray && asArray(m_object.get())->canGetIndexQuickly(index)) > value = asArray(m_object.get())->getIndexQuickly(index); > else { >- PropertySlot slot(m_object.get()); >+ PropertySlot slot(m_object.get(), PropertySlot::TrapType::Get); > if (m_object->methodTable()->getOwnPropertySlotByIndex(m_object.get(), exec, index, slot)) { > value = slot.getValue(exec, index); > if (exec->hadException()) >@@ -484,7 +484,7 @@ bool Stringifier::Holder::appendNextProp > stringifyResult = stringifier.appendStringifiedValue(builder, value, m_object.get(), index); > } else { > // Get the value. >- PropertySlot slot(m_object.get()); >+ PropertySlot slot(m_object.get(), PropertySlot::TrapType::Get); > Identifier& propertyName = m_propertyNames->propertyNameVector()[index]; > if (!m_object->methodTable()->getOwnPropertySlot(m_object.get(), exec, propertyName, slot)) > return true; >@@ -618,7 +618,7 @@ NEVER_INLINE JSValue Walker::walk(JSValu > if (isJSArray(array) && array->canGetIndexQuickly(index)) > inValue = array->getIndexQuickly(index); > else { >- PropertySlot slot(array); >+ PropertySlot slot(array, PropertySlot::TrapType::Get); > if (array->methodTable()->getOwnPropertySlotByIndex(array, m_exec, index, slot)) > inValue = slot.getValue(m_exec, index); > else >@@ -670,7 +670,7 @@ NEVER_INLINE JSValue Walker::walk(JSValu > propertyStack.removeLast(); > break; > } >- PropertySlot slot(object); >+ PropertySlot slot(object, PropertySlot::TrapType::Get); > if (object->methodTable()->getOwnPropertySlot(object, m_exec, properties[index], slot)) > inValue = slot.getValue(m_exec, properties[index]); > else >Index: Source/JavaScriptCore/runtime/JSObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSObject.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSObject.cpp (working copy) >@@ -264,7 +264,7 @@ String JSObject::calculatedClassName(JSO > { > String prototypeFunctionName; > ExecState* exec = object->globalObject()->globalExec(); >- PropertySlot slot(object->structure()->storedPrototype()); >+ PropertySlot slot(object->structure()->storedPrototype(), PropertySlot::TrapType::VMInquiry); > PropertyName constructor(exec->propertyNames().constructor); > if (object->getPropertySlot(exec, constructor, slot)) { > if (slot.isValue()) { >@@ -1270,15 +1270,17 @@ void JSObject::putDirectNonIndexAccessor > structure->setHasGetterSetterPropertiesWithProtoCheck(propertyName == vm.propertyNames->underscoreProto); > } > >+// HasProperty(O, P) from Section 7.3.10 of the spec. >+// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasproperty > bool JSObject::hasProperty(ExecState* exec, PropertyName propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::Has); > return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); > } > > bool JSObject::hasProperty(ExecState* exec, unsigned propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::Has); > return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot); > } > >@@ -1304,15 +1306,17 @@ bool JSObject::deleteProperty(JSCell* ce > return true; > } > >+// HasOwnProperty(O, P) from section 7.3.11 in the spec. >+// http://www.ecma-international.org/ecma-262/6.0/index.html#sec-hasownproperty > bool JSObject::hasOwnProperty(ExecState* exec, PropertyName propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::GetOwnProperty); > return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlot(const_cast<JSObject*>(this), exec, propertyName, slot); > } > > bool JSObject::hasOwnProperty(ExecState* exec, unsigned propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::GetOwnProperty); > return const_cast<JSObject*>(this)->methodTable(exec->vm())->getOwnPropertySlotByIndex(const_cast<JSObject*>(this), exec, propertyName, slot); > } > >@@ -2548,7 +2552,7 @@ static JSBoundSlotBaseFunction* getBound > > bool JSObject::getOwnPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) > { >- JSC::PropertySlot slot(this); >+ JSC::PropertySlot slot(this, PropertySlot::TrapType::GetOwnProperty); // FIXME: consider this. > if (!methodTable(exec->vm())->getOwnPropertySlot(this, exec, propertyName, slot)) > return false; > >Index: Source/JavaScriptCore/runtime/JSObject.h >=================================================================== >--- Source/JavaScriptCore/runtime/JSObject.h (revision 196560) >+++ Source/JavaScriptCore/runtime/JSObject.h (working copy) >@@ -266,7 +266,7 @@ public: > { > if (JSValue result = tryGetIndexQuickly(i)) > return result; >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::Get); > if (methodTable(exec->vm())->getOwnPropertySlotByIndex(this, exec, i, slot)) > return slot.getValue(exec, i); > return JSValue(); >@@ -1190,7 +1190,7 @@ ALWAYS_INLINE bool JSObject::getProperty > > inline JSValue JSObject::get(ExecState* exec, PropertyName propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::Get); > if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot)) > return slot.getValue(exec, propertyName); > >@@ -1199,7 +1199,7 @@ inline JSValue JSObject::get(ExecState* > > inline JSValue JSObject::get(ExecState* exec, unsigned propertyName) const > { >- PropertySlot slot(this); >+ PropertySlot slot(this, PropertySlot::TrapType::Get); > if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot)) > return slot.getValue(exec, propertyName); > >Index: Source/JavaScriptCore/runtime/JSScope.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSScope.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/JSScope.cpp (working copy) >@@ -127,7 +127,7 @@ static inline bool abstractAccess(ExecSt > return true; > } > >- PropertySlot slot(globalObject); >+ PropertySlot slot(globalObject, PropertySlot::TrapType::VMInquiry); > bool hasOwnProperty = globalObject->getOwnPropertySlot(globalObject, exec, ident, slot); > if (!hasOwnProperty) { > op = ResolveOp(makeType(UnresolvedProperty, needsVarInjectionChecks), 0, 0, 0, 0, 0); >Index: Source/JavaScriptCore/runtime/ObjectConstructor.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ObjectConstructor.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/ObjectConstructor.cpp (working copy) >@@ -331,14 +331,16 @@ bool toPropertyDescriptor(ExecState* exe > } > JSObject* description = asObject(in); > >- PropertySlot enumerableSlot(description); >+ // FIXME: good test to have for proxy's. >+ // Good test for the handler of a Proxy being another Proxy. >+ PropertySlot enumerableSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().enumerable, enumerableSlot)) { > desc.setEnumerable(enumerableSlot.getValue(exec, exec->propertyNames().enumerable).toBoolean(exec)); > if (exec->hadException()) > return false; > } > >- PropertySlot configurableSlot(description); >+ PropertySlot configurableSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().configurable, configurableSlot)) { > desc.setConfigurable(configurableSlot.getValue(exec, exec->propertyNames().configurable).toBoolean(exec)); > if (exec->hadException()) >@@ -346,21 +348,21 @@ bool toPropertyDescriptor(ExecState* exe > } > > JSValue value; >- PropertySlot valueSlot(description); >+ PropertySlot valueSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().value, valueSlot)) { > desc.setValue(valueSlot.getValue(exec, exec->propertyNames().value)); > if (exec->hadException()) > return false; > } > >- PropertySlot writableSlot(description); >+ PropertySlot writableSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().writable, writableSlot)) { > desc.setWritable(writableSlot.getValue(exec, exec->propertyNames().writable).toBoolean(exec)); > if (exec->hadException()) > return false; > } > >- PropertySlot getSlot(description); >+ PropertySlot getSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().get, getSlot)) { > JSValue get = getSlot.getValue(exec, exec->propertyNames().get); > if (exec->hadException()) >@@ -375,7 +377,7 @@ bool toPropertyDescriptor(ExecState* exe > desc.setGetter(get); > } > >- PropertySlot setSlot(description); >+ PropertySlot setSlot(description, PropertySlot::TrapType::Has); > if (description->getPropertySlot(exec, exec->propertyNames().set, setSlot)) { > JSValue set = setSlot.getValue(exec, exec->propertyNames().set); > if (exec->hadException()) >Index: Source/JavaScriptCore/runtime/ObjectPrototype.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ObjectPrototype.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/ObjectPrototype.cpp (working copy) >@@ -174,7 +174,7 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::Get); // FIXME: what to do here??? > if (thisObject->getPropertySlot(exec, propertyName, slot)) { > if (slot.isAccessor()) { > GetterSetter* getterSetter = slot.getterSetter(); >@@ -201,7 +201,7 @@ EncodedJSValue JSC_HOST_CALL objectProto > if (exec->hadException()) > return JSValue::encode(jsUndefined()); > >- PropertySlot slot(thisObject); >+ PropertySlot slot(thisObject, PropertySlot::TrapType::GetOwnProperty); // FIXME: what to do here??? Is this in the spec? > if (thisObject->getPropertySlot(exec, propertyName, slot)) { > if (slot.isAccessor()) { > GetterSetter* getterSetter = slot.getterSetter(); >@@ -264,7 +264,7 @@ EncodedJSValue JSC_HOST_CALL objectProto > JSString* result = thisObject->structure(vm)->objectToStringValue(); > if (!result) { > PropertyName toStringTagSymbol = exec->propertyNames().toStringTagSymbol; >- PropertySlot toStringTagSlot(thisObject); >+ PropertySlot toStringTagSlot(thisObject, PropertySlot::TrapType::Get); > if (thisObject->getPropertySlot(exec, toStringTagSymbol, toStringTagSlot)) { > JSValue stringTag = toStringTagSlot.getValue(exec, toStringTagSymbol); > if (stringTag.isString()) { >Index: Source/JavaScriptCore/runtime/PropertySlot.h >=================================================================== >--- Source/JavaScriptCore/runtime/PropertySlot.h (revision 196560) >+++ Source/JavaScriptCore/runtime/PropertySlot.h (working copy) >@@ -59,27 +59,36 @@ inline unsigned attributesForStructure(u > } > > class PropertySlot { >- enum PropertyType { >+ enum PropertyType : uint8_t { > TypeUnset, > TypeValue, > TypeGetter, > TypeCustom > }; > >- enum CacheabilityType { >+ enum CacheabilityType : uint8_t { > CachingDisallowed, > CachingAllowed > }; > > public: >- explicit PropertySlot(const JSValue thisValue) >+ enum class TrapType : uint8_t { >+ Get, // [[Get]] in the spec >+ Has, // [[Has]] in the spec >+ GetOwnProperty, // [[GetOwnProperty]] in the spec. >+ VMInquiry, // Our VM is just asking questions. >+ }; >+ >+ explicit PropertySlot(const JSValue thisValue, TrapType trapType) // FIXME: it might be worth not making this default parameter that way it causes all new call sites to be thought about carefully. > : m_propertyType(TypeUnset) > , m_offset(invalidOffset) > , m_thisValue(thisValue) > , m_slotBase(nullptr) > , m_watchpointSet(nullptr) > , m_cacheability(CachingAllowed) >+ , m_trapType(trapType) > { >+ UNUSED_PARAM(m_trapType); > } > > typedef EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue thisValue, PropertyName); >@@ -96,6 +105,8 @@ public: > bool isCacheableGetter() const { return isCacheable() && isAccessor(); } > bool isCacheableCustom() const { return isCacheable() && isCustom(); } > >+ TrapType trapType() const { return m_trapType; } >+ > void disableCaching() > { > m_cacheability = CachingDisallowed; >@@ -268,6 +279,7 @@ private: > JSObject* m_slotBase; > WatchpointSet* m_watchpointSet; > CacheabilityType m_cacheability; >+ TrapType m_trapType; > }; > > ALWAYS_INLINE JSValue PropertySlot::getValue(ExecState* exec, PropertyName propertyName) const >Index: Source/JavaScriptCore/runtime/ProxyConstructor.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ProxyConstructor.cpp (revision 0) >+++ Source/JavaScriptCore/runtime/ProxyConstructor.cpp (working copy) >@@ -0,0 +1,83 @@ >+/* >+ * Copyright (C) 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 >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "ProxyConstructor.h" >+ >+//#include "JSCJSValue.h" >+#include "JSCJSValueInlines.h" >+//#include "JSCell.h" >+#include "JSCellInlines.h" >+#include "ProxyObject.h" >+#include "ObjectPrototype.h" >+#include "StructureInlines.h" >+ >+namespace JSC { >+ >+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ProxyConstructor); >+ >+const ClassInfo ProxyConstructor::s_info = { "Proxy", &Base::s_info, 0, CREATE_METHOD_TABLE(ProxyConstructor) }; >+ >+ProxyConstructor* ProxyConstructor::create(VM& vm, Structure* structure) >+{ >+ ProxyConstructor* constructor = new (NotNull, allocateCell<ProxyConstructor>(vm.heap)) ProxyConstructor(vm, structure); >+ constructor->finishCreation(vm, "Proxy"); >+ return constructor; >+} >+ >+ProxyConstructor::ProxyConstructor(VM& vm, Structure* structure) >+ : Base(vm, structure) >+{ >+} >+ >+static EncodedJSValue JSC_HOST_CALL constructProxyObject(ExecState* exec) >+{ >+ if (exec->newTarget().isUndefined()) { >+ throwTypeError(exec, ASCIILiteral("new.target of Proxy construct should not be undefined")); >+ return JSValue::encode(jsUndefined()); >+ } >+ >+ ArgList args(exec); >+ JSValue target = args.at(0); >+ JSValue handler = args.at(1); >+ // FIXME: type check the things. >+ return JSValue::encode(ProxyObject::create(exec, exec->lexicalGlobalObject()->proxyObjectStructure(), target, handler)); >+} >+ >+ConstructType ProxyConstructor::getConstructData(JSCell*, ConstructData& constructData) >+{ >+ constructData.native.function = constructProxyObject; >+ return ConstructTypeHost; >+} >+ >+CallType ProxyConstructor::getCallData(JSCell*, CallData& callData) >+{ >+ callData.js.functionExecutable = 0; >+ callData.js.scope = 0; >+ callData.native.function = 0; >+ return CallTypeNone; >+} >+ >+} // namespace JSC >Index: Source/JavaScriptCore/runtime/ProxyConstructor.h >=================================================================== >--- Source/JavaScriptCore/runtime/ProxyConstructor.h (revision 0) >+++ Source/JavaScriptCore/runtime/ProxyConstructor.h (working copy) >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (C) 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 >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef ProxyConstructor_h >+#define ProxyConstructor_h >+ >+#include "InternalFunction.h" >+ >+namespace JSC { >+ >+class ProxyConstructor : public InternalFunction { >+public: >+ typedef InternalFunction Base; >+ static const unsigned StructureFlags = Base::StructureFlags; // FIXME: check this out if we need more flags. >+ >+ static ProxyConstructor* create(VM& vm, Structure* structure); >+ >+ DECLARE_INFO; >+ >+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) >+ { >+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); >+ } >+ >+private: >+ ProxyConstructor(VM&, Structure*); >+ static ConstructType getConstructData(JSCell*, ConstructData&); >+ static CallType getCallData(JSCell*, CallData&); >+ >+ static EncodedJSValue getGetter(ExecState*, EncodedJSValue thisValue, PropertyName); >+}; >+ >+} // namespace JSC >+ >+#endif // ProxyConstructor_h >Index: Source/JavaScriptCore/runtime/ProxyObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ProxyObject.cpp (revision 0) >+++ Source/JavaScriptCore/runtime/ProxyObject.cpp (working copy) >@@ -0,0 +1,113 @@ >+/* >+ * Copyright (C) 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 >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "ProxyObject.h" >+ >+//#include "JSCJSValue.h" >+#include "JSCJSValueInlines.h" >+//#include "JSCell.h" >+#include "JSCellInlines.h" >+#include "SlotVisitorInlines.h" >+ >+#include "RuntimeType.h" >+ >+namespace JSC { >+ >+STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ProxyObject); >+ >+const ClassInfo ProxyObject::s_info = { "ProxyObject", &Base::s_info, 0, CREATE_METHOD_TABLE(ProxyObject) }; >+ >+ProxyObject::ProxyObject(VM& vm, Structure* structure) >+ : Base(vm, structure) >+{ >+} >+ >+void ProxyObject::finishCreation(VM& vm, ExecState* exec, JSValue target, JSValue handler) >+{ >+ UNUSED_PARAM(exec); >+ Base::finishCreation(vm); >+ // FIXME typecheck. >+ m_target.set(vm, this, jsCast<JSObject*>(target)); >+ m_handler.set(vm, this, jsCast<JSObject*>(handler)); >+} >+ >+ >+//typedef EncodedJSValue (*GetValueFunc)(ExecState*, EncodedJSValue thisValue, PropertyName); >+ >+static EncodedJSValue handleProxyGet(ExecState* exec, EncodedJSValue thisValue, PropertyName propertyName) >+{ >+ VM& vm = exec->vm(); >+ ProxyObject* thisObject = jsCast<ProxyObject*>(JSValue::decode(thisValue)); >+ JSObject* handler = thisObject->handler(); >+ JSObject* target = thisObject->target(); >+ JSValue getHandler = handler->get(exec, vm.propertyNames->get); >+ //dataLog("get handler: ", runtimeTypeAsString(runtimeTypeForValue(getHandler)), "\n"); >+ if (!getHandler.isCell()) { >+ throwTypeError(exec, ASCIILiteral(".get should not be a primitive")); >+ return JSValue::encode(jsUndefined()); >+ } >+ CallData callData; >+ CallType callType = getHandler.asCell()->methodTable()->getCallData(getHandler.asCell(), callData); >+ //CallType callType = getCallData(JSValue(getHandler.asCell()), callData); >+ if (callType == CallTypeNone) { >+ throwTypeError(exec, ASCIILiteral("'get' property should be callable")); >+ return JSValue::encode(jsUndefined()); >+ } >+ >+ MarkedArgumentBuffer arguments; >+ arguments.append(target); >+ arguments.append(jsString(exec, propertyName.uid())); >+ arguments.append(thisObject); >+ JSValue result = call(exec, getHandler, callType, callData, handler, arguments); >+ return JSValue::encode(result); >+} >+ >+bool ProxyObject::getOwnPropertySlot(JSObject* object, ExecState*, PropertyName, PropertySlot& slot) >+{ >+ ProxyObject* thisObject = jsCast<ProxyObject*>(object); >+ >+ if (slot.trapType() == PropertySlot::TrapType::Get) { >+ slot.disableCaching(); >+ // FIXME: what are the correct attributes here? >+ slot.setCustom(thisObject, None, handleProxyGet); >+ return true; >+ } >+ >+ // FIXME: implement other things. >+ return false; >+} >+ >+void ProxyObject::visitChildren(JSCell* cell, SlotVisitor& visitor) >+{ >+ ProxyObject* thisObject = jsCast<ProxyObject*>(cell); >+ ASSERT_GC_OBJECT_INHERITS(thisObject, info()); >+ Base::visitChildren(thisObject, visitor); >+ >+ visitor.append(&thisObject->m_target); >+ visitor.append(&thisObject->m_handler); >+} >+ >+} // namespace JSC >Index: Source/JavaScriptCore/runtime/ProxyObject.h >=================================================================== >--- Source/JavaScriptCore/runtime/ProxyObject.h (revision 0) >+++ Source/JavaScriptCore/runtime/ProxyObject.h (working copy) >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 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 >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef ProxyObject_h >+#define ProxyObject_h >+ >+#include "JSGlobalObject.h" >+#include "JSObject.h" >+ >+namespace JSC { >+ >+class ProxyObject : public JSNonFinalObject { >+public: >+ typedef JSNonFinalObject Base; >+ >+ const static unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot; // FIXME: more stuff here probs. >+ >+ static ProxyObject* create(ExecState* exec, Structure* structure, JSValue target, JSValue handler) >+ { >+ VM& vm = exec->vm(); >+ ProxyObject* proxy = new (NotNull, allocateCell<ProxyObject>(vm.heap)) ProxyObject(vm, structure); >+ proxy->finishCreation(vm, exec, target, handler); >+ return proxy; >+ } >+ >+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) >+ { >+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); >+ } >+ >+ DECLARE_EXPORT_INFO; >+ >+ JSObject* target() { return m_target.get(); } >+ JSObject* handler() { return m_handler.get(); } >+ >+private: >+ ProxyObject(VM&, Structure*); >+ void finishCreation(VM&, ExecState*, JSValue target, JSValue handler); >+ >+ static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); >+ static void visitChildren(JSCell*, SlotVisitor&); >+ >+ WriteBarrier<JSObject> m_target; >+ WriteBarrier<JSObject> m_handler; >+}; >+ >+} // namespace JSC >+ >+#endif // JSPromise_h >Index: Source/JavaScriptCore/runtime/ReflectObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ReflectObject.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/ReflectObject.cpp (working copy) >@@ -135,7 +135,7 @@ EncodedJSValue JSC_HOST_CALL reflectObje > if (exec->argumentCount() >= 3) > receiver = exec->argument(2); > >- PropertySlot slot(receiver); >+ PropertySlot slot(receiver, PropertySlot::TrapType::Get); > return JSValue::encode(target.get(exec, propertyName, slot)); > } > >Index: Source/JavaScriptCore/runtime/SamplingProfiler.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/SamplingProfiler.cpp (revision 196560) >+++ Source/JavaScriptCore/runtime/SamplingProfiler.cpp (working copy) >@@ -581,7 +581,7 @@ String SamplingProfiler::StackFrame::nam > > ExecState* exec = callee->globalObject()->globalExec(); > auto getPropertyIfPureOperation = [&] (const Identifier& ident) -> String { >- PropertySlot slot(callee); >+ PropertySlot slot(callee, PropertySlot::TrapType::VMInquiry); > PropertyName propertyName(ident); > if (callee->getPropertySlot(exec, propertyName, slot)) { > if (slot.isValue()) { >Index: Source/JavaScriptCore/wasm/WASMModuleParser.cpp >=================================================================== >--- Source/JavaScriptCore/wasm/WASMModuleParser.cpp (revision 196560) >+++ Source/JavaScriptCore/wasm/WASMModuleParser.cpp (working copy) >@@ -358,7 +358,7 @@ void WASMModuleParser::getImportedValue( > { > FAIL_IF_FALSE(m_imports, "Accessing property of non-object."); > Identifier identifier = Identifier::fromString(&m_vm, importName); >- PropertySlot slot(m_imports.get()); >+ PropertySlot slot(m_imports.get(), PropertySlot::TrapType::Get); > if (!m_imports->getPropertySlot(exec, identifier, slot)) > FAIL_WITH_MESSAGE("Can't find a property named \"" + importName + '"'); > FAIL_IF_FALSE(slot.isValue(), "\"" + importName + "\" is not a data property.");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 154081
:
271313
|
271397
|
271444
|
271448
|
271454
|
271473
|
271493
|
271507
|
271518