Index: src/scopeinfo.h |
diff --git a/src/scopeinfo.h b/src/scopeinfo.h |
index 40c5c8a687b61c43e1773c5d6b5fabc9edb85b14..4a93fcca4995c4c4635b2badd64b9631398b5454 100644 |
--- a/src/scopeinfo.h |
+++ b/src/scopeinfo.h |
@@ -31,6 +31,7 @@ |
#include "allocation.h" |
#include "variables.h" |
#include "zone-inl.h" |
+#include "scopes.h" |
Kevin Millikin (Chromium)
2011/10/05 08:43:36
Maybe we should avoid this? It's not yet a circul
Steven
2011/10/06 19:09:27
Yes, I totally agree.
On 2011/10/05 08:43:36, Kevi
|
namespace v8 { |
namespace internal { |
@@ -83,6 +84,10 @@ class ScopeInfo BASE_EMBEDDED { |
Handle<String> LocalName(int i) const; |
int NumberOfLocals() const; |
+ Scope::Type type() const { return type_; } |
+ int SourceBegStatementPos() const { return source_beg_statement_pos_; } |
+ int SourceEndStatementPos() const { return source_end_statement_pos_; } |
+ |
// -------------------------------------------------------------------------- |
// Debugging support |
@@ -94,10 +99,14 @@ class ScopeInfo BASE_EMBEDDED { |
Handle<String> function_name_; |
bool calls_eval_; |
bool is_strict_mode_; |
+ Scope::Type type_; |
+ int source_beg_statement_pos_; |
+ int source_end_statement_pos_; |
List<Handle<String>, Allocator > parameters_; |
List<Handle<String>, Allocator > stack_slots_; |
List<Handle<String>, Allocator > context_slots_; |
List<Variable::Mode, Allocator > context_modes_; |
+ List<Handle<SerializedScopeInfo>, Allocator> inner_scopeinfos_; |
}; |
@@ -111,21 +120,39 @@ class SerializedScopeInfo : public FixedArray { |
return reinterpret_cast<SerializedScopeInfo*>(object); |
} |
+ // Return the type of this scope. |
+ Scope::Type ScopeType(); |
+ |
// Does this scope call eval? |
bool CallsEval(); |
// Is this scope a strict mode scope? |
bool IsStrictMode(); |
+ // Start position of this scope in the source string. |
Kevin Millikin (Chromium)
2011/10/05 08:43:36
I think we want a crisp characterization of start
Steven
2011/10/06 19:09:27
Added a description to scopes.h. PTAL there.
On 20
|
+ int SourceBegStatementPos(); |
+ |
+ // End position of this scope in the source string. |
+ int SourceEndStatementPos(); |
+ |
// Return the number of stack slots for code. |
int NumberOfStackSlots(); |
// Return the number of context slots for code. |
int NumberOfContextSlots(); |
+ // Return the number of immediate nested scopes. |
+ int NumberOfNestedScopes(); |
+ |
+ // Lookup an immediate nested scope by its index. |
+ Handle<SerializedScopeInfo> NestedScope(int i); |
+ |
// Return if this has context slots besides MIN_CONTEXT_SLOTS; |
bool HasHeapAllocatedLocals(); |
+ // Return if contexts are allocated for this scope. |
+ bool HasContext(); |
+ |
// Lookup support for serialized scope info. Returns the |
// the stack slot index for a given slot name if the slot is |
// present; otherwise returns a value < 0. The name must be a symbol |
@@ -150,6 +177,13 @@ class SerializedScopeInfo : public FixedArray { |
// must be a symbol (canonicalized). |
int FunctionContextSlotIndex(String* name); |
+ // Get the chain of nested scopes within this scope for the source statement |
+ // position. The scopes will be added to the list from the outermost scope to |
+ // the innermost scope. Only nested block, catch or with scopes are tracked |
+ // and will be returned, but no inner function scopes. |
+ void GetNestedScopeChain(List<Handle<SerializedScopeInfo> >* chain, |
+ int statement_position); |
+ |
static Handle<SerializedScopeInfo> Create(Scope* scope); |
// Serializes empty scope info. |
@@ -161,6 +195,8 @@ class SerializedScopeInfo : public FixedArray { |
inline Object** ParameterEntriesAddr(); |
inline Object** StackSlotEntriesAddr(); |
+ |
+ inline Object** NestedScopeEntriesAddr(); |
}; |