| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively | 295 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively |
| 296 #endif | 296 #endif |
| 297 | 297 |
| 298 // --------------------------------------------------------------------------- | 298 // --------------------------------------------------------------------------- |
| 299 // Implementation. | 299 // Implementation. |
| 300 protected: | 300 protected: |
| 301 friend class ParserFactory; | 301 friend class ParserFactory; |
| 302 | 302 |
| 303 explicit Scope(Type type); | 303 explicit Scope(Type type); |
| 304 | 304 |
| 305 void InsertAfterScope(Scope* scope) { |
| 306 inner_scopes_.Add(scope); |
| 307 outer_scope_ = scope->outer_scope_; |
| 308 outer_scope_->inner_scopes_.RemoveElement(scope); |
| 309 outer_scope_->inner_scopes_.Add(this); |
| 310 scope->outer_scope_ = this; |
| 311 } |
| 312 |
| 305 // Scope tree. | 313 // Scope tree. |
| 306 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL | 314 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL |
| 307 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes | 315 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes |
| 308 | 316 |
| 309 // The scope type. | 317 // The scope type. |
| 310 Type type_; | 318 Type type_; |
| 311 | 319 |
| 312 // Debugging support. | 320 // Debugging support. |
| 313 Handle<String> scope_name_; | 321 Handle<String> scope_name_; |
| 314 | 322 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Computed via PropagateScopeInfo. | 356 // Computed via PropagateScopeInfo. |
| 349 bool outer_scope_calls_eval_; | 357 bool outer_scope_calls_eval_; |
| 350 bool inner_scope_calls_eval_; | 358 bool inner_scope_calls_eval_; |
| 351 bool outer_scope_is_eval_scope_; | 359 bool outer_scope_is_eval_scope_; |
| 352 bool force_eager_compilation_; | 360 bool force_eager_compilation_; |
| 353 | 361 |
| 354 // Computed via AllocateVariables; function scopes only. | 362 // Computed via AllocateVariables; function scopes only. |
| 355 int num_stack_slots_; | 363 int num_stack_slots_; |
| 356 int num_heap_slots_; | 364 int num_heap_slots_; |
| 357 | 365 |
| 366 // Serialized scopes support. |
| 367 bool resolved_; |
| 368 void MarkAsResolved() { resolved_ = true; } |
| 369 |
| 358 // Create a non-local variable with a given name. | 370 // Create a non-local variable with a given name. |
| 359 // These variables are looked up dynamically at runtime. | 371 // These variables are looked up dynamically at runtime. |
| 360 Variable* NonLocal(Handle<String> name, Variable::Mode mode); | 372 Variable* NonLocal(Handle<String> name, Variable::Mode mode); |
| 361 | 373 |
| 362 // Variable resolution. | 374 // Variable resolution. |
| 363 Variable* LookupRecursive(Handle<String> name, | 375 Variable* LookupRecursive(Handle<String> name, |
| 364 bool inner_lookup, | 376 bool inner_lookup, |
| 365 Variable** invalidated_local); | 377 Variable** invalidated_local); |
| 366 void ResolveVariable(Scope* global_scope, | 378 void ResolveVariable(Scope* global_scope, |
| 367 Handle<Context> context, | 379 Handle<Context> context, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 int nesting_level_; | 447 int nesting_level_; |
| 436 // Nesting level of outermost scope that is contained in a with statement, | 448 // Nesting level of outermost scope that is contained in a with statement, |
| 437 // or kNotInsideWith if there are no with's around the current scope. | 449 // or kNotInsideWith if there are no with's around the current scope. |
| 438 int inside_with_level_; | 450 int inside_with_level_; |
| 439 }; | 451 }; |
| 440 | 452 |
| 441 | 453 |
| 442 } } // namespace v8::internal | 454 } } // namespace v8::internal |
| 443 | 455 |
| 444 #endif // V8_SCOPES_H_ | 456 #endif // V8_SCOPES_H_ |
| OLD | NEW |