Chromium Code Reviews| 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 "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/ast/scopeinfo.h" | 8 #include "src/ast/scopeinfo.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 current_scope = with_scope; | 220 current_scope = with_scope; |
| 221 // All the inner scopes are inside a with. | 221 // All the inner scopes are inside a with. |
| 222 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) { | 222 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) { |
| 223 s->scope_inside_with_ = true; | 223 s->scope_inside_with_ = true; |
| 224 } | 224 } |
| 225 } else if (context->IsScriptContext()) { | 225 } else if (context->IsScriptContext()) { |
| 226 ScopeInfo* scope_info = context->scope_info(); | 226 ScopeInfo* scope_info = context->scope_info(); |
| 227 current_scope = new (zone) Scope(zone, current_scope, SCRIPT_SCOPE, | 227 current_scope = new (zone) Scope(zone, current_scope, SCRIPT_SCOPE, |
| 228 Handle<ScopeInfo>(scope_info), | 228 Handle<ScopeInfo>(scope_info), |
| 229 script_scope->ast_value_factory_); | 229 script_scope->ast_value_factory_); |
| 230 } else if (context->IsModuleContext()) { | |
|
adamk
2016/06/21 17:04:07
Is this really dead yet? It appears that ModuleCon
| |
| 231 ScopeInfo* scope_info = context->module()->scope_info(); | |
| 232 current_scope = new (zone) Scope(zone, current_scope, MODULE_SCOPE, | |
| 233 Handle<ScopeInfo>(scope_info), | |
| 234 script_scope->ast_value_factory_); | |
| 235 } else if (context->IsFunctionContext()) { | 230 } else if (context->IsFunctionContext()) { |
| 236 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); | 231 ScopeInfo* scope_info = context->closure()->shared()->scope_info(); |
| 237 current_scope = new (zone) Scope(zone, current_scope, FUNCTION_SCOPE, | 232 current_scope = new (zone) Scope(zone, current_scope, FUNCTION_SCOPE, |
| 238 Handle<ScopeInfo>(scope_info), | 233 Handle<ScopeInfo>(scope_info), |
| 239 script_scope->ast_value_factory_); | 234 script_scope->ast_value_factory_); |
| 240 if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true; | 235 if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true; |
| 241 if (scope_info->IsAsmModule()) current_scope->asm_module_ = true; | 236 if (scope_info->IsAsmModule()) current_scope->asm_module_ = true; |
| 242 } else if (context->IsBlockContext()) { | 237 } else if (context->IsBlockContext()) { |
| 243 ScopeInfo* scope_info = context->scope_info(); | 238 ScopeInfo* scope_info = context->scope_info(); |
| 244 current_scope = new (zone) | 239 current_scope = new (zone) |
| (...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1529 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1524 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
| 1530 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1525 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
| 1531 (is_function_var_in_context ? 1 : 0); | 1526 (is_function_var_in_context ? 1 : 0); |
| 1532 } | 1527 } |
| 1533 | 1528 |
| 1534 | 1529 |
| 1535 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1530 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
| 1536 | 1531 |
| 1537 } // namespace internal | 1532 } // namespace internal |
| 1538 } // namespace v8 | 1533 } // namespace v8 |
| OLD | NEW |