summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r--Source/JavaScriptCore/runtime/Executable.cpp24
-rw-r--r--Source/JavaScriptCore/runtime/Executable.h13
-rw-r--r--Source/JavaScriptCore/runtime/JSActivation.h24
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalData.cpp18
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalData.h22
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObject.cpp2
-rw-r--r--Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp8
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.cpp18
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.h32
-rw-r--r--Source/JavaScriptCore/runtime/LiteralParser.cpp3
-rw-r--r--Source/JavaScriptCore/runtime/ObjectConstructor.cpp2
-rw-r--r--Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp4
12 files changed, 78 insertions, 92 deletions
diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp
index d7327d564..0a453eea0 100644
--- a/Source/JavaScriptCore/runtime/Executable.cpp
+++ b/Source/JavaScriptCore/runtime/Executable.cpp
@@ -231,11 +231,6 @@ JSObject* EvalExecutable::compileInternal(ExecState* exec, JSScope* scope, JITCo
#endif
#if ENABLE(JIT)
-#if ENABLE(CLASSIC_INTERPRETER)
- if (!m_jitCodeForCall)
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock));
- else
-#endif
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock) + m_jitCodeForCall.size());
#else
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock));
@@ -356,12 +351,7 @@ JSObject* ProgramExecutable::compileInternal(ExecState* exec, JSScope* scope, JI
#endif
#if ENABLE(JIT)
-#if ENABLE(CLASSIC_INTERPRETER)
- if (!m_jitCodeForCall)
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock));
- else
-#endif
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock) + m_jitCodeForCall.size());
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock) + m_jitCodeForCall.size());
#else
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_programCodeBlock));
#endif
@@ -534,12 +524,7 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, JSScope* s
#endif
#if ENABLE(JIT)
-#if ENABLE(CLASSIC_INTERPRETER)
- if (!m_jitCodeForCall)
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall));
- else
-#endif
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall) + m_jitCodeForCall.size());
+ Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall) + m_jitCodeForCall.size());
#else
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForCall));
#endif
@@ -576,11 +561,6 @@ JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, JSSco
#endif
#if ENABLE(JIT)
-#if ENABLE(CLASSIC_INTERPRETER)
- if (!m_jitCodeForConstruct)
- Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForConstruct));
- else
-#endif
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForConstruct) + m_jitCodeForConstruct.size());
#else
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_codeBlockForConstruct));
diff --git a/Source/JavaScriptCore/runtime/Executable.h b/Source/JavaScriptCore/runtime/Executable.h
index 808c78fba..6eeda3a82 100644
--- a/Source/JavaScriptCore/runtime/Executable.h
+++ b/Source/JavaScriptCore/runtime/Executable.h
@@ -266,7 +266,6 @@ namespace JSC {
#if ENABLE(JIT)
static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodeRef callThunk, NativeFunction function, MacroAssemblerCodeRef constructThunk, NativeFunction constructor, Intrinsic intrinsic)
{
- ASSERT(!globalData.interpreter->classicEnabled());
NativeExecutable* executable;
if (!callThunk) {
executable = new (NotNull, allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, function, constructor);
@@ -279,7 +278,7 @@ namespace JSC {
}
#endif
-#if ENABLE(CLASSIC_INTERPRETER) || ENABLE(LLINT_C_LOOP)
+#if ENABLE(LLINT_C_LOOP)
static NativeExecutable* create(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor)
{
ASSERT(!globalData.canUseJIT());
@@ -306,7 +305,6 @@ namespace JSC {
#if ENABLE(JIT)
void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk, Intrinsic intrinsic)
{
- ASSERT(!globalData.interpreter->classicEnabled());
Base::finishCreation(globalData);
m_jitCodeForCall = callThunk;
m_jitCodeForConstruct = constructThunk;
@@ -316,15 +314,6 @@ namespace JSC {
}
#endif
-#if ENABLE(CLASSIC_INTERPRETER)
- void finishCreation(JSGlobalData& globalData)
- {
- ASSERT(!globalData.canUseJIT());
- Base::finishCreation(globalData);
- m_intrinsic = NoIntrinsic;
- }
-#endif
-
private:
NativeExecutable(JSGlobalData& globalData, NativeFunction function, NativeFunction constructor)
: ExecutableBase(globalData, globalData.nativeExecutableStructure.get(), NUM_PARAMETERS_IS_HOST)
diff --git a/Source/JavaScriptCore/runtime/JSActivation.h b/Source/JavaScriptCore/runtime/JSActivation.h
index 442941335..fa2291813 100644
--- a/Source/JavaScriptCore/runtime/JSActivation.h
+++ b/Source/JavaScriptCore/runtime/JSActivation.h
@@ -84,6 +84,8 @@ namespace JSC {
bool isValidIndex(int) const;
bool isValid(const SymbolTableEntry&) const;
bool isTornOff();
+ int registersOffset();
+ static int registersOffset(SharedSymbolTable*);
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | Base::StructureFlags;
@@ -99,8 +101,8 @@ namespace JSC {
NEVER_INLINE PropertySlot::GetValueFunc getArgumentsGetter();
static size_t allocationSize(SharedSymbolTable*);
+ static size_t storageOffset();
- int registerOffset();
WriteBarrier<Unknown>* storage(); // captureCount() number of registers.
};
@@ -141,17 +143,17 @@ namespace JSC {
return false;
}
- inline int JSActivation::registerOffset()
+ inline int JSActivation::registersOffset(SharedSymbolTable* symbolTable)
{
- return -symbolTable()->captureStart();
+ return storageOffset() - (symbolTable->captureStart() * sizeof(WriteBarrier<Unknown>));
}
inline void JSActivation::tearOff(JSGlobalData& globalData)
{
ASSERT(!isTornOff());
- int registerOffset = this->registerOffset();
- WriteBarrierBase<Unknown>* dst = storage() + registerOffset;
+ WriteBarrierBase<Unknown>* dst = reinterpret_cast<WriteBarrierBase<Unknown>*>(
+ reinterpret_cast<char*>(this) + registersOffset(symbolTable()));
WriteBarrierBase<Unknown>* src = m_registers;
int captureEnd = symbolTable()->captureEnd();
@@ -164,15 +166,19 @@ namespace JSC {
inline bool JSActivation::isTornOff()
{
- return m_registers == storage() + registerOffset();
+ return m_registers == reinterpret_cast<WriteBarrierBase<Unknown>*>(
+ reinterpret_cast<char*>(this) + registersOffset(symbolTable()));
+ }
+
+ inline size_t JSActivation::storageOffset()
+ {
+ return WTF::roundUpToMultipleOf<sizeof(WriteBarrier<Unknown>)>(sizeof(JSActivation));
}
inline WriteBarrier<Unknown>* JSActivation::storage()
{
return reinterpret_cast<WriteBarrier<Unknown>*>(
- reinterpret_cast<char*>(this) +
- WTF::roundUpToMultipleOf<sizeof(WriteBarrier<Unknown>)>(sizeof(JSActivation))
- );
+ reinterpret_cast<char*>(this) + storageOffset());
}
inline size_t JSActivation::allocationSize(SharedSymbolTable* symbolTable)
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.cpp b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
index 26f2b8616..e30a7913d 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -97,7 +97,11 @@ extern const HashTable regExpPrototypeTable;
extern const HashTable stringTable;
extern const HashTable stringConstructorTable;
-#if ENABLE(ASSEMBLER) && (ENABLE(CLASSIC_INTERPRETER) || ENABLE(LLINT))
+// Note: Platform.h will enforce that ENABLE(ASSEMBLER) is true if either
+// ENABLE(JIT) or ENABLE(YARR_JIT) or both are enabled. The code below
+// just checks for ENABLE(JIT) or ENABLE(YARR_JIT) with this premise in mind.
+
+#if ENABLE(ASSEMBLER)
static bool enableAssembler(ExecutableAllocator& executableAllocator)
{
if (!executableAllocator.isValid() || (!Options::useJIT() && !Options::useRegExpJIT()))
@@ -124,7 +128,7 @@ static bool enableAssembler(ExecutableAllocator& executableAllocator)
return true;
#endif
}
-#endif
+#endif // ENABLE(!ASSEMBLER)
JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType threadStackType, HeapType heapType)
:
@@ -180,9 +184,13 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
, m_timeoutCount(512)
#endif
, m_newStringsSinceLastHashConst(0)
-#if ENABLE(ASSEMBLER) && (ENABLE(CLASSIC_INTERPRETER) || ENABLE(LLINT))
+#if ENABLE(ASSEMBLER)
, m_canUseAssembler(enableAssembler(executableAllocator))
+#endif
+#if ENABLE(JIT)
, m_canUseJIT(m_canUseAssembler && Options::useJIT())
+#endif
+#if ENABLE(YARR_JIT)
, m_canUseRegExpJIT(m_canUseAssembler && Options::useRegExpJIT())
#endif
#if ENABLE(GC_VALIDATION)
@@ -370,10 +378,6 @@ static ThunkGenerator thunkGeneratorForIntrinsic(Intrinsic intrinsic)
NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, NativeFunction constructor)
{
-#if ENABLE(CLASSIC_INTERPRETER)
- if (!canUseJIT())
- return NativeExecutable::create(*this, function, constructor);
-#endif
return jitStubs->hostFunctionStub(this, function, constructor);
}
NativeExecutable* JSGlobalData::getHostFunction(NativeFunction function, Intrinsic intrinsic)
diff --git a/Source/JavaScriptCore/runtime/JSGlobalData.h b/Source/JavaScriptCore/runtime/JSGlobalData.h
index 68e0e25d1..603f9f82a 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalData.h
+++ b/Source/JavaScriptCore/runtime/JSGlobalData.h
@@ -280,20 +280,18 @@ namespace JSC {
return m_enabledProfiler;
}
-#if !ENABLE(JIT)
- bool canUseJIT() { return false; } // interpreter only
-#elif !ENABLE(CLASSIC_INTERPRETER) && !ENABLE(LLINT)
+#if ENABLE(JIT) && ENABLE(LLINT)
+ bool canUseJIT() { return m_canUseJIT; }
+#elif ENABLE(JIT)
bool canUseJIT() { return true; } // jit only
#else
- bool canUseJIT() { return m_canUseJIT; }
+ bool canUseJIT() { return false; } // interpreter only
#endif
-#if !ENABLE(YARR_JIT)
- bool canUseRegExpJIT() { return false; } // interpreter only
-#elif !ENABLE(CLASSIC_INTERPRETER) && !ENABLE(LLINT)
- bool canUseRegExpJIT() { return true; } // jit only
-#else
+#if ENABLE(YARR_JIT)
bool canUseRegExpJIT() { return m_canUseRegExpJIT; }
+#else
+ bool canUseRegExpJIT() { return false; } // interpreter only
#endif
PrivateName m_inheritorIDKey;
@@ -440,9 +438,13 @@ namespace JSC {
JSGlobalData(GlobalDataType, ThreadStackType, HeapType);
static JSGlobalData*& sharedInstanceInternal();
void createNativeThunk();
-#if ENABLE(ASSEMBLER) && (ENABLE(CLASSIC_INTERPRETER) || ENABLE(LLINT))
+#if ENABLE(ASSEMBLER)
bool m_canUseAssembler;
+#endif
+#if ENABLE(JIT)
bool m_canUseJIT;
+#endif
+#if ENABLE(YARR_JIT)
bool m_canUseRegExpJIT;
#endif
#if ENABLE(GC_VALIDATION)
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
index 3d643a266..b0a0e8122 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -373,7 +373,7 @@ void ObjectsWithBrokenIndexingFinder::operator()(JSCell* cell)
// a different global object that have prototypes from our global object.
bool foundGlobalObject = false;
for (JSObject* current = object; ;) {
- if (current->unwrappedGlobalObject() == m_globalObject) {
+ if (current->globalObject() == m_globalObject) {
foundGlobalObject = true;
break;
}
diff --git a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index e9a3e2836..c85965060 100644
--- a/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -498,8 +498,8 @@ static double parseFloat(const String& s)
EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
{
JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
- JSObject* unwrappedObject = thisObject->unwrappedObject();
- if (!unwrappedObject->isGlobalObject() || jsCast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
+ JSGlobalObject* calleeGlobalObject = exec->callee()->globalObject();
+ if (thisObject != exec->callee()->globalObject()->globalThis())
return throwVMError(exec, createEvalError(exec, ASCIILiteral("The \"this\" value passed to eval must be the global object from which eval originated")));
JSValue x = exec->argument(0);
@@ -519,11 +519,11 @@ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
}
EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false);
- JSObject* error = eval->compile(exec, jsCast<JSGlobalObject*>(unwrappedObject));
+ JSObject* error = eval->compile(exec, calleeGlobalObject);
if (error)
return throwVMError(exec, error);
- return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, jsCast<JSGlobalObject*>(unwrappedObject)));
+ return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, calleeGlobalObject));
}
EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
index acff8a6ae..7bf12b67e 100644
--- a/Source/JavaScriptCore/runtime/JSObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -601,7 +601,7 @@ Structure* JSObject::inheritorID(JSGlobalData& globalData)
bool JSObject::allowsAccessFrom(ExecState* exec)
{
- JSGlobalObject* globalObject = unwrappedGlobalObject();
+ JSGlobalObject* globalObject = this->globalObject();
return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec);
}
@@ -924,13 +924,6 @@ JSObject* JSObject::toThisObject(JSCell* cell, ExecState*)
return jsCast<JSObject*>(cell);
}
-JSObject* JSObject::unwrappedObject()
-{
- if (isGlobalThis())
- return jsCast<JSGlobalThis*>(this)->unwrappedObject();
- return this;
-}
-
void JSObject::seal(JSGlobalData& globalData)
{
if (isSealed(globalData))
@@ -954,13 +947,6 @@ void JSObject::preventExtensions(JSGlobalData& globalData)
setStructure(globalData, Structure::preventExtensionsTransition(globalData, structure()));
}
-JSGlobalObject* JSObject::unwrappedGlobalObject()
-{
- if (isGlobalThis())
- return jsCast<JSGlobalThis*>(this)->unwrappedObject();
- return structure()->globalObject();
-}
-
// This presently will flatten to an uncachable dictionary; this is suitable
// for use in delete, we may want to do something different elsewhere.
void JSObject::reifyStaticFunctionsForDelete(ExecState* exec)
@@ -1052,7 +1038,7 @@ void JSObject::notifyUsedAsPrototype(JSGlobalData& globalData)
Structure* JSObject::createInheritorID(JSGlobalData& globalData)
{
- Structure* inheritorID = createEmptyObjectStructure(globalData, unwrappedGlobalObject(), this);
+ Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject(), this);
ASSERT(inheritorID->isEmpty());
PutPropertySlot slot;
diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h
index bb59eb32b..16efeba5e 100644
--- a/Source/JavaScriptCore/runtime/JSObject.h
+++ b/Source/JavaScriptCore/runtime/JSObject.h
@@ -172,6 +172,15 @@ namespace JSC {
JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
+ void putByIndexInline(ExecState* exec, unsigned propertyName, JSValue value, bool shouldThrow)
+ {
+ if (canSetIndexQuickly(propertyName)) {
+ setIndexQuickly(exec->globalData(), propertyName, value);
+ return;
+ }
+ methodTable()->putByIndex(this, exec, propertyName, value, shouldThrow);
+ }
+
// This is similar to the putDirect* methods:
// - the prototype chain is not consulted
// - accessors are not called.
@@ -179,7 +188,7 @@ namespace JSC {
// This method creates a property with attributes writable, enumerable and configurable all set to true.
bool putDirectIndex(ExecState* exec, unsigned propertyName, JSValue value, unsigned attributes, PutDirectIndexMode mode)
{
- if (!attributes && canSetIndexQuickly(propertyName)) {
+ if (!attributes && canSetIndexQuicklyForPutDirect(propertyName)) {
setIndexQuickly(exec->globalData(), propertyName, value);
return true;
}
@@ -191,7 +200,7 @@ namespace JSC {
}
// A non-throwing version of putDirect and putDirectIndex.
- void putDirectMayBeIndex(ExecState*, PropertyName, JSValue);
+ JS_EXPORT_PRIVATE void putDirectMayBeIndex(ExecState*, PropertyName, JSValue);
bool canGetIndexQuickly(unsigned i)
{
@@ -235,6 +244,19 @@ namespace JSC {
}
}
+ bool canSetIndexQuicklyForPutDirect(unsigned i)
+ {
+ switch (structure()->indexingType()) {
+ case ALL_BLANK_INDEXING_TYPES:
+ return false;
+ case ALL_ARRAY_STORAGE_INDEXING_TYPES:
+ return i < m_butterfly->arrayStorage()->vectorLength();
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
+ }
+ }
+
void setIndexQuickly(JSGlobalData& globalData, unsigned i, JSValue v)
{
switch (structure()->indexingType()) {
@@ -321,7 +343,6 @@ namespace JSC {
// NOTE: JSObject and its subclasses must be able to gracefully handle ExecState* = 0,
// because this call may come from inside the compiler.
JS_EXPORT_PRIVATE static JSObject* toThisObject(JSCell*, ExecState*);
- JSObject* unwrappedObject();
bool getPropertySpecificValue(ExecState*, PropertyName, JSCell*& specificFunction) const;
@@ -460,11 +481,6 @@ namespace JSC {
return structure()->globalObject();
}
- // Does everything possible to return the global object. If it encounters an object
- // that does not have a global object, it returns 0 instead (for example
- // JSNotAnObject).
- JSGlobalObject* unwrappedGlobalObject();
-
void switchToSlowPutArrayStorage(JSGlobalData&);
// The receiver is the prototype in this case. The following:
diff --git a/Source/JavaScriptCore/runtime/LiteralParser.cpp b/Source/JavaScriptCore/runtime/LiteralParser.cpp
index 732d818bd..cd854417b 100644
--- a/Source/JavaScriptCore/runtime/LiteralParser.cpp
+++ b/Source/JavaScriptCore/runtime/LiteralParser.cpp
@@ -570,7 +570,8 @@ JSValue LiteralParser<CharType>::parse(ParserState initialState)
goto startParseExpression;
}
case DoParseArrayEndExpression: {
- asArray(objectStack.last())->push(m_exec, lastValue);
+ JSArray* array = asArray(objectStack.last());
+ array->putDirectIndex(m_exec, array->length(), lastValue);
if (m_lexer.currentToken().type == TokComma)
goto doParseArrayStartExpression;
diff --git a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
index 5ac2d8788..8614b9c45 100644
--- a/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
+++ b/Source/JavaScriptCore/runtime/ObjectConstructor.cpp
@@ -404,7 +404,7 @@ EncodedJSValue JSC_HOST_CALL objectConstructorFreeze(ExecState* exec)
return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object.freeze can only be called on Objects.")));
JSObject* object = asObject(obj);
- if (isJSFinalObject(object)) {
+ if (isJSFinalObject(object) && !hasIndexedProperties(object->structure()->indexingType())) {
object->freeze(exec->globalData());
return JSValue::encode(obj);
}
diff --git a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
index 3f709b0a7..b9ba25735 100644
--- a/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
+++ b/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
@@ -159,7 +159,7 @@ JSValue SparseArrayEntry::get(ExecState* exec, JSObject* array) const
CallData callData;
CallType callType = getter->methodTable()->getCallData(getter, callData);
- return call(exec, getter, callType, callData, array, exec->emptyList());
+ return call(exec, getter, callType, callData, array->methodTable()->toThisObject(array, exec), exec->emptyList());
}
void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueMap* map, JSValue value, bool shouldThrow)
@@ -189,6 +189,8 @@ void SparseArrayEntry::put(ExecState* exec, JSValue thisValue, SparseArrayValueM
CallType callType = setter->methodTable()->getCallData(setter, callData);
MarkedArgumentBuffer args;
args.append(value);
+ if (thisValue.isObject())
+ thisValue = asObject(thisValue)->methodTable()->toThisObject(asObject(thisValue), exec);
call(exec, setter, callType, callData, thisValue, args);
}