Index: src/full-codegen.h |
diff --git a/src/full-codegen.h b/src/full-codegen.h |
index 217f9e9bc986013521fae7c74f4de986236114e6..3420ca9b9b4cf4d0397539e982100db4b44f9e3d 100644 |
--- a/src/full-codegen.h |
+++ b/src/full-codegen.h |
@@ -156,6 +156,11 @@ class FullCodeGenerator: public AstVisitor { |
return previous_; |
} |
+ // Like the Exit() method above, but limited to accumulating stack depth. |
+ virtual NestedStatement* AccumulateDepth(int* stack_depth) { |
+ return previous_; |
+ } |
+ |
protected: |
MacroAssembler* masm() { return codegen_->masm(); } |
@@ -225,22 +230,36 @@ class FullCodeGenerator: public AstVisitor { |
// The try block of a try/catch statement. |
class TryCatch : public NestedStatement { |
public: |
- explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) { |
- } |
+ static const int kElementCount = TryBlockConstant::kElementCount; |
+ |
+ explicit TryCatch(FullCodeGenerator* codegen) : NestedStatement(codegen) {} |
virtual ~TryCatch() {} |
- virtual NestedStatement* Exit(int* stack_depth, int* context_length); |
+ virtual NestedStatement* Exit(int* stack_depth, int* context_length) { |
+ *stack_depth += kElementCount; |
+ return previous_; |
+ } |
+ virtual NestedStatement* AccumulateDepth(int* stack_depth) { |
+ *stack_depth += kElementCount; |
+ return previous_; |
+ } |
}; |
// The try block of a try/finally statement. |
class TryFinally : public NestedStatement { |
public: |
+ static const int kElementCount = TryBlockConstant::kElementCount; |
+ |
TryFinally(FullCodeGenerator* codegen, Label* finally_entry) |
: NestedStatement(codegen), finally_entry_(finally_entry) { |
} |
virtual ~TryFinally() {} |
virtual NestedStatement* Exit(int* stack_depth, int* context_length); |
+ virtual NestedStatement* AccumulateDepth(int* stack_depth) { |
+ *stack_depth += kElementCount; |
+ return previous_; |
+ } |
private: |
Label* finally_entry_; |
@@ -251,13 +270,17 @@ class FullCodeGenerator: public AstVisitor { |
public: |
static const int kElementCount = 3; |
- explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) { } |
+ explicit Finally(FullCodeGenerator* codegen) : NestedStatement(codegen) {} |
virtual ~Finally() {} |
virtual NestedStatement* Exit(int* stack_depth, int* context_length) { |
*stack_depth += kElementCount; |
return previous_; |
} |
+ virtual NestedStatement* AccumulateDepth(int* stack_depth) { |
+ *stack_depth += kElementCount; |
+ return previous_; |
+ } |
}; |
// The body of a for/in loop. |
@@ -274,6 +297,10 @@ class FullCodeGenerator: public AstVisitor { |
*stack_depth += kElementCount; |
return previous_; |
} |
+ virtual NestedStatement* AccumulateDepth(int* stack_depth) { |
+ *stack_depth += kElementCount; |
+ return previous_; |
+ } |
}; |
@@ -675,6 +702,8 @@ class FullCodeGenerator: public AstVisitor { |
void SetSourcePosition(int pos); |
// Non-local control flow support. |
+ void EnterTryBlock(int handler_index, Label* handler); |
+ void ExitTryBlock(int handler_index); |
void EnterFinallyBlock(); |
void ExitFinallyBlock(); |
@@ -730,7 +759,7 @@ class FullCodeGenerator: public AstVisitor { |
void PopulateDeoptimizationData(Handle<Code> code); |
void PopulateTypeFeedbackInfo(Handle<Code> code); |
- Handle<FixedArray> handler_table() { return handler_table_; } |
+ Handle<HandlerTable> handler_table() { return handler_table_; } |
struct BailoutEntry { |
BailoutId id; |
@@ -948,7 +977,7 @@ class FullCodeGenerator: public AstVisitor { |
ZoneList<BailoutEntry> bailout_entries_; |
ZoneList<BackEdgeEntry> back_edges_; |
int ic_total_count_; |
- Handle<FixedArray> handler_table_; |
+ Handle<HandlerTable> handler_table_; |
Handle<Cell> profiling_counter_; |
bool generate_debug_code_; |