| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 // 2) Resolve variables. | 317 // 2) Resolve variables. |
| 318 Scope* global_scope = NULL; | 318 Scope* global_scope = NULL; |
| 319 if (is_global_scope()) global_scope = this; | 319 if (is_global_scope()) global_scope = this; |
| 320 ResolveVariablesRecursively(global_scope); | 320 ResolveVariablesRecursively(global_scope); |
| 321 | 321 |
| 322 // 3) Allocate variables. | 322 // 3) Allocate variables. |
| 323 AllocateVariablesRecursively(); | 323 AllocateVariablesRecursively(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 | 326 |
| 327 bool Scope::SupportsEval() const { | |
| 328 return scope_calls_eval_ || inner_scope_calls_eval_; | |
| 329 } | |
| 330 | |
| 331 | |
| 332 bool Scope::AllowsLazyCompilation() const { | 327 bool Scope::AllowsLazyCompilation() const { |
| 333 return !force_eager_compilation_ && HasTrivialOuterContext(); | 328 return !force_eager_compilation_ && HasTrivialOuterContext(); |
| 334 } | 329 } |
| 335 | 330 |
| 336 | 331 |
| 337 bool Scope::HasTrivialContext() const { | 332 bool Scope::HasTrivialContext() const { |
| 338 // A function scope has a trivial context if it always is the global | 333 // A function scope has a trivial context if it always is the global |
| 339 // context. We iteratively scan out the context chain to see if | 334 // context. We iteratively scan out the context chain to see if |
| 340 // there is anything that makes this scope non-trivial; otherwise we | 335 // there is anything that makes this scope non-trivial; otherwise we |
| 341 // return true. | 336 // return true. |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && | 892 if (num_heap_slots_ == Context::MIN_CONTEXT_SLOTS && |
| 898 !must_have_local_context) { | 893 !must_have_local_context) { |
| 899 num_heap_slots_ = 0; | 894 num_heap_slots_ = 0; |
| 900 } | 895 } |
| 901 | 896 |
| 902 // Allocation done. | 897 // Allocation done. |
| 903 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); | 898 ASSERT(num_heap_slots_ == 0 || num_heap_slots_ >= Context::MIN_CONTEXT_SLOTS); |
| 904 } | 899 } |
| 905 | 900 |
| 906 } } // namespace v8::internal | 901 } } // namespace v8::internal |
| OLD | NEW |