Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/frames.h b/src/frames.h
index f6806d7..4163d6f 100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -324,31 +324,22 @@
StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize;
// FP-relative.
+ static const int kLastParamFromFp = StandardFrameConstants::kCallerSPOffset;
static const int kNewTargetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize;
static const int kBytecodeArrayFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize;
static const int kBytecodeOffsetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize;
- static const int kRegisterFilePointerFromFp =
+ static const int kRegisterFileFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 4 * kPointerSize;
- static const int kExpressionsOffset = kRegisterFilePointerFromFp;
+ static const int kExpressionsOffset = kRegisterFileFromFp;
// Expression index for {StandardFrame::GetExpressionAddress}.
static const int kBytecodeArrayExpressionIndex = -2;
static const int kBytecodeOffsetExpressionIndex = -1;
static const int kRegisterFileExpressionIndex = 0;
-
- // Register file pointer relative.
- static const int kLastParamFromRegisterPointer =
- StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
-
- static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize;
- static const int kBytecodeArrayFromRegisterPointer = 2 * kPointerSize;
- static const int kNewTargetFromRegisterPointer = 3 * kPointerSize;
- static const int kFunctionFromRegisterPointer = 4 * kPointerSize;
- static const int kContextFromRegisterPointer = 5 * kPointerSize;
};
inline static int FPOffsetToFrameSlot(int frame_offset) {
@@ -640,8 +631,40 @@
friend class StackFrameIteratorBase;
};
+class JavaScriptFrame;
-class StandardFrame: public StackFrame {
+class FrameSummary BASE_EMBEDDED {
+ public:
+ // Mode for JavaScriptFrame::Summarize. Exact summary is required to produce
+ // an exact stack trace. It will trigger an assertion failure if that is not
+ // possible, e.g., because of missing deoptimization information. The
+ // approximate mode should produce a summary even without deoptimization
+ // information, but it might miss frames.
+ enum Mode { kExactSummary, kApproximateSummary };
+
+ FrameSummary(Object* receiver, JSFunction* function,
+ AbstractCode* abstract_code, int code_offset,
+ bool is_constructor, Mode mode = kExactSummary);
+
+ static FrameSummary GetFirst(JavaScriptFrame* frame);
+
+ Handle<Object> receiver() { return receiver_; }
+ Handle<JSFunction> function() { return function_; }
+ Handle<AbstractCode> abstract_code() { return abstract_code_; }
+ int code_offset() { return code_offset_; }
+ bool is_constructor() { return is_constructor_; }
+
+ void Print();
+
+ private:
+ Handle<Object> receiver_;
+ Handle<JSFunction> function_;
+ Handle<AbstractCode> abstract_code_;
+ int code_offset_;
+ bool is_constructor_;
+};
+
+class StandardFrame : public StackFrame {
public:
// Testers.
bool is_standard() const override { return true; }
@@ -701,36 +724,19 @@
friend class SafeStackFrameIterator;
};
-
-class FrameSummary BASE_EMBEDDED {
- public:
- FrameSummary(Object* receiver, JSFunction* function,
- AbstractCode* abstract_code, int code_offset,
- bool is_constructor);
-
- Handle<Object> receiver() { return receiver_; }
- Handle<JSFunction> function() { return function_; }
- Handle<AbstractCode> abstract_code() { return abstract_code_; }
- int code_offset() { return code_offset_; }
- bool is_constructor() { return is_constructor_; }
-
- void Print();
-
- private:
- Handle<Object> receiver_;
- Handle<JSFunction> function_;
- Handle<AbstractCode> abstract_code_;
- int code_offset_;
- bool is_constructor_;
-};
-
class JavaScriptFrame : public StandardFrame {
public:
Type type() const override { return JAVA_SCRIPT; }
+ // Build a list with summaries for this frame including all inlined frames.
+ virtual void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
+
// Accessors.
- inline JSFunction* function() const;
- inline Object* receiver() const;
+ virtual JSFunction* function() const;
+ virtual Object* receiver() const;
+
inline void set_receiver(Object* value);
// Access the parameters.
@@ -747,7 +753,6 @@
// Generator support to preserve operand stack.
void SaveOperandStack(FixedArray* store) const;
- void RestoreOperandStack(FixedArray* store);
// Debugger access.
void SetParameterValue(int index, Object* value) const;
@@ -778,9 +783,6 @@
// Return a list with JSFunctions of this frame.
virtual void GetFunctions(List<JSFunction*>* functions) const;
- // Build a list with summaries for this frame including all inlined frames.
- virtual void Summarize(List<FrameSummary>* frames);
-
// Lookup exception handler for current {pc}, returns -1 if none found. Also
// returns data associated with the handler site specific to the frame type:
// - JavaScriptFrame : Data is the stack depth at entry of the try-block.
@@ -857,7 +859,9 @@
// is the top-most activation)
void GetFunctions(List<JSFunction*>* functions) const override;
- void Summarize(List<FrameSummary>* frames) override;
+ void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
// Lookup exception handler for current {pc}, returns -1 if none found.
int LookupExceptionHandlerInTable(
@@ -893,17 +897,20 @@
void PatchBytecodeOffset(int new_offset);
// Returns the frame's current bytecode array.
- Object* GetBytecodeArray() const;
+ BytecodeArray* GetBytecodeArray() const;
// Updates the frame's BytecodeArray with |bytecode_array|. Used by the
// debugger to swap execution onto a BytecodeArray patched with breakpoints.
- void PatchBytecodeArray(Object* bytecode_array);
+ void PatchBytecodeArray(BytecodeArray* bytecode_array);
// Access to the interpreter register file for this frame.
- Object* GetInterpreterRegister(int register_index) const;
+ Object* ReadInterpreterRegister(int register_index) const;
+ void WriteInterpreterRegister(int register_index, Object* value);
// Build a list with summaries for this frame including all inlined frames.
- void Summarize(List<FrameSummary>* frames) override;
+ void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
protected:
inline explicit InterpretedFrame(StackFrameIteratorBase* iterator);
@@ -961,6 +968,11 @@
// Determine the code for the frame.
Code* unchecked_code() const override;
+ Object* wasm_obj();
+ uint32_t function_index();
+
+ Object* function_name();
+
static WasmFrame* cast(StackFrame* frame) {
DCHECK(frame->is_wasm());
return static_cast<WasmFrame*>(frame);
@@ -1143,17 +1155,25 @@
StackFrameIterator iterator_;
};
-// NOTE: The stack trace frame iterator is an iterator that only
-// traverse proper JavaScript frames; that is JavaScript frames that
-// have proper JavaScript functions. This excludes the problematic
-// functions in runtime.js.
-class StackTraceFrameIterator: public JavaScriptFrameIterator {
+// NOTE: The stack trace frame iterator is an iterator that only traverse proper
+// JavaScript frames that have proper JavaScript functions and WASM frames.
+// This excludes the problematic functions in runtime.js.
+class StackTraceFrameIterator BASE_EMBEDDED {
public:
explicit StackTraceFrameIterator(Isolate* isolate);
+ bool done() const { return iterator_.done(); }
void Advance();
+ inline StandardFrame* frame() const;
+
+ inline bool is_javascript() const;
+ inline bool is_wasm() const;
+ inline JavaScriptFrame* javascript_frame() const;
+ inline WasmFrame* wasm_frame() const;
+
private:
- bool IsValidFrame();
+ StackFrameIterator iterator_;
+ bool IsValidFrame(StackFrame* frame) const;
};