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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 Token::ASSIGN, NewUnresolved(factory, name), | 532 Token::ASSIGN, NewUnresolved(factory, name), |
533 delegate->scope()->NewUnresolved(factory, name), kNoSourcePosition); | 533 delegate->scope()->NewUnresolved(factory, name), kNoSourcePosition); |
534 Statement* statement = | 534 Statement* statement = |
535 factory->NewExpressionStatement(assignment, kNoSourcePosition); | 535 factory->NewExpressionStatement(assignment, kNoSourcePosition); |
536 delegate->set_statement(statement); | 536 delegate->set_statement(statement); |
537 } | 537 } |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) { | 541 void DeclarationScope::Analyze(ParseInfo* info, AnalyzeMode mode) { |
| 542 RuntimeCallTimerScope runtimeTimer(info->isolate(), |
| 543 &RuntimeCallStats::CompileScopeAnalysis); |
542 DCHECK(info->literal() != NULL); | 544 DCHECK(info->literal() != NULL); |
543 DeclarationScope* scope = info->literal()->scope(); | 545 DeclarationScope* scope = info->literal()->scope(); |
544 | 546 |
545 Handle<ScopeInfo> outer_scope_info; | 547 Handle<ScopeInfo> outer_scope_info; |
546 if (info->maybe_outer_scope_info().ToHandle(&outer_scope_info)) { | 548 if (info->maybe_outer_scope_info().ToHandle(&outer_scope_info)) { |
547 if (scope->outer_scope()) { | 549 if (scope->outer_scope()) { |
548 DeclarationScope* script_scope = new (info->zone()) | 550 DeclarationScope* script_scope = new (info->zone()) |
549 DeclarationScope(info->zone(), info->ast_value_factory()); | 551 DeclarationScope(info->zone(), info->ast_value_factory()); |
550 info->set_script_scope(script_scope); | 552 info->set_script_scope(script_scope); |
551 scope->ReplaceOuterScope(Scope::DeserializeScopeChain( | 553 scope->ReplaceOuterScope(Scope::DeserializeScopeChain( |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2129 Variable* function = | 2131 Variable* function = |
2130 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; | 2132 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; |
2131 bool is_function_var_in_context = | 2133 bool is_function_var_in_context = |
2132 function != nullptr && function->IsContextSlot(); | 2134 function != nullptr && function->IsContextSlot(); |
2133 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 2135 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
2134 (is_function_var_in_context ? 1 : 0); | 2136 (is_function_var_in_context ? 1 : 0); |
2135 } | 2137 } |
2136 | 2138 |
2137 } // namespace internal | 2139 } // namespace internal |
2138 } // namespace v8 | 2140 } // namespace v8 |
OLD | NEW |