/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 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
#include "CallFrame.h"
#include "CodeBlock.h"
#include "Interpreter.h"
-#include "JSGlobalData.h"
-#include "JSValue.h"
-
-#if ENABLE(JIT)
+#include "JITStubs.h"
+#include "JSCJSValue.h"
+#include "LLIntData.h"
+#include "LLIntOpcode.h"
+#include "LLIntThunks.h"
+#include "Opcode.h"
+#include "JSCInlines.h"
+#include "VM.h"
namespace JSC {
-ExceptionHandler genericThrow(JSGlobalData* globalData, ExecState* callFrame, JSValue exceptionValue, unsigned vPCIndex)
+void genericUnwind(VM* vm, ExecState* callFrame, JSValue exceptionValue)
{
- ASSERT(exceptionValue);
-
- globalData->exception = JSValue();
- HandlerInfo* handler = globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex); // This may update callFrame & exceptionValue!
- globalData->exception = exceptionValue;
+ if (Options::breakOnThrow()) {
+ dataLog("In call frame ", RawPointer(callFrame), " for code block ", *callFrame->codeBlock(), "\n");
+ CRASH();
+ }
+
+ RELEASE_ASSERT(exceptionValue);
+ HandlerInfo* handler = vm->interpreter->unwind(callFrame, exceptionValue); // This may update callFrame.
void* catchRoutine;
Instruction* catchPCForInterpreter = 0;
if (handler) {
- catchRoutine = handler->nativeCode.executableAddress();
catchPCForInterpreter = &callFrame->codeBlock()->instructions()[handler->target];
+#if ENABLE(JIT)
+ catchRoutine = handler->nativeCode.executableAddress();
+#else
+ catchRoutine = catchPCForInterpreter->u.pointer;
+#endif
} else
- catchRoutine = FunctionPtr(ctiOpThrowNotCaught).value();
+ catchRoutine = LLInt::getCodePtr(handleUncaughtException);
- globalData->callFrameForThrow = callFrame;
- globalData->targetMachinePCForThrow = catchRoutine;
- globalData->targetInterpreterPCForThrow = catchPCForInterpreter;
+ vm->callFrameForThrow = callFrame;
+ vm->targetMachinePCForThrow = catchRoutine;
+ vm->targetInterpreterPCForThrow = catchPCForInterpreter;
- ASSERT(catchRoutine);
- ExceptionHandler exceptionHandler = { catchRoutine, callFrame };
- return exceptionHandler;
-}
-
-ExceptionHandler jitThrow(JSGlobalData* globalData, ExecState* callFrame, JSValue exceptionValue, ReturnAddressPtr faultLocation)
-{
- return genericThrow(globalData, callFrame, exceptionValue, callFrame->codeBlock()->bytecodeOffset(callFrame, faultLocation));
+ RELEASE_ASSERT(catchRoutine);
}
-}
-
-#endif
+} // namespace JSC