OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 | 303 |
304 is_declaration_scope_ = false; | 304 is_declaration_scope_ = false; |
305 } | 305 } |
306 | 306 |
307 bool Scope::HasSimpleParameters() { | 307 bool Scope::HasSimpleParameters() { |
308 DeclarationScope* scope = GetClosureScope(); | 308 DeclarationScope* scope = GetClosureScope(); |
309 return !scope->is_function_scope() || scope->has_simple_parameters(); | 309 return !scope->is_function_scope() || scope->has_simple_parameters(); |
310 } | 310 } |
311 | 311 |
312 bool DeclarationScope::ShouldEagerCompile() const { | 312 bool DeclarationScope::ShouldEagerCompile() const { |
313 if (!AllowsLazyCompilation()) return true; | 313 return force_eager_compilation_ || should_eager_compile_; |
314 return !is_lazily_parsed_ && should_eager_compile_; | |
315 } | 314 } |
316 | 315 |
317 void DeclarationScope::set_should_eager_compile() { | 316 void DeclarationScope::set_should_eager_compile() { |
318 should_eager_compile_ = true; | 317 should_eager_compile_ = !is_lazily_parsed_; |
jochen (gone - plz use gerrit)
2016/10/17 11:23:37
when is is_lazily_parsed_ true here?
Toon Verwaest
2016/10/17 11:28:35
If we preparsed the function for example. E.g.,:
| |
319 } | 318 } |
320 | 319 |
321 void DeclarationScope::set_asm_module() { | 320 void DeclarationScope::set_asm_module() { |
322 asm_module_ = true; | 321 asm_module_ = true; |
323 // Mark any existing inner function scopes as asm function scopes. | 322 // Mark any existing inner function scopes as asm function scopes. |
324 for (Scope* inner = inner_scope_; inner != nullptr; inner = inner->sibling_) { | 323 for (Scope* inner = inner_scope_; inner != nullptr; inner = inner->sibling_) { |
325 if (inner->is_function_scope()) { | 324 if (inner->is_function_scope()) { |
326 inner->AsDeclarationScope()->set_asm_function(); | 325 inner->AsDeclarationScope()->set_asm_function(); |
327 } | 326 } |
328 } | 327 } |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1969 Variable* function = | 1968 Variable* function = |
1970 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 1969 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
1971 bool is_function_var_in_context = | 1970 bool is_function_var_in_context = |
1972 function != nullptr && function->IsContextSlot(); | 1971 function != nullptr && function->IsContextSlot(); |
1973 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1972 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1974 (is_function_var_in_context ? 1 : 0); | 1973 (is_function_var_in_context ? 1 : 0); |
1975 } | 1974 } |
1976 | 1975 |
1977 } // namespace internal | 1976 } // namespace internal |
1978 } // namespace v8 | 1977 } // namespace v8 |
OLD | NEW |