| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // end position: end position of last token of 'stmt' | 262 // end position: end position of last token of 'stmt' |
| 263 int start_position() const { return start_position_; } | 263 int start_position() const { return start_position_; } |
| 264 void set_start_position(int statement_pos) { | 264 void set_start_position(int statement_pos) { |
| 265 start_position_ = statement_pos; | 265 start_position_ = statement_pos; |
| 266 } | 266 } |
| 267 int end_position() const { return end_position_; } | 267 int end_position() const { return end_position_; } |
| 268 void set_end_position(int statement_pos) { | 268 void set_end_position(int statement_pos) { |
| 269 end_position_ = statement_pos; | 269 end_position_ = statement_pos; |
| 270 } | 270 } |
| 271 | 271 |
| 272 // In some cases we want to force context allocation for a whole scope. |
| 273 void ForceContextAllocation() { |
| 274 ASSERT(!already_resolved()); |
| 275 force_context_allocation_ = true; |
| 276 } |
| 277 bool has_forced_context_allocation() const { |
| 278 return force_context_allocation_; |
| 279 } |
| 280 |
| 272 // --------------------------------------------------------------------------- | 281 // --------------------------------------------------------------------------- |
| 273 // Predicates. | 282 // Predicates. |
| 274 | 283 |
| 275 // Specific scope types. | 284 // Specific scope types. |
| 276 bool is_eval_scope() const { return type_ == EVAL_SCOPE; } | 285 bool is_eval_scope() const { return type_ == EVAL_SCOPE; } |
| 277 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } | 286 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } |
| 278 bool is_module_scope() const { return type_ == MODULE_SCOPE; } | 287 bool is_module_scope() const { return type_ == MODULE_SCOPE; } |
| 279 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } | 288 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } |
| 280 bool is_catch_scope() const { return type_ == CATCH_SCOPE; } | 289 bool is_catch_scope() const { return type_ == CATCH_SCOPE; } |
| 281 bool is_block_scope() const { return type_ == BLOCK_SCOPE; } | 290 bool is_block_scope() const { return type_ == BLOCK_SCOPE; } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // The language mode of this scope. | 496 // The language mode of this scope. |
| 488 LanguageMode language_mode_; | 497 LanguageMode language_mode_; |
| 489 // Source positions. | 498 // Source positions. |
| 490 int start_position_; | 499 int start_position_; |
| 491 int end_position_; | 500 int end_position_; |
| 492 | 501 |
| 493 // Computed via PropagateScopeInfo. | 502 // Computed via PropagateScopeInfo. |
| 494 bool outer_scope_calls_non_strict_eval_; | 503 bool outer_scope_calls_non_strict_eval_; |
| 495 bool inner_scope_calls_eval_; | 504 bool inner_scope_calls_eval_; |
| 496 bool force_eager_compilation_; | 505 bool force_eager_compilation_; |
| 506 bool force_context_allocation_; |
| 497 | 507 |
| 498 // True if it doesn't need scope resolution (e.g., if the scope was | 508 // True if it doesn't need scope resolution (e.g., if the scope was |
| 499 // constructed based on a serialized scope info or a catch context). | 509 // constructed based on a serialized scope info or a catch context). |
| 500 bool already_resolved_; | 510 bool already_resolved_; |
| 501 | 511 |
| 502 // Computed as variables are declared. | 512 // Computed as variables are declared. |
| 503 int num_var_or_const_; | 513 int num_var_or_const_; |
| 504 | 514 |
| 505 // Computed via AllocateVariables; function, block and catch scopes only. | 515 // Computed via AllocateVariables; function, block and catch scopes only. |
| 506 int num_stack_slots_; | 516 int num_stack_slots_; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 void SetDefaults(ScopeType type, | 638 void SetDefaults(ScopeType type, |
| 629 Scope* outer_scope, | 639 Scope* outer_scope, |
| 630 Handle<ScopeInfo> scope_info); | 640 Handle<ScopeInfo> scope_info); |
| 631 | 641 |
| 632 Zone* zone_; | 642 Zone* zone_; |
| 633 }; | 643 }; |
| 634 | 644 |
| 635 } } // namespace v8::internal | 645 } } // namespace v8::internal |
| 636 | 646 |
| 637 #endif // V8_SCOPES_H_ | 647 #endif // V8_SCOPES_H_ |
| OLD | NEW |