| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } | 211 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } |
| 212 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } | 212 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } |
| 213 bool is_strict_mode() const { return strict_mode_; } | 213 bool is_strict_mode() const { return strict_mode_; } |
| 214 bool is_strict_mode_eval_scope() const { | 214 bool is_strict_mode_eval_scope() const { |
| 215 return is_eval_scope() && is_strict_mode(); | 215 return is_eval_scope() && is_strict_mode(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Information about which scopes calls eval. | 218 // Information about which scopes calls eval. |
| 219 bool calls_eval() const { return scope_calls_eval_; } | 219 bool calls_eval() const { return scope_calls_eval_; } |
| 220 bool outer_scope_calls_eval() const { return outer_scope_calls_eval_; } | 220 bool outer_scope_calls_eval() const { return outer_scope_calls_eval_; } |
| 221 bool outer_scope_calls_non_strict_eval() const { |
| 222 return outer_scope_calls_non_strict_eval_; |
| 223 } |
| 221 | 224 |
| 222 // Is this scope inside a with statement. | 225 // Is this scope inside a with statement. |
| 223 bool inside_with() const { return scope_inside_with_; } | 226 bool inside_with() const { return scope_inside_with_; } |
| 224 // Does this scope contain a with statement. | 227 // Does this scope contain a with statement. |
| 225 bool contains_with() const { return scope_contains_with_; } | 228 bool contains_with() const { return scope_contains_with_; } |
| 226 | 229 |
| 227 // The scope immediately surrounding this scope, or NULL. | 230 // The scope immediately surrounding this scope, or NULL. |
| 228 Scope* outer_scope() const { return outer_scope_; } | 231 Scope* outer_scope() const { return outer_scope_; } |
| 229 | 232 |
| 230 // --------------------------------------------------------------------------- | 233 // --------------------------------------------------------------------------- |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 Expression* illegal_redecl_; | 368 Expression* illegal_redecl_; |
| 366 | 369 |
| 367 // Scope-specific information. | 370 // Scope-specific information. |
| 368 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope | 371 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope |
| 369 bool scope_contains_with_; // this scope contains a 'with' statement | 372 bool scope_contains_with_; // this scope contains a 'with' statement |
| 370 bool scope_calls_eval_; // this scope contains an 'eval' call | 373 bool scope_calls_eval_; // this scope contains an 'eval' call |
| 371 bool strict_mode_; // this scope is a strict mode scope | 374 bool strict_mode_; // this scope is a strict mode scope |
| 372 | 375 |
| 373 // Computed via PropagateScopeInfo. | 376 // Computed via PropagateScopeInfo. |
| 374 bool outer_scope_calls_eval_; | 377 bool outer_scope_calls_eval_; |
| 378 bool outer_scope_calls_non_strict_eval_; |
| 375 bool inner_scope_calls_eval_; | 379 bool inner_scope_calls_eval_; |
| 376 bool outer_scope_is_eval_scope_; | 380 bool outer_scope_is_eval_scope_; |
| 377 bool force_eager_compilation_; | 381 bool force_eager_compilation_; |
| 378 | 382 |
| 379 // Computed via AllocateVariables; function scopes only. | 383 // Computed via AllocateVariables; function scopes only. |
| 380 int num_stack_slots_; | 384 int num_stack_slots_; |
| 381 int num_heap_slots_; | 385 int num_heap_slots_; |
| 382 | 386 |
| 383 // Serialized scopes support. | 387 // Serialized scopes support. |
| 384 Handle<SerializedScopeInfo> scope_info_; | 388 Handle<SerializedScopeInfo> scope_info_; |
| 385 bool resolved() { return !scope_info_.is_null(); } | 389 bool resolved() { return !scope_info_.is_null(); } |
| 386 | 390 |
| 387 // Create a non-local variable with a given name. | 391 // Create a non-local variable with a given name. |
| 388 // These variables are looked up dynamically at runtime. | 392 // These variables are looked up dynamically at runtime. |
| 389 Variable* NonLocal(Handle<String> name, Variable::Mode mode); | 393 Variable* NonLocal(Handle<String> name, Variable::Mode mode); |
| 390 | 394 |
| 391 // Variable resolution. | 395 // Variable resolution. |
| 392 Variable* LookupRecursive(Handle<String> name, | 396 Variable* LookupRecursive(Handle<String> name, |
| 393 bool inner_lookup, | 397 bool inner_lookup, |
| 394 Variable** invalidated_local); | 398 Variable** invalidated_local); |
| 395 void ResolveVariable(Scope* global_scope, | 399 void ResolveVariable(Scope* global_scope, |
| 396 Handle<Context> context, | 400 Handle<Context> context, |
| 397 VariableProxy* proxy); | 401 VariableProxy* proxy); |
| 398 void ResolveVariablesRecursively(Scope* global_scope, | 402 void ResolveVariablesRecursively(Scope* global_scope, |
| 399 Handle<Context> context); | 403 Handle<Context> context); |
| 400 | 404 |
| 401 // Scope analysis. | 405 // Scope analysis. |
| 402 bool PropagateScopeInfo(bool outer_scope_calls_eval, | 406 bool PropagateScopeInfo(bool outer_scope_calls_eval, |
| 407 bool outer_scope_calls_non_strict_eval, |
| 403 bool outer_scope_is_eval_scope); | 408 bool outer_scope_is_eval_scope); |
| 404 bool HasTrivialContext() const; | 409 bool HasTrivialContext() const; |
| 405 | 410 |
| 406 // Predicates. | 411 // Predicates. |
| 407 bool MustAllocate(Variable* var); | 412 bool MustAllocate(Variable* var); |
| 408 bool MustAllocateInContext(Variable* var); | 413 bool MustAllocateInContext(Variable* var); |
| 409 bool HasArgumentsParameter(); | 414 bool HasArgumentsParameter(); |
| 410 | 415 |
| 411 // Variable allocation. | 416 // Variable allocation. |
| 412 void AllocateStackSlot(Variable* var); | 417 void AllocateStackSlot(Variable* var); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 int nesting_level_; | 485 int nesting_level_; |
| 481 // Nesting level of outermost scope that is contained in a with statement, | 486 // Nesting level of outermost scope that is contained in a with statement, |
| 482 // or kNotInsideWith if there are no with's around the current scope. | 487 // or kNotInsideWith if there are no with's around the current scope. |
| 483 int inside_with_level_; | 488 int inside_with_level_; |
| 484 }; | 489 }; |
| 485 | 490 |
| 486 | 491 |
| 487 } } // namespace v8::internal | 492 } } // namespace v8::internal |
| 488 | 493 |
| 489 #endif // V8_SCOPES_H_ | 494 #endif // V8_SCOPES_H_ |
| OLD | NEW |