Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: src/frames.h

Issue 2096863003: [wasm] prototype for breakpoint support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@extend-script-functionality
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.cc ('k') | src/frames.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.h
diff --git a/src/frames.h b/src/frames.h
index 0e48a4ac7a594ff3aecd2b442314608898df56d3..860868b2c75fb8cc5be3266925e7dd27ec748947 100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -103,9 +103,10 @@ class StackHandler BASE_EMBEDDED {
V(EXIT, ExitFrame) \
V(JAVA_SCRIPT, JavaScriptFrame) \
V(OPTIMIZED, OptimizedFrame) \
- V(WASM, WasmFrame) \
+ V(WASM_COMPILED, WasmCompiledFrame) \
V(WASM_TO_JS, WasmToJsFrame) \
V(JS_TO_WASM, JsToWasmFrame) \
+ V(WASM_INTERPRETED, WasmInterpretedFrame) \
V(INTERPRETED, InterpretedFrame) \
V(STUB, StubFrame) \
V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \
@@ -416,7 +417,8 @@ class StackFrame BASE_EMBEDDED {
bool is_exit() const { return type() == EXIT; }
bool is_optimized() const { return type() == OPTIMIZED; }
bool is_interpreted() const { return type() == INTERPRETED; }
- bool is_wasm() const { return type() == WASM; }
+ bool is_wasm_compiled() const { return type() == WASM_COMPILED; }
+ bool is_wasm_interpreted() const { return type() == WASM_INTERPRETED; }
bool is_wasm_to_js() const { return type() == WASM_TO_JS; }
bool is_js_to_wasm() const { return type() == JS_TO_WASM; }
bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; }
@@ -433,6 +435,10 @@ class StackFrame BASE_EMBEDDED {
return (type == JAVA_SCRIPT) || (type == OPTIMIZED) ||
(type == INTERPRETED) || (type == BUILTIN);
}
+ bool is_wasm() const {
+ Type type = this->type();
+ return type == WASM_COMPILED || type == WASM_INTERPRETED;
+ }
// Accessors.
Address sp() const { return state_.sp; }
@@ -643,37 +649,51 @@ class ExitFrame: public StackFrame {
friend class StackFrameIteratorBase;
};
-class JavaScriptFrame;
+class StandardFrame;
class FrameSummary BASE_EMBEDDED {
public:
- // Mode for JavaScriptFrame::Summarize. Exact summary is required to produce
+ // Mode for StandardFrame::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 };
+ enum Flags { kNone = 0, kIsConstructor = 1 << 0, kIsWasm = 1 << 1 };
+ // Constructor for JavaScript frame summaries.
FrameSummary(Object* receiver, JSFunction* function,
AbstractCode* abstract_code, int code_offset,
bool is_constructor, Mode mode = kExactSummary);
+ // Constructor for Wasm frame summaries.
+ FrameSummary(Object* wasm_object, int function_index,
+ AbstractCode* abstract_code, int code_offset,
+ Mode mode = kExactSummary);
- static FrameSummary GetFirst(JavaScriptFrame* frame);
+ static FrameSummary GetFirst(StandardFrame* frame);
+ static FrameSummary GetLast(StandardFrame* frame);
- Handle<Object> receiver() { return receiver_; }
- Handle<JSFunction> function() { return function_; }
+ inline Handle<Object> receiver();
+ inline Handle<Object> wasm_object();
+ inline Handle<JSFunction> function();
+ Script* script();
+ inline int wasm_function_index();
Handle<AbstractCode> abstract_code() { return abstract_code_; }
int code_offset() { return code_offset_; }
- bool is_constructor() { return is_constructor_; }
+ bool is_constructor() { return flags & kIsConstructor; }
+ inline bool is_subject_to_debugging();
+
+ bool is_wasm() { return flags & kIsWasm; }
+ bool is_javascript() { return !(flags & kIsWasm); }
void Print();
private:
Handle<Object> receiver_;
- Handle<JSFunction> function_;
+ Handle<Object> function_;
Handle<AbstractCode> abstract_code_;
int code_offset_;
- bool is_constructor_;
+ Flags flags;
};
class StandardFrame : public StackFrame {
@@ -685,6 +705,7 @@ class StandardFrame : public StackFrame {
virtual Object* receiver() const;
virtual Script* script() const;
virtual Object* context() const;
+ virtual Object* debug_info(bool create) const;
// Access the expressions in the stack frame including locals.
inline Object* GetExpression(int index) const;
@@ -700,6 +721,11 @@ class StandardFrame : public StackFrame {
// Check if this frame is a constructor frame invoked through 'new'.
virtual bool IsConstructor() const;
+ // Build a list with summaries for this frame including all inlined frames.
+ virtual void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
+
static StandardFrame* cast(StackFrame* frame) {
DCHECK(frame->is_standard());
return static_cast<StandardFrame*>(frame);
@@ -749,16 +775,16 @@ 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(
+ void Summarize(
List<FrameSummary>* frames,
- FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
// Accessors.
virtual JSFunction* function() const;
Object* receiver() const override;
Object* context() const override;
Script* script() const override;
+ Object* debug_info(bool create) const override;
inline void set_receiver(Object* value);
@@ -998,8 +1024,6 @@ class BuiltinFrame final : public JavaScriptFrame {
class WasmFrame : public StandardFrame {
public:
- Type type() const override { return WASM; }
-
// GC support.
void Iterate(ObjectVisitor* v) const override;
@@ -1011,12 +1035,10 @@ class WasmFrame : public StandardFrame {
Code* unchecked_code() const override;
// Accessors.
- Object* wasm_obj() const;
- uint32_t function_index() const;
- Script* script() const override;
+ virtual Object* wasm_obj() const = 0;
static WasmFrame* cast(StackFrame* frame) {
- DCHECK(frame->is_wasm());
+ DCHECK(frame->is_wasm_compiled() || frame->is_wasm_interpreted());
return static_cast<WasmFrame*>(frame);
}
@@ -1029,6 +1051,57 @@ class WasmFrame : public StandardFrame {
friend class StackFrameIteratorBase;
};
+class WasmCompiledFrame : public WasmFrame {
+ public:
+ Type type() const override { return WASM_COMPILED; }
+
+ // Accessors.
+ Object* wasm_obj() const override;
+ uint32_t function_index() const;
+ Script* script() const override;
+ Object* debug_info(bool create) const override;
+
+ void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
+
+ static WasmCompiledFrame* cast(StackFrame* frame) {
+ DCHECK(frame->is_wasm_compiled());
+ return static_cast<WasmCompiledFrame*>(frame);
+ }
+
+ protected:
+ inline explicit WasmCompiledFrame(StackFrameIteratorBase* iterator);
+
+ private:
+ friend class StackFrameIteratorBase;
+};
+
+class WasmInterpretedFrame : public WasmFrame {
+ public:
+ Type type() const override { return WASM_INTERPRETED; }
+
+ // Accessors.
+ Object* wasm_obj() const override;
+ // Return the debug info for the top-most interpreted function.
+ Object* debug_info(bool create) const override;
+
+ static WasmInterpretedFrame* cast(StackFrame* frame) {
+ DCHECK(frame->is_wasm_interpreted());
+ return static_cast<WasmInterpretedFrame*>(frame);
+ }
+
+ void Summarize(
+ List<FrameSummary>* frames,
+ FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
+
+ protected:
+ inline explicit WasmInterpretedFrame(StackFrameIteratorBase* iterator);
+
+ private:
+ friend class StackFrameIteratorBase;
+};
+
class WasmToJsFrame : public StubFrame {
public:
Type type() const override { return WASM_TO_JS; }
« no previous file with comments | « src/factory.cc ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698