diff options
Diffstat (limited to 'Source/JavaScriptCore/interpreter/Interpreter.h')
-rw-r--r-- | Source/JavaScriptCore/interpreter/Interpreter.h | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h index c3bca1ad7..e5eca0e1c 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.h +++ b/Source/JavaScriptCore/interpreter/Interpreter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2013 Apple Inc. All rights reserved. * Copyright (C) 2012 Research In Motion Limited. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,9 +31,9 @@ #define Interpreter_h #include "ArgList.h" +#include "JSCJSValue.h" #include "JSCell.h" #include "JSFunction.h" -#include "JSValue.h" #include "JSObject.h" #include "JSStack.h" #include "LLIntData.h" @@ -48,7 +48,7 @@ namespace JSC { class EvalExecutable; class ExecutableBase; class FunctionExecutable; - class JSGlobalData; + class VM; class JSGlobalObject; class LLIntOffsetsExtractor; class ProgramExecutable; @@ -79,25 +79,14 @@ namespace JSC { Strong<JSObject> callee; StackFrameCodeType codeType; Strong<ExecutableBase> executable; - int line; + Strong<UnlinkedCodeBlock> codeBlock; + RefPtr<SourceProvider> code; + int lineOffset; + unsigned firstLineColumnOffset; + unsigned characterOffset; + unsigned bytecodeOffset; String sourceURL; - String toString(CallFrame* callFrame) const - { - StringBuilder traceBuild; - String functionName = friendlyFunctionName(callFrame); - String sourceURL = friendlySourceURL(); - traceBuild.append(functionName); - if (!sourceURL.isEmpty()) { - if (!functionName.isEmpty()) - traceBuild.append('@'); - traceBuild.append(sourceURL); - if (line > -1) { - traceBuild.append(':'); - traceBuild.appendNumber(line); - } - } - return traceBuild.toString().impl(); - } + JS_EXPORT_PRIVATE String toString(CallFrame*); String friendlySourceURL() const { String traceLine; @@ -137,16 +126,16 @@ namespace JSC { } return traceLine.isNull() ? emptyString() : traceLine; } - unsigned friendlyLineNumber() const - { - return line > -1 ? line : 0; - } + JS_EXPORT_PRIVATE void computeLineAndColumn(unsigned& line, unsigned& column); + + private: + void expressionInfo(int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column); }; class TopCallFrameSetter { public: - TopCallFrameSetter(JSGlobalData& global, CallFrame* callFrame) - : globalData(global) + TopCallFrameSetter(VM& global, CallFrame* callFrame) + : vm(global) , oldCallFrame(global.topCallFrame) { global.topCallFrame = callFrame; @@ -154,16 +143,16 @@ namespace JSC { ~TopCallFrameSetter() { - globalData.topCallFrame = oldCallFrame; + vm.topCallFrame = oldCallFrame; } private: - JSGlobalData& globalData; + VM& vm; CallFrame* oldCallFrame; }; class NativeCallFrameTracer { public: - ALWAYS_INLINE NativeCallFrameTracer(JSGlobalData* global, CallFrame* callFrame) + ALWAYS_INLINE NativeCallFrameTracer(VM* global, CallFrame* callFrame) { ASSERT(global); ASSERT(callFrame); @@ -186,7 +175,7 @@ namespace JSC { Interpreter& m_interpreter; }; - Interpreter(JSGlobalData &); + Interpreter(VM &); ~Interpreter(); void initialize(bool canUseJIT); @@ -229,11 +218,13 @@ namespace JSC { SamplingTool* sampler() { return m_sampler.get(); } + bool isInErrorHandlingMode() { return m_errorHandlingModeReentry; } + NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset); NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column); static const String getTraceLine(CallFrame*, StackFrameCodeType, const String&, int); - JS_EXPORT_PRIVATE static void getStackTrace(JSGlobalData*, Vector<StackFrame>& results); - static void addStackTraceIfNecessary(CallFrame*, JSObject* error); + JS_EXPORT_PRIVATE static void getStackTrace(VM*, Vector<StackFrame>& results, size_t maxStackSize = std::numeric_limits<size_t>::max()); + static void addStackTraceIfNecessary(CallFrame*, JSValue error); void dumpSampleData(ExecState* exec); void startSampling(); @@ -242,16 +233,6 @@ namespace JSC { JS_EXPORT_PRIVATE void dumpCallFrame(CallFrame*); private: - class StackPolicy { - public: - StackPolicy(Interpreter&, const StackBounds&); - inline size_t requiredCapacity() { return m_requiredCapacity; } - - private: - Interpreter& m_interpreter; - size_t m_requiredCapacity; - }; - enum ExecutionFlag { Normal, InitializeAndReturn }; CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argumentCountIncludingThis, JSScope*); |