| Index: src/scopes.h
|
| diff --git a/src/scopes.h b/src/scopes.h
|
| index e76fb50598c3a6267576a30a8970a626938e970c..d47b8e3c0e846b6185172e3bd9870952190cbf2b 100644
|
| --- a/src/scopes.h
|
| +++ b/src/scopes.h
|
| @@ -93,7 +93,8 @@ class Scope: public ZoneObject {
|
| EVAL_SCOPE, // The top-level scope for an eval source.
|
| FUNCTION_SCOPE, // The top-level scope for a function.
|
| GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
|
| - CATCH_SCOPE // The scope introduced by catch.
|
| + CATCH_SCOPE, // The scope introduced by catch.
|
| + WITH_SCOPE
|
| };
|
|
|
| Scope(Scope* outer_scope, Type type);
|
| @@ -200,10 +201,12 @@ class Scope: public ZoneObject {
|
| // Predicates.
|
|
|
| // Specific scope types.
|
| + Type type() const { return type_; }
|
| bool is_eval_scope() const { return type_ == EVAL_SCOPE; }
|
| bool is_function_scope() const { return type_ == FUNCTION_SCOPE; }
|
| bool is_global_scope() const { return type_ == GLOBAL_SCOPE; }
|
| bool is_catch_scope() const { return type_ == CATCH_SCOPE; }
|
| + bool is_with_scope() const { return type_ == WITH_SCOPE; }
|
| bool is_strict_mode() const { return strict_mode_; }
|
| bool is_strict_mode_eval_scope() const {
|
| return is_eval_scope() && is_strict_mode();
|
| @@ -275,9 +278,24 @@ class Scope: public ZoneObject {
|
| int num_var_or_const() { return num_var_or_const_; }
|
|
|
| // Result of variable allocation.
|
| + int num_stack_allocs() const {
|
| + ASSERT(num_stack_allocs_ >= num_stack_slots_);
|
| + return num_stack_allocs_;
|
| + }
|
| int num_stack_slots() const { return num_stack_slots_; }
|
| int num_heap_slots() const { return num_heap_slots_; }
|
|
|
| + int SourceBegStatementPos() const { return source_beg_statement_pos_; }
|
| + void SetSourceBegStatementPos(int statement_pos) {
|
| + source_beg_statement_pos_ = statement_pos;
|
| + }
|
| + int SourceEndStatementPos() const { return source_end_statement_pos_; }
|
| + void SetSourceEndStatementPos(int statement_pos) {
|
| + source_end_statement_pos_ = statement_pos;
|
| + }
|
| +
|
| + ZoneList<Scope*>* InnerScopes() { return &inner_scopes_; }
|
| +
|
| // Make sure this scope and all outer scopes are eagerly compiled.
|
| void ForceEagerCompilation() { force_eager_compilation_ = true; }
|
|
|
| @@ -357,11 +375,17 @@ class Scope: public ZoneObject {
|
| // Illegal redeclaration.
|
| Expression* illegal_redecl_;
|
|
|
| - // Scope-specific information.
|
| - bool scope_inside_with_; // this scope is inside a 'with' of some outer scope
|
| - bool scope_contains_with_; // this scope contains a 'with' statement
|
| - bool scope_calls_eval_; // this scope contains an 'eval' call
|
| - bool strict_mode_; // this scope is a strict mode scope
|
| + // Scope-specific information computed during parsing.
|
| + //
|
| + // This scope is inside a 'with' of some outer scope.
|
| + bool scope_inside_with_;
|
| + // This scope contains a 'with' statement.
|
| + bool scope_contains_with_;
|
| + // This scope or a nested catch scope or with scope contain an 'eval' call. At
|
| + // the 'eval' call site this scope is the declaration scope.
|
| + bool scope_calls_eval_;
|
| + // This scope is a strict mode scope.
|
| + bool strict_mode_;
|
|
|
| // Computed via PropagateScopeInfo.
|
| bool outer_scope_calls_eval_;
|
| @@ -378,9 +402,14 @@ class Scope: public ZoneObject {
|
| int num_var_or_const_;
|
|
|
| // Computed via AllocateVariables; function scopes only.
|
| + int num_stack_allocs_;
|
| int num_stack_slots_;
|
| int num_heap_slots_;
|
|
|
| + // Source information.
|
| + int source_beg_statement_pos_;
|
| + int source_end_statement_pos_;
|
| +
|
| // Serialized scopes support.
|
| Handle<SerializedScopeInfo> scope_info_;
|
| bool already_resolved() { return already_resolved_; }
|
| @@ -404,6 +433,7 @@ class Scope: public ZoneObject {
|
| bool outer_scope_calls_non_strict_eval,
|
| bool outer_scope_is_eval_scope);
|
| bool HasTrivialContext() const;
|
| + bool HasContext() const;
|
|
|
| // Predicates.
|
| bool MustAllocate(Variable* var);
|
|
|