Index: src/compiler/wasm-compiler.h |
diff --git a/src/compiler/wasm-compiler.h b/src/compiler/wasm-compiler.h |
index 4a4b1a7cd04ba05f638bbe7a35879364a926fbcd..1b46f37ff01ceed396371a112f6815d3de4f017d 100644 |
--- a/src/compiler/wasm-compiler.h |
+++ b/src/compiler/wasm-compiler.h |
@@ -18,6 +18,8 @@ namespace compiler { |
class Node; |
class JSGraph; |
class Graph; |
+class SourcePositionTable; |
+class SourcePositionScope; |
} |
namespace wasm { |
@@ -55,7 +57,14 @@ Handle<JSFunction> CompileJSToWasmWrapper( |
class WasmTrapHelper; |
class WasmGraphBuilder { |
public: |
- WasmGraphBuilder(Zone* z, JSGraph* g, wasm::FunctionSig* function_signature); |
+ WasmGraphBuilder( |
+ Zone* z, JSGraph* g, wasm::FunctionSig* function_signature, |
+ compiler::SourcePositionTable* source_position_table = nullptr); |
+ |
+ ~WasmGraphBuilder() { |
+ // check that Enter- / LeaveSourcePositionScope is balanced |
+ DCHECK_NULL(source_position_scope_); |
+ } |
Node** Buffer(size_t count) { |
if (count > cur_bufsize_) { |
@@ -141,6 +150,18 @@ class WasmGraphBuilder { |
void Int64LoweringForTesting(); |
+ // Register a graph decorator to assign source positions to nodes (in |
titzer
2016/04/18 11:03:51
I don't think we should add scoping for this. I th
Clemens Hammacher
2016/04/18 11:18:10
What about step-through debugging? Wouldn't that r
|
+ // source_position_table_). Only has an effect if source_position_table_ is |
+ // non-null. Ensure to call LeaveSourcePositionScope afterwards. |
+ void EnterSourcePositionScope(); |
+ void LeaveSourcePositionScope(); |
+ |
+ // Set current source position, such that all nodes created after this call |
+ // get the respecitve position assigned. This only has an effect if |
+ // source_position_table_ is non-null and EnterSourcePositionScope was called |
+ // before. |
+ void SetCurrentSourcePosition(int position); |
+ |
private: |
static const int kDefaultBufferSize = 16; |
friend class WasmTrapHelper; |
@@ -160,6 +181,9 @@ class WasmGraphBuilder { |
WasmTrapHelper* trap_; |
wasm::FunctionSig* function_signature_; |
+ compiler::SourcePositionTable* source_position_table_ = nullptr; |
+ compiler::SourcePositionScope* source_position_scope_ = nullptr; |
+ |
// Internal helper methods. |
JSGraph* jsgraph() { return jsgraph_; } |
Graph* graph(); |