Commit 2607dd06 authored by barraclough@apple.com's avatar barraclough@apple.com

Bug 48365 - Remove output parameters from JITStackFrame

Reviewed by Oliver Hunt.

The JIT stub functions presently use the stackframe to provide a couple of additional return values.
  * In the case of uncaught exceptions the exception value is returned on the stackframe.exception property.
  * In the case of caught exceptions the updated value for the callFrame register is returned on the stackframe.callFrame property.

Change exception returns such that exceptions are always returned on JSGlobalData::exception.
Change op_catch such that the new CallFrame value is returned from op_throw / vm_throw in regT0.

* JavaScriptCore.xcodeproj/project.pbxproj:
* debugger/Debugger.cpp:
(JSC::evaluateInGlobalCallFrame):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* interpreter/CachedCall.h:
(JSC::CachedCall::CachedCall):
(JSC::CachedCall::call):
* interpreter/CallFrame.h:
(JSC::ExecState::exception):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::callEval):
(JSC::Interpreter::Interpreter):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
* jit/JITCode.h:
(JSC::JITCode::execute):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_catch):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_catch):
* jit/JITStubs.cpp:
(JSC::ctiTrampoline):
(JSC::jitThrow):
(JSC::DEFINE_STUB_FUNCTION):
* jit/JITStubs.h:
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
* runtime/CallData.cpp:
(JSC::call):
* runtime/Completion.cpp:
(JSC::evaluate):
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/ExceptionHelpers.cpp:
(JSC::createErrorForInvalidGlobalAssignment):
(JSC::throwOutOfMemoryError):
(JSC::throwStackOverflowError):
* runtime/ExceptionHelpers.h:
* runtime/JSArray.cpp:
(JSC::JSArray::sort):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplace):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 18be5b81
2010-10-27 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
Bug 48365 - Remove output parameters from JITStackFrame
The JIT stub functions presently use the stackframe to provide a couple of additional return values.
* In the case of uncaught exceptions the exception value is returned on the stackframe.exception property.
* In the case of caught exceptions the updated value for the callFrame register is returned on the stackframe.callFrame property.
Change exception returns such that exceptions are always returned on JSGlobalData::exception.
Change op_catch such that the new CallFrame value is returned from op_throw / vm_throw in regT0.
* JavaScriptCore.xcodeproj/project.pbxproj:
* debugger/Debugger.cpp:
(JSC::evaluateInGlobalCallFrame):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* interpreter/CachedCall.h:
(JSC::CachedCall::CachedCall):
(JSC::CachedCall::call):
* interpreter/CallFrame.h:
(JSC::ExecState::exception):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::callEval):
(JSC::Interpreter::Interpreter):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::privateExecute):
* interpreter/Interpreter.h:
* jit/JITCode.h:
(JSC::JITCode::execute):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_catch):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_catch):
* jit/JITStubs.cpp:
(JSC::ctiTrampoline):
(JSC::jitThrow):
(JSC::DEFINE_STUB_FUNCTION):
* jit/JITStubs.h:
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncFilter):
(JSC::arrayProtoFuncMap):
(JSC::arrayProtoFuncEvery):
(JSC::arrayProtoFuncForEach):
(JSC::arrayProtoFuncSome):
(JSC::arrayProtoFuncReduce):
(JSC::arrayProtoFuncReduceRight):
* runtime/CallData.cpp:
(JSC::call):
* runtime/Completion.cpp:
(JSC::evaluate):
* runtime/ConstructData.cpp:
(JSC::construct):
* runtime/ExceptionHelpers.cpp:
(JSC::createErrorForInvalidGlobalAssignment):
(JSC::throwOutOfMemoryError):
(JSC::throwStackOverflowError):
* runtime/ExceptionHelpers.h:
* runtime/JSArray.cpp:
(JSC::JSArray::sort):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplace):
2010-10-27 Gabor Loki <loki@webkit.org>
Reviewed by Oliver Hunt.
......
......@@ -106,7 +106,14 @@ JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSG
if (error)
return error;
return globalObject->globalData().interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception);
JSGlobalData& globalData = globalObject->globalData();
JSValue result = globalData.interpreter->execute(eval.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain());
if (globalData.exception) {
exception = globalData.exception;
globalData.exception = JSValue();
}
ASSERT(result);
return result;
}
} // namespace JSC
......@@ -93,7 +93,14 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c
if (error)
return error;
return m_callFrame->scopeChain()->globalData->interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
JSGlobalData& globalData = m_callFrame->globalData();
JSValue result = globalData.interpreter->execute(eval.get(), m_callFrame, thisObject(), m_callFrame->scopeChain());
if (globalData.exception) {
exception = globalData.exception;
globalData.exception = JSValue();
}
ASSERT(result);
return result;
}
} // namespace JSC
......@@ -34,21 +34,20 @@
namespace JSC {
class CachedCall : public Noncopyable {
public:
CachedCall(CallFrame* callFrame, JSFunction* function, int argCount, JSValue* exception)
CachedCall(CallFrame* callFrame, JSFunction* function, int argCount)
: m_valid(false)
, m_interpreter(callFrame->interpreter())
, m_exception(exception)
, m_globalObjectScope(callFrame, function->scope().globalObject())
{
ASSERT(!function->isHostFunction());
m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope().node(), exception);
m_valid = !*exception;
m_closure = m_interpreter->prepareForRepeatCall(function->jsExecutable(), callFrame, function, argCount, function->scope().node());
m_valid = !callFrame->hadException();
}
JSValue call()
{
ASSERT(m_valid);
return m_interpreter->execute(m_closure, m_exception);
return m_interpreter->execute(m_closure);
}
void setThis(JSValue v) { m_closure.setArgument(0, v); }
void setArgument(int n, JSValue v) { m_closure.setArgument(n + 1, v); }
......@@ -69,7 +68,6 @@ namespace JSC {
private:
bool m_valid;
Interpreter* m_interpreter;
JSValue* m_exception;
DynamicGlobalObjectScope m_globalObjectScope;
CallFrameClosure m_closure;
};
......
......@@ -76,7 +76,6 @@ namespace JSC {
void clearException() { globalData().exception = JSValue(); }
JSValue exception() const { return globalData().exception; }
JSValue* exceptionSlot() { return &globalData().exception; }
bool hadException() const { return globalData().exception; }
const CommonIdentifiers& propertyNames() const { return *globalData().propertyNames; }
......
This diff is collapsed.
......@@ -93,11 +93,11 @@ namespace JSC {
}
bool isOpcode(Opcode);
JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception);
JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&, JSValue* exception);
JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&, JSValue* exception);
JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception);
JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj);
JSValue executeCall(CallFrame*, JSObject* function, CallType, const CallData&, JSValue thisValue, const ArgList&);
JSObject* executeConstruct(CallFrame*, JSObject* function, ConstructType, const ConstructData&, const ArgList&);
JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain);
JSValue retrieveArguments(CallFrame*, JSFunction*) const;
JSValue retrieveCaller(CallFrame*, JSFunction*) const;
......@@ -107,7 +107,7 @@ namespace JSC {
SamplingTool* sampler() { return m_sampler.get(); }
NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset, JSValue& exceptionValue);
NEVER_INLINE JSValue callEval(CallFrame*, RegisterFile*, Register* argv, int argc, int registerOffset);
NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset, bool);
NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine);
......@@ -117,11 +117,11 @@ namespace JSC {
private:
enum ExecutionFlag { Normal, InitializeAndReturn };
CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception);
CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*);
void endRepeatCall(CallFrameClosure&);
JSValue execute(CallFrameClosure&, JSValue* exception);
JSValue execute(CallFrameClosure&);
JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception);
JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*);
#if ENABLE(INTERPRETER)
NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue);
......@@ -144,7 +144,7 @@ namespace JSC {
static CallFrame* findFunctionCallFrame(CallFrame*, JSFunction*);
JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*, JSValue* exception);
JSValue privateExecute(ExecutionFlag, RegisterFile*, CallFrame*);
void dumpCallFrame(CallFrame*);
void dumpRegisters(CallFrame*);
......
......@@ -72,9 +72,10 @@ namespace JSC {
}
// Execute the code!
inline JSValue execute(RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData, JSValue* exception)
inline JSValue execute(RegisterFile* registerFile, CallFrame* callFrame, JSGlobalData* globalData)
{
return JSValue::decode(ctiTrampoline(m_ref.m_code.executableAddress(), registerFile, callFrame, exception, Profiler::enabledProfilerReference(), globalData));
JSValue result = JSValue::decode(ctiTrampoline(m_ref.m_code.executableAddress(), registerFile, callFrame, 0, Profiler::enabledProfilerReference(), globalData));
return globalData->exception ? jsNull() : result;
}
void* start()
......
......@@ -186,7 +186,7 @@ ALWAYS_INLINE void JIT::restoreReturnAddressBeforeReturn(Address address)
ALWAYS_INLINE void JIT::restoreArgumentReference()
{
move(stackPointerRegister, firstArgumentRegister);
poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
poke(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
}
ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
......
......@@ -1064,7 +1064,10 @@ void JIT::emit_op_push_new_scope(Instruction* currentInstruction)
void JIT::emit_op_catch(Instruction* currentInstruction)
{
killLastResultRegister(); // FIXME: Implicitly treat op_catch as a labeled statement, and remove this line of code.
peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof (void*));
move(regT0, callFrameRegister);
peek(regT3, OBJECT_OFFSETOF(struct JITStackFrame, globalData) / sizeof(void*));
loadPtr(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception)), regT0);
storePtr(ImmPtr(JSValue::encode(JSValue())), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception)));
emitPutVirtualRegister(currentInstruction[1].u.operand);
}
......@@ -1286,7 +1289,7 @@ void JIT::emit_op_create_this(Instruction* currentInstruction)
void JIT::emit_op_profile_will_call(Instruction* currentInstruction)
{
peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof (void*));
peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
Jump noProfiler = branchTestPtr(Zero, Address(regT1));
JITStubCall stubCall(this, cti_op_profile_will_call);
......@@ -1298,7 +1301,7 @@ void JIT::emit_op_profile_will_call(Instruction* currentInstruction)
void JIT::emit_op_profile_did_call(Instruction* currentInstruction)
{
peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof (void*));
peek(regT1, OBJECT_OFFSETOF(JITStackFrame, enabledProfilerReference) / sizeof(void*));
Jump noProfiler = branchTestPtr(Zero, Address(regT1));
JITStubCall stubCall(this, cti_op_profile_did_call);
......
......@@ -1386,15 +1386,17 @@ void JIT::emit_op_push_new_scope(Instruction* currentInstruction)
void JIT::emit_op_catch(Instruction* currentInstruction)
{
unsigned exception = currentInstruction[1].u.operand;
// This opcode only executes after a return from cti_op_throw.
// cti_op_throw may have taken us to a call frame further up the stack; reload
// the call frame pointer to adjust.
peek(callFrameRegister, OBJECT_OFFSETOF(struct JITStackFrame, callFrame) / sizeof(void*));
// cti_op_throw returns the callFrame for the handler.
move(regT0, callFrameRegister);
// Now store the exception returned by cti_op_throw.
loadPtr(Address(stackPointerRegister, OBJECT_OFFSETOF(struct JITStackFrame, globalData)), regT3);
load32(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), regT0);
load32(Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), regT1);
store32(Imm32(JSValue().payload()), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)));
store32(Imm32(JSValue().tag()), Address(regT3, OBJECT_OFFSETOF(JSGlobalData, exception) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)));
unsigned exception = currentInstruction[1].u.operand;
emitStore(exception, regT1, regT0);
map(m_bytecodeOffset + OPCODE_LENGTH(op_catch), exception, regT1, regT0);
}
......
This diff is collapsed.
......@@ -97,7 +97,7 @@ namespace JSC {
void* code;
RegisterFile* registerFile;
CallFrame* callFrame;
JSValue* exception;
void* unused1;
Profiler** enabledProfilerReference;
JSGlobalData* globalData;
......@@ -133,7 +133,7 @@ namespace JSC {
void* code;
RegisterFile* registerFile;
CallFrame* callFrame;
JSValue* exception;
void* unused1;
Profiler** enabledProfilerReference;
JSGlobalData* globalData;
......@@ -161,7 +161,7 @@ namespace JSC {
// These arguments passed in r1..r3 (r0 contained the entry code pointed, which is not preserved)
RegisterFile* registerFile;
CallFrame* callFrame;
JSValue* exception;
void* unused1;
// These arguments passed on the stack.
Profiler** enabledProfilerReference;
......@@ -189,7 +189,7 @@ namespace JSC {
RegisterFile* registerFile;
CallFrame* callFrame;
JSValue* exception;
void* unused1;
// These arguments passed on the stack.
Profiler** enabledProfilerReference;
......@@ -221,7 +221,7 @@ namespace JSC {
// These arguments passed in a1..a3 (a0 contained the entry code pointed, which is not preserved)
RegisterFile* registerFile;
CallFrame* callFrame;
JSValue* exception;
void* unused1;
// These arguments passed on the stack.
Profiler** enabledProfilerReference;
......@@ -252,7 +252,7 @@ namespace JSC {
extern "C" void ctiVMThrowTrampoline();
extern "C" void ctiOpThrowNotCaught();
extern "C" EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue* exception, Profiler**, JSGlobalData*);
extern "C" EncodedJSValue ctiTrampoline(void* code, RegisterFile*, CallFrame*, void* /*unused1*/, Profiler**, JSGlobalData*);
class JITThunks {
public:
......@@ -348,13 +348,11 @@ extern "C" {
EncodedJSValue JIT_STUB cti_op_strcat(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_stricteq(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_sub(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_throw(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_to_jsnumber(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_to_primitive(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_typeof(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_op_urshift(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_to_object(STUB_ARGS_DECLARATION);
EncodedJSValue JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_new_array(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_new_error(STUB_ARGS_DECLARATION);
JSObject* JIT_STUB cti_op_new_func(STUB_ARGS_DECLARATION);
......@@ -395,7 +393,6 @@ extern "C" {
void JIT_STUB cti_op_ret_scopeChain(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_tear_off_activation(STUB_ARGS_DECLARATION);
void JIT_STUB cti_op_tear_off_arguments(STUB_ARGS_DECLARATION);
void JIT_STUB cti_register_file_check(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_call_arityCheck(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_construct_arityCheck(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_call_jitCompile(STUB_ARGS_DECLARATION);
......@@ -403,8 +400,11 @@ extern "C" {
void* JIT_STUB cti_op_switch_char(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_switch_imm(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_switch_string(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_op_throw(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_register_file_check(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_vm_lazyLinkConstruct(STUB_ARGS_DECLARATION);
void* JIT_STUB cti_vm_throw(STUB_ARGS_DECLARATION);
} // extern "C"
} // namespace JSC
......
......@@ -649,7 +649,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncFilter(ExecState* exec)
if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
JSFunction* f = asFunction(function);
JSArray* array = asArray(thisObj);
CachedCall cachedCall(exec, f, 3, exec->exceptionSlot());
CachedCall cachedCall(exec, f, 3);
for (; k < length && !exec->hadException(); ++k) {
if (!array->canGetIndex(k))
break;
......@@ -707,7 +707,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncMap(ExecState* exec)
if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
JSFunction* f = asFunction(function);
JSArray* array = asArray(thisObj);
CachedCall cachedCall(exec, f, 3, exec->exceptionSlot());
CachedCall cachedCall(exec, f, 3);
for (; k < length && !exec->hadException(); ++k) {
if (UNLIKELY(!array->canGetIndex(k)))
break;
......@@ -764,7 +764,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncEvery(ExecState* exec)
if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
JSFunction* f = asFunction(function);
JSArray* array = asArray(thisObj);
CachedCall cachedCall(exec, f, 3, exec->exceptionSlot());
CachedCall cachedCall(exec, f, 3);
for (; k < length && !exec->hadException(); ++k) {
if (UNLIKELY(!array->canGetIndex(k)))
break;
......@@ -818,7 +818,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncForEach(ExecState* exec)
if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
JSFunction* f = asFunction(function);
JSArray* array = asArray(thisObj);
CachedCall cachedCall(exec, f, 3, exec->exceptionSlot());
CachedCall cachedCall(exec, f, 3);
for (; k < length && !exec->hadException(); ++k) {
if (UNLIKELY(!array->canGetIndex(k)))
break;
......@@ -865,7 +865,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncSome(ExecState* exec)
if (callType == CallTypeJS && isJSArray(&exec->globalData(), thisObj)) {
JSFunction* f = asFunction(function);
JSArray* array = asArray(thisObj);
CachedCall cachedCall(exec, f, 3, exec->exceptionSlot());
CachedCall cachedCall(exec, f, 3);
for (; k < length && !exec->hadException(); ++k) {
if (UNLIKELY(!array->canGetIndex(k)))
break;
......@@ -935,7 +935,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduce(ExecState* exec)
}
if (callType == CallTypeJS && array) {
CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot());
CachedCall cachedCall(exec, asFunction(function), 4);
for (; i < length && !exec->hadException(); ++i) {
cachedCall.setThis(jsNull());
cachedCall.setArgument(0, rv);
......@@ -1005,7 +1005,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncReduceRight(ExecState* exec)
}
if (callType == CallTypeJS && array) {
CachedCall cachedCall(exec, asFunction(function), 4, exec->exceptionSlot());
CachedCall cachedCall(exec, asFunction(function), 4);
for (; i < length && !exec->hadException(); ++i) {
unsigned idx = length - i - 1;
cachedCall.setThis(jsNull());
......
......@@ -35,7 +35,7 @@ namespace JSC {
JSValue call(ExecState* exec, JSValue functionObject, CallType callType, const CallData& callData, JSValue thisValue, const ArgList& args)
{
ASSERT(callType == CallTypeJS || callType == CallTypeHost);
return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args, exec->exceptionSlot());
return exec->interpreter()->executeCall(exec, asObject(functionObject), callType, callData, thisValue, args);
}
} // namespace JSC
......@@ -59,10 +59,12 @@ Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& s
JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
JSValue exception;
JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj, &exception);
JSValue result = exec->interpreter()->execute(program.get(), exec, scopeChain.node(), thisObj);
if (exec->hadException()) {
JSValue exception = exec->exception();
exec->clearException();
if (exception) {
ComplType exceptionType = Throw;
if (exception.isObject())
exceptionType = asObject(exception)->exceptionType();
......
......@@ -36,7 +36,7 @@ namespace JSC {
JSObject* construct(ExecState* exec, JSValue constructorObject, ConstructType constructType, const ConstructData& constructData, const ArgList& args)
{
ASSERT(constructType == ConstructTypeJS || constructType == ConstructTypeHost);
return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args, exec->exceptionSlot());
return exec->interpreter()->executeConstruct(exec, asObject(constructorObject), constructType, constructData, args);
}
} // namespace JSC
......@@ -187,14 +187,19 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error,
return exception;
}
JSValue throwOutOfMemoryError(ExecState* exec)
JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName)
{
return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
}
JSObject* throwOutOfMemoryError(ExecState* exec)
{
return throwError(exec, createError(exec, "Out of memory"));
}
JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName)
JSObject* throwStackOverflowError(ExecState* exec)
{
return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
}
return throwError(exec, createStackOverflowError(exec));
}
} // namespace JSC
......@@ -53,9 +53,11 @@ namespace JSC {
JSObject* createNotAConstructorError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
JSValue createNotAFunctionError(ExecState*, JSValue, unsigned bytecodeOffset, CodeBlock*);
JSObject* createNotAnObjectError(ExecState*, JSNotAnObjectErrorStub*, unsigned bytecodeOffset, CodeBlock*);
JSValue throwOutOfMemoryError(ExecState*);
JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const UString&);
JSObject* throwOutOfMemoryError(ExecState*);
JSObject* throwStackOverflowError(ExecState*);
} // namespace JSC
#endif // ExceptionHelpers_h
......@@ -1085,7 +1085,7 @@ void JSArray::sort(ExecState* exec, JSValue compareFunction, CallType callType,
tree.abstractor().m_nodes.grow(nodeCount);
if (callType == CallTypeJS)
tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2, exec->exceptionSlot()));
tree.abstractor().m_cachedCall = adoptPtr(new CachedCall(exec, asFunction(compareFunction), 2));
if (!tree.abstractor().m_nodes.begin()) {
throwOutOfMemoryError(exec);
......
......@@ -455,7 +455,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncEval(ExecState* exec)
if (error)
return throwVMError(exec, error);
return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()));
return JSValue::encode(exec->interpreter()->execute(eval.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node()));
}
EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)
......
......@@ -326,7 +326,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec)
// reg->numSubpatterns() + 1 for pattern args, + 2 for match start and sourceValue
int argCount = reg->numSubpatterns() + 1 + 2;
JSFunction* func = asFunction(replacement);
CachedCall cachedCall(exec, func, argCount, exec->exceptionSlot());
CachedCall cachedCall(exec, func, argCount);
if (exec->hadException())
return JSValue::encode(jsNull());
while (true) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment