summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-09-13 12:51:20 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 20:50:05 +0200
commitd441d6f39bb846989d95bcf5caf387b42414718d (patch)
treee367e64a75991c554930278175d403c072de6bb8 /Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
parent0060b2994c07842f4c59de64b5e3e430525c4b90 (diff)
downloadqtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit. Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/llint/LLIntSlowPaths.cpp')
-rw-r--r--Source/JavaScriptCore/llint/LLIntSlowPaths.cpp229
1 files changed, 104 insertions, 125 deletions
diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
index 0bd19d46f..36a43f586 100644
--- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
+++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,22 +38,25 @@
#include "JIT.h"
#include "JITDriver.h"
#include "JSActivation.h"
+#include "JSCJSValue.h"
#include "JSGlobalObjectFunctions.h"
#include "JSNameScope.h"
#include "JSPropertyNameIterator.h"
#include "JSString.h"
-#include "JSValue.h"
#include "JSWithScope.h"
#include "LLIntCommon.h"
#include "LLIntExceptions.h"
#include "LowLevelInterpreter.h"
+#include "ObjectConstructor.h"
#include "Operations.h"
+#include "StructureRareDataInlines.h"
+#include <wtf/StringPrintStream.h>
namespace JSC { namespace LLInt {
#define LLINT_BEGIN_NO_SET_PC() \
- JSGlobalData& globalData = exec->globalData(); \
- NativeCallFrameTracer tracer(&globalData, exec)
+ VM& vm = exec->vm(); \
+ NativeCallFrameTracer tracer(&vm, exec)
#ifndef NDEBUG
#define LLINT_SET_PC_FOR_STUBS() do { \
@@ -80,13 +83,13 @@ namespace JSC { namespace LLInt {
#define LLINT_END_IMPL() LLINT_RETURN_TWO(pc, exec)
#define LLINT_THROW(exceptionToThrow) do { \
- globalData.exception = (exceptionToThrow); \
+ vm.exception = (exceptionToThrow); \
pc = returnToThrow(exec, pc); \
LLINT_END_IMPL(); \
} while (false)
#define LLINT_CHECK_EXCEPTION() do { \
- if (UNLIKELY(globalData.exception)) { \
+ if (UNLIKELY(vm.exception)) { \
pc = returnToThrow(exec, pc); \
LLINT_END_IMPL(); \
} \
@@ -140,14 +143,14 @@ namespace JSC { namespace LLInt {
#define LLINT_CALL_THROW(exec, pc, exceptionToThrow) do { \
ExecState* __ct_exec = (exec); \
Instruction* __ct_pc = (pc); \
- globalData.exception = (exceptionToThrow); \
+ vm.exception = (exceptionToThrow); \
LLINT_CALL_END_IMPL(__ct_exec, callToThrow(__ct_exec, __ct_pc)); \
} while (false)
#define LLINT_CALL_CHECK_EXCEPTION(exec, pc) do { \
ExecState* __cce_exec = (exec); \
Instruction* __cce_pc = (pc); \
- if (UNLIKELY(globalData.exception)) \
+ if (UNLIKELY(vm.exception)) \
LLINT_CALL_END_IMPL(__cce_exec, callToThrow(__cce_exec, __cce_pc)); \
} while (false)
@@ -166,7 +169,7 @@ extern "C" SlowPathReturnType llint_trace_operand(ExecState* exec, Instruction*
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
- exec->globalData().interpreter->getOpcodeID(pc[0].u.opcode),
+ exec->vm().interpreter->getOpcodeID(pc[0].u.opcode),
fromWhere,
operand,
pc[operand].u.operand);
@@ -184,17 +187,18 @@ extern "C" SlowPathReturnType llint_trace_value(ExecState* exec, Instruction* pc
EncodedJSValue asValue;
} u;
u.asValue = JSValue::encode(value);
- dataLogF("%p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d: %08x:%08x: %s\n",
- exec->codeBlock(),
- exec,
- static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
- exec->globalData().interpreter->getOpcodeID(pc[0].u.opcode),
- fromWhere,
- operand,
- pc[operand].u.operand,
- u.bits.tag,
- u.bits.payload,
- value.description());
+ dataLogF(
+ "%p / %p: executing bc#%zu, op#%u: Trace(%d): %d: %d: %08x:%08x: %s\n",
+ exec->codeBlock(),
+ exec,
+ static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
+ exec->vm().interpreter->getOpcodeID(pc[0].u.opcode),
+ fromWhere,
+ operand,
+ pc[operand].u.operand,
+ u.bits.tag,
+ u.bits.payload,
+ toCString(value).data());
LLINT_END_IMPL();
}
@@ -245,9 +249,9 @@ LLINT_SLOW_PATH_DECL(trace)
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
- opcodeNames[exec->globalData().interpreter->getOpcodeID(pc[0].u.opcode)],
+ opcodeNames[exec->vm().interpreter->getOpcodeID(pc[0].u.opcode)],
exec->scope());
- if (exec->globalData().interpreter->getOpcodeID(pc[0].u.opcode) == op_ret) {
+ if (exec->vm().interpreter->getOpcodeID(pc[0].u.opcode) == op_ret) {
dataLogF("Will be returning to %p\n", exec->returnPC().value());
dataLogF("The new cfr will be %p\n", exec->callerFrame());
}
@@ -260,7 +264,7 @@ LLINT_SLOW_PATH_DECL(special_trace)
exec->codeBlock(),
exec,
static_cast<intptr_t>(pc - exec->codeBlock()->instructions().begin()),
- exec->globalData().interpreter->getOpcodeID(pc[0].u.opcode),
+ exec->vm().interpreter->getOpcodeID(pc[0].u.opcode),
exec->returnPC().value());
LLINT_END_IMPL();
}
@@ -269,7 +273,7 @@ LLINT_SLOW_PATH_DECL(special_trace)
inline bool shouldJIT(ExecState* exec)
{
// You can modify this to turn off JITting without rebuilding the world.
- return exec->globalData().canUseJIT();
+ return exec->vm().canUseJIT();
}
// Returns true if we should try to OSR.
@@ -305,7 +309,7 @@ inline bool jitCompileAndSetHeuristics(CodeBlock* codeBlock, ExecState* exec)
codeBlock->jitSoon();
return true;
}
- ASSERT_NOT_REACHED();
+ RELEASE_ASSERT_NOT_REACHED();
return false;
}
@@ -313,8 +317,7 @@ enum EntryKind { Prologue, ArityCheck };
static SlowPathReturnType entryOSR(ExecState* exec, Instruction*, CodeBlock* codeBlock, const char *name, EntryKind kind)
{
#if ENABLE(JIT_VERBOSE_OSR)
- dataLogF("%p: Entered %s with executeCounter = %s\n", codeBlock, name,
- codeBlock->llintExecuteCounter().status());
+ dataLog(*codeBlock, ": Entered ", name, " with executeCounter = ", codeBlock->llintExecuteCounter(), "\n");
#else
UNUSED_PARAM(name);
#endif
@@ -362,8 +365,7 @@ LLINT_SLOW_PATH_DECL(loop_osr)
CodeBlock* codeBlock = exec->codeBlock();
#if ENABLE(JIT_VERBOSE_OSR)
- dataLogF("%p: Entered loop_osr with executeCounter = %s\n", codeBlock,
- codeBlock->llintExecuteCounter().status());
+ dataLog(*codeBlock, ": Entered loop_osr with executeCounter = ", codeBlock->llintExecuteCounter(), "\n");
#endif
if (!shouldJIT(exec)) {
@@ -378,7 +380,7 @@ LLINT_SLOW_PATH_DECL(loop_osr)
Vector<BytecodeAndMachineOffset> map;
codeBlock->jitCodeMap()->decode(map);
- BytecodeAndMachineOffset* mapping = binarySearch<BytecodeAndMachineOffset, unsigned, BytecodeAndMachineOffset::getBytecodeIndex>(map.begin(), map.size(), pc - codeBlock->instructions().begin());
+ BytecodeAndMachineOffset* mapping = binarySearch<BytecodeAndMachineOffset, unsigned>(map, map.size(), pc - codeBlock->instructions().begin(), BytecodeAndMachineOffset::getBytecodeIndex);
ASSERT(mapping);
ASSERT(mapping->m_bytecodeIndex == static_cast<unsigned>(pc - codeBlock->instructions().begin()));
@@ -393,8 +395,7 @@ LLINT_SLOW_PATH_DECL(replace)
CodeBlock* codeBlock = exec->codeBlock();
#if ENABLE(JIT_VERBOSE_OSR)
- dataLogF("%p: Entered replace with executeCounter = %s\n", codeBlock,
- codeBlock->llintExecuteCounter().status());
+ dataLog(*codeBlock, ": Entered replace with executeCounter = ", codeBlock->llintExecuteCounter(), "\n");
#endif
if (shouldJIT(exec))
@@ -413,13 +414,13 @@ LLINT_SLOW_PATH_DECL(stack_check)
dataLogF("CodeBlock = %p.\n", exec->codeBlock());
dataLogF("Num callee registers = %u.\n", exec->codeBlock()->m_numCalleeRegisters);
dataLogF("Num vars = %u.\n", exec->codeBlock()->m_numVars);
- dataLogF("Current end is at %p.\n", exec->globalData().interpreter->stack().end());
+ dataLogF("Current end is at %p.\n", exec->vm().interpreter->stack().end());
#endif
- ASSERT(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters] > exec->globalData().interpreter->stack().end());
- if (UNLIKELY(!globalData.interpreter->stack().grow(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters]))) {
+ ASSERT(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters] > exec->vm().interpreter->stack().end());
+ if (UNLIKELY(!vm.interpreter->stack().grow(&exec->registers()[exec->codeBlock()->m_numCalleeRegisters]))) {
ReturnAddressPtr returnPC = exec->returnPC();
exec = exec->callerFrame();
- globalData.exception = createStackOverflowError(exec);
+ vm.exception = createStackOverflowError(exec);
interpreterThrowInCaller(exec, returnPC);
pc = returnToThrowForThrownException(exec);
}
@@ -429,11 +430,11 @@ LLINT_SLOW_PATH_DECL(stack_check)
LLINT_SLOW_PATH_DECL(slow_path_call_arityCheck)
{
LLINT_BEGIN();
- ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &globalData.interpreter->stack(), CodeForCall);
+ ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForCall);
if (!newExec) {
ReturnAddressPtr returnPC = exec->returnPC();
exec = exec->callerFrame();
- globalData.exception = createStackOverflowError(exec);
+ vm.exception = createStackOverflowError(exec);
interpreterThrowInCaller(exec, returnPC);
LLINT_RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
}
@@ -443,11 +444,11 @@ LLINT_SLOW_PATH_DECL(slow_path_call_arityCheck)
LLINT_SLOW_PATH_DECL(slow_path_construct_arityCheck)
{
LLINT_BEGIN();
- ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &globalData.interpreter->stack(), CodeForConstruct);
+ ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForConstruct);
if (!newExec) {
ReturnAddressPtr returnPC = exec->returnPC();
exec = exec->callerFrame();
- globalData.exception = createStackOverflowError(exec);
+ vm.exception = createStackOverflowError(exec);
interpreterThrowInCaller(exec, returnPC);
LLINT_RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
}
@@ -460,7 +461,7 @@ LLINT_SLOW_PATH_DECL(slow_path_create_activation)
#if LLINT_SLOW_PATH_TRACING
dataLogF("Creating an activation, exec = %p!\n", exec);
#endif
- JSActivation* activation = JSActivation::create(globalData, exec, exec->codeBlock());
+ JSActivation* activation = JSActivation::create(vm, exec, exec->codeBlock());
exec->setScope(activation);
LLINT_RETURN(JSValue(activation));
}
@@ -468,7 +469,7 @@ LLINT_SLOW_PATH_DECL(slow_path_create_activation)
LLINT_SLOW_PATH_DECL(slow_path_create_arguments)
{
LLINT_BEGIN();
- JSValue arguments = JSValue(Arguments::create(globalData, exec));
+ JSValue arguments = JSValue(Arguments::create(vm, exec));
LLINT_CHECK_EXCEPTION();
exec->uncheckedR(pc[1].u.operand) = arguments;
exec->uncheckedR(unmodifiedArgumentsRegister(pc[1].u.operand)) = arguments;
@@ -484,8 +485,9 @@ LLINT_SLOW_PATH_DECL(slow_path_create_this)
ConstructData constructData;
ASSERT(constructor->methodTable()->getConstructData(constructor, constructData) == ConstructTypeJS);
#endif
-
- Structure* structure = constructor->cachedInheritorID(exec);
+
+ size_t inlineCapacity = pc[3].u.operand;
+ Structure* structure = constructor->allocationProfile(exec, inlineCapacity)->structure();
LLINT_RETURN(constructEmptyObject(exec, structure));
}
@@ -504,7 +506,7 @@ LLINT_SLOW_PATH_DECL(slow_path_convert_this)
LLINT_SLOW_PATH_DECL(slow_path_new_object)
{
LLINT_BEGIN();
- LLINT_RETURN(constructEmptyObject(exec));
+ LLINT_RETURN(constructEmptyObject(exec, pc[3].u.objectAllocationProfile->structure()));
}
LLINT_SLOW_PATH_DECL(slow_path_new_array)
@@ -531,7 +533,7 @@ LLINT_SLOW_PATH_DECL(slow_path_new_regexp)
RegExp* regExp = exec->codeBlock()->regexp(pc[2].u.operand);
if (!regExp->isValid())
LLINT_THROW(createSyntaxError(exec, "Invalid flag supplied to RegExp constructor."));
- LLINT_RETURN(RegExpObject::create(globalData, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp));
+ LLINT_RETURN(RegExpObject::create(vm, exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp));
}
LLINT_SLOW_PATH_DECL(slow_path_not)
@@ -600,23 +602,7 @@ LLINT_SLOW_PATH_DECL(slow_path_pre_dec)
LLINT_RETURN(jsNumber(LLINT_OP(1).jsValue().toNumber(exec) - 1));
}
-LLINT_SLOW_PATH_DECL(slow_path_post_inc)
-{
- LLINT_BEGIN();
- double result = LLINT_OP(2).jsValue().toNumber(exec);
- LLINT_OP(2) = jsNumber(result + 1);
- LLINT_RETURN(jsNumber(result));
-}
-
-LLINT_SLOW_PATH_DECL(slow_path_post_dec)
-{
- LLINT_BEGIN();
- double result = LLINT_OP(2).jsValue().toNumber(exec);
- LLINT_OP(2) = jsNumber(result - 1);
- LLINT_RETURN(jsNumber(result));
-}
-
-LLINT_SLOW_PATH_DECL(slow_path_to_jsnumber)
+LLINT_SLOW_PATH_DECL(slow_path_to_number)
{
LLINT_BEGIN();
LLINT_RETURN(jsNumber(LLINT_OP_C(2).jsValue().toNumber(exec)));
@@ -745,7 +731,7 @@ LLINT_SLOW_PATH_DECL(slow_path_check_has_instance)
LLINT_RETURN(jsBoolean(baseObject->methodTable()->customHasInstance(baseObject, exec, value)));
}
}
- LLINT_THROW(createInvalidParamError(exec, "instanceof", baseVal));
+ LLINT_THROW(createInvalidParameterError(exec, "instanceof", baseVal));
}
LLINT_SLOW_PATH_DECL(slow_path_instanceof)
@@ -785,10 +771,12 @@ LLINT_SLOW_PATH_DECL(slow_path_resolve)
{
LLINT_BEGIN();
Identifier ident = exec->codeBlock()->identifier(pc[2].u.operand);
- ResolveOperations* operations = exec->codeBlock()->resolveOperations(pc[3].u.operand);
+ ResolveOperations* operations = pc[3].u.resolveOperations;
JSValue result = JSScope::resolve(exec, ident, operations);
ASSERT(operations->size());
- ASSERT(operations == exec->codeBlock()->resolveOperations(pc[3].u.operand));
+ if (operations->isEmpty())
+ LLINT_RETURN_PROFILED(op_resolve, result);
+
switch (operations->data()[0].m_operation) {
case ResolveOperation::GetAndReturnGlobalProperty:
pc[0].u.opcode = LLInt::getOpcode(llint_op_resolve_global_property);
@@ -818,7 +806,7 @@ LLINT_SLOW_PATH_DECL(slow_path_resolve)
LLINT_SLOW_PATH_DECL(slow_path_put_to_base)
{
LLINT_BEGIN();
- PutToBaseOperation* operation = exec->codeBlock()->putToBaseOperation(pc[4].u.operand);
+ PutToBaseOperation* operation = pc[4].u.putToBaseOperation;
JSScope::resolvePut(exec, LLINT_OP_C(1).jsValue(), exec->codeBlock()->identifier(pc[2].u.operand), LLINT_OP_C(3).jsValue(), operation);
switch (operation->m_kind) {
case PutToBaseOperation::VariablePut:
@@ -835,15 +823,21 @@ LLINT_SLOW_PATH_DECL(slow_path_resolve_base)
{
LLINT_BEGIN();
Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
- ResolveOperations* operations = exec->codeBlock()->resolveOperations(pc[4].u.operand);
+ ResolveOperations* operations = pc[4].u.resolveOperations;
JSValue result;
if (pc[3].u.operand) {
- result = JSScope::resolveBase(exec, ident, true, operations, exec->codeBlock()->putToBaseOperation(pc[5].u.operand));
+ result = JSScope::resolveBase(exec, ident, true, operations, pc[5].u.putToBaseOperation);
if (!result)
- LLINT_THROW(globalData.exception);
+ LLINT_THROW(vm.exception);
} else
- result = JSScope::resolveBase(exec, ident, false, operations, exec->codeBlock()->putToBaseOperation(pc[5].u.operand));
+ result = JSScope::resolveBase(exec, ident, false, operations, pc[5].u.putToBaseOperation);
+
ASSERT(operations->size());
+ if (operations->isEmpty()) {
+ LLINT_PROFILE_VALUE(op_resolve_base, result);
+ LLINT_RETURN(result);
+ }
+
switch (operations->data()[0].m_operation) {
case ResolveOperation::ReturnGlobalObjectAsBase:
pc[0].u.opcode = LLInt::getOpcode(llint_op_resolve_base_to_global);
@@ -864,22 +858,11 @@ LLINT_SLOW_PATH_DECL(slow_path_resolve_base)
LLINT_RETURN(result);
}
-LLINT_SLOW_PATH_DECL(slow_path_ensure_property_exists)
-{
- LLINT_BEGIN();
- JSObject* object = asObject(LLINT_OP(1).jsValue());
- PropertySlot slot(object);
- Identifier& ident = exec->codeBlock()->identifier(pc[2].u.operand);
- if (!object->getPropertySlot(exec, ident, slot))
- LLINT_THROW(createErrorForInvalidGlobalAssignment(exec, ident.string()));
- LLINT_END();
-}
-
LLINT_SLOW_PATH_DECL(slow_path_resolve_with_base)
{
LLINT_BEGIN();
- ResolveOperations* operations = exec->codeBlock()->resolveOperations(pc[4].u.operand);
- JSValue result = JSScope::resolveWithBase(exec, exec->codeBlock()->identifier(pc[3].u.operand), &LLINT_OP(1), operations, exec->codeBlock()->putToBaseOperation(pc[5].u.operand));
+ ResolveOperations* operations = pc[4].u.resolveOperations;
+ JSValue result = JSScope::resolveWithBase(exec, exec->codeBlock()->identifier(pc[3].u.operand), &LLINT_OP(1), operations, pc[5].u.putToBaseOperation);
LLINT_CHECK_EXCEPTION();
LLINT_OP(2) = result;
LLINT_PROFILE_VALUE(op_resolve_with_base, result);
@@ -889,7 +872,7 @@ LLINT_SLOW_PATH_DECL(slow_path_resolve_with_base)
LLINT_SLOW_PATH_DECL(slow_path_resolve_with_this)
{
LLINT_BEGIN();
- ResolveOperations* operations = exec->codeBlock()->resolveOperations(pc[4].u.operand);
+ ResolveOperations* operations = pc[4].u.resolveOperations;
JSValue result = JSScope::resolveWithThis(exec, exec->codeBlock()->identifier(pc[3].u.operand), &LLINT_OP(1), operations);
LLINT_CHECK_EXCEPTION();
LLINT_OP(2) = result;
@@ -929,7 +912,7 @@ LLINT_SLOW_PATH_DECL(slow_path_get_by_id)
if (!structure->isUncacheableDictionary()
&& !structure->typeInfo().prohibitsPropertyCaching()) {
pc[4].u.structure.set(
- globalData, codeBlock->ownerExecutable(), structure);
+ vm, codeBlock->ownerExecutable(), structure);
if (isInlineOffset(slot.cachedOffset())) {
pc[0].u.opcode = LLInt::getOpcode(llint_op_get_by_id);
pc[5].u.operand = offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue) + JSObject::offsetOfInlineStorage();
@@ -976,7 +959,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_id)
JSValue baseValue = LLINT_OP_C(1).jsValue();
PutPropertySlot slot(codeBlock->isStrictMode());
if (pc[8].u.operand)
- asObject(baseValue)->putDirect(globalData, ident, LLINT_OP_C(3).jsValue(), slot);
+ asObject(baseValue)->putDirect(vm, ident, LLINT_OP_C(3).jsValue(), slot);
else
baseValue.put(exec, ident, LLINT_OP_C(3).jsValue(), slot);
LLINT_CHECK_EXCEPTION();
@@ -1003,17 +986,17 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_id)
if (normalizePrototypeChain(exec, baseCell) != InvalidPrototypeChain) {
ASSERT(structure->previousID()->isObject());
pc[4].u.structure.set(
- globalData, codeBlock->ownerExecutable(), structure->previousID());
+ vm, codeBlock->ownerExecutable(), structure->previousID());
if (isInlineOffset(slot.cachedOffset()))
pc[5].u.operand = offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue) + JSObject::offsetOfInlineStorage();
else
pc[5].u.operand = offsetInButterfly(slot.cachedOffset()) * sizeof(JSValue);
pc[6].u.structure.set(
- globalData, codeBlock->ownerExecutable(), structure);
+ vm, codeBlock->ownerExecutable(), structure);
StructureChain* chain = structure->prototypeChain(exec);
ASSERT(chain);
pc[7].u.structureChain.set(
- globalData, codeBlock->ownerExecutable(), chain);
+ vm, codeBlock->ownerExecutable(), chain);
if (pc[8].u.operand) {
if (isInlineOffset(slot.cachedOffset()))
@@ -1030,7 +1013,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_id)
}
} else {
pc[4].u.structure.set(
- globalData, codeBlock->ownerExecutable(), structure);
+ vm, codeBlock->ownerExecutable(), structure);
if (isInlineOffset(slot.cachedOffset())) {
pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id);
pc[5].u.operand = offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue) + JSObject::offsetOfInlineStorage();
@@ -1090,7 +1073,7 @@ LLINT_SLOW_PATH_DECL(slow_path_get_argument_by_val)
LLINT_BEGIN();
JSValue arguments = LLINT_OP(2).jsValue();
if (!arguments) {
- arguments = Arguments::create(globalData, exec);
+ arguments = Arguments::create(vm, exec);
LLINT_CHECK_EXCEPTION();
LLINT_OP(2) = arguments;
exec->uncheckedR(unmodifiedArgumentsRegister(pc[2].u.operand)) = arguments;
@@ -1118,7 +1101,7 @@ LLINT_SLOW_PATH_DECL(slow_path_put_by_val)
if (baseValue.isObject()) {
JSObject* object = asObject(baseValue);
if (object->canSetIndexQuickly(i))
- object->setIndexQuickly(globalData, i, value);
+ object->setIndexQuickly(vm, i, value);
else
object->methodTable()->putByIndex(object, exec, i, value, exec->codeBlock()->isStrictMode());
LLINT_END();
@@ -1193,9 +1176,9 @@ LLINT_SLOW_PATH_DECL(slow_path_put_getter_setter)
ASSERT(getter.isObject() || setter.isObject());
if (!getter.isUndefined())
- accessor->setGetter(globalData, asObject(getter));
+ accessor->setGetter(vm, asObject(getter));
if (!setter.isUndefined())
- accessor->setSetter(globalData, asObject(setter));
+ accessor->setSetter(vm, asObject(setter));
baseObj->putDirectAccessor(
exec,
exec->codeBlock()->identifier(pc[2].u.operand),
@@ -1203,18 +1186,6 @@ LLINT_SLOW_PATH_DECL(slow_path_put_getter_setter)
LLINT_END();
}
-LLINT_SLOW_PATH_DECL(slow_path_jmp_scopes)
-{
- LLINT_BEGIN();
- unsigned count = pc[1].u.operand;
- JSScope* tmp = exec->scope();
- while (count--)
- tmp = tmp->next();
- exec->setScope(tmp);
- pc += pc[2].u.operand;
- LLINT_END();
-}
-
LLINT_SLOW_PATH_DECL(slow_path_jtrue)
{
LLINT_BEGIN();
@@ -1345,7 +1316,7 @@ LLINT_SLOW_PATH_DECL(slow_path_new_func_exp)
static SlowPathReturnType handleHostCall(ExecState* execCallee, Instruction* pc, JSValue callee, CodeSpecializationKind kind)
{
ExecState* exec = execCallee->callerFrame();
- JSGlobalData& globalData = exec->globalData();
+ VM& vm = exec->vm();
execCallee->setScope(exec->scope());
execCallee->setCodeBlock(0);
@@ -1358,9 +1329,9 @@ static SlowPathReturnType handleHostCall(ExecState* execCallee, Instruction* pc,
ASSERT(callType != CallTypeJS);
if (callType == CallTypeHost) {
- NativeCallFrameTracer tracer(&globalData, execCallee);
+ NativeCallFrameTracer tracer(&vm, execCallee);
execCallee->setCallee(asObject(callee));
- globalData.hostCallReturnValue = JSValue::decode(callData.native.function(execCallee));
+ vm.hostCallReturnValue = JSValue::decode(callData.native.function(execCallee));
LLINT_CALL_RETURN(execCallee, pc, LLInt::getCodePtr(getHostCallReturnValue));
}
@@ -1381,9 +1352,9 @@ static SlowPathReturnType handleHostCall(ExecState* execCallee, Instruction* pc,
ASSERT(constructType != ConstructTypeJS);
if (constructType == ConstructTypeHost) {
- NativeCallFrameTracer tracer(&globalData, execCallee);
+ NativeCallFrameTracer tracer(&vm, execCallee);
execCallee->setCallee(asObject(callee));
- globalData.hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee));
+ vm.hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee));
LLINT_CALL_RETURN(execCallee, pc, LLInt::getCodePtr(getHostCallReturnValue));
}
@@ -1408,7 +1379,7 @@ inline SlowPathReturnType setUpCall(ExecState* execCallee, Instruction* pc, Code
JSFunction* callee = jsCast<JSFunction*>(calleeAsFunctionCell);
JSScope* scope = callee->scopeUnchecked();
- JSGlobalData& globalData = *scope->globalData();
+ VM& vm = *scope->vm();
execCallee->setScope(scope);
ExecutableBase* executable = callee->executable();
@@ -1429,12 +1400,12 @@ inline SlowPathReturnType setUpCall(ExecState* execCallee, Instruction* pc, Code
codePtr = functionExecutable->jsCodeEntryFor(kind);
}
- if (callLinkInfo) {
+ if (!LLINT_ALWAYS_ACCESS_SLOW && callLinkInfo) {
if (callLinkInfo->isOnList())
callLinkInfo->remove();
ExecState* execCaller = execCallee->callerFrame();
- callLinkInfo->callee.set(globalData, execCaller->codeBlock()->ownerExecutable(), callee);
- callLinkInfo->lastSeenCallee.set(globalData, execCaller->codeBlock()->ownerExecutable(), callee);
+ callLinkInfo->callee.set(vm, execCaller->codeBlock()->ownerExecutable(), callee);
+ callLinkInfo->lastSeenCallee.set(vm, execCaller->codeBlock()->ownerExecutable(), callee);
callLinkInfo->machineCodeTarget = codePtr;
if (codeBlock)
codeBlock->linkIncomingCall(callLinkInfo);
@@ -1486,7 +1457,7 @@ LLINT_SLOW_PATH_DECL(slow_path_call_varargs)
JSValue calleeAsValue = LLINT_OP_C(1).jsValue();
ExecState* execCallee = loadVarargs(
- exec, &globalData.interpreter->stack(),
+ exec, &vm.interpreter->stack(),
LLINT_OP_C(2).jsValue(), LLINT_OP_C(3).jsValue(), pc[4].u.operand);
LLINT_CALL_CHECK_EXCEPTION(exec, pc);
@@ -1515,7 +1486,7 @@ LLINT_SLOW_PATH_DECL(slow_path_call_eval)
if (!isHostFunction(calleeAsValue, globalFuncEval))
return setUpCall(execCallee, pc, CodeForCall, calleeAsValue);
- globalData.hostCallReturnValue = eval(execCallee);
+ vm.hostCallReturnValue = eval(execCallee);
LLINT_CALL_RETURN(execCallee, pc, LLInt::getCodePtr(getHostCallReturnValue));
}
@@ -1523,7 +1494,7 @@ LLINT_SLOW_PATH_DECL(slow_path_tear_off_activation)
{
LLINT_BEGIN();
ASSERT(exec->codeBlock()->needsFullScopeChain());
- jsCast<JSActivation*>(LLINT_OP(1).jsValue())->tearOff(globalData);
+ jsCast<JSActivation*>(LLINT_OP(1).jsValue())->tearOff(vm);
LLINT_END();
}
@@ -1625,9 +1596,17 @@ LLINT_SLOW_PATH_DECL(slow_path_throw_static_error)
{
LLINT_BEGIN();
if (pc[2].u.operand)
- LLINT_THROW(createReferenceError(exec, LLINT_OP_C(1).jsValue().toString(exec)->value(exec)));
+ LLINT_THROW(createReferenceError(exec, errorDescriptionForValue(exec, LLINT_OP_C(1).jsValue())->value(exec)));
else
- LLINT_THROW(createTypeError(exec, LLINT_OP_C(1).jsValue().toString(exec)->value(exec)));
+ LLINT_THROW(createTypeError(exec, errorDescriptionForValue(exec, LLINT_OP_C(1).jsValue())->value(exec)));
+}
+
+LLINT_SLOW_PATH_DECL(slow_path_handle_watchdog_timer)
+{
+ LLINT_BEGIN_NO_SET_PC();
+ if (UNLIKELY(vm.watchdog.didFire(exec)))
+ LLINT_THROW(createTerminatedExecutionException(&vm));
+ LLINT_RETURN_TWO(0, exec);
}
LLINT_SLOW_PATH_DECL(slow_path_debug)
@@ -1638,7 +1617,7 @@ LLINT_SLOW_PATH_DECL(slow_path_debug)
int lastLine = pc[3].u.operand;
int column = pc[4].u.operand;
- globalData.interpreter->debug(exec, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
+ vm.interpreter->debug(exec, static_cast<DebugHookID>(debugHookID), firstLine, lastLine, column);
LLINT_END();
}
@@ -1646,7 +1625,7 @@ LLINT_SLOW_PATH_DECL(slow_path_debug)
LLINT_SLOW_PATH_DECL(slow_path_profile_will_call)
{
LLINT_BEGIN();
- if (Profiler* profiler = globalData.enabledProfiler())
+ if (LegacyProfiler* profiler = vm.enabledProfiler())
profiler->willExecute(exec, LLINT_OP(1).jsValue());
LLINT_END();
}
@@ -1654,7 +1633,7 @@ LLINT_SLOW_PATH_DECL(slow_path_profile_will_call)
LLINT_SLOW_PATH_DECL(slow_path_profile_did_call)
{
LLINT_BEGIN();
- if (Profiler* profiler = globalData.enabledProfiler())
+ if (LegacyProfiler* profiler = vm.enabledProfiler())
profiler->didExecute(exec, LLINT_OP(1).jsValue());
LLINT_END();
}
@@ -1662,7 +1641,7 @@ LLINT_SLOW_PATH_DECL(slow_path_profile_did_call)
LLINT_SLOW_PATH_DECL(throw_from_native_call)
{
LLINT_BEGIN();
- ASSERT(globalData.exception);
+ ASSERT(vm.exception);
LLINT_END();
}