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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 DCHECK(ThreadId::Current().Equals(info->isolate()->thread_id())); | 558 DCHECK(ThreadId::Current().Equals(info->isolate()->thread_id())); |
559 // TODO(wingo): Add an outer SCRIPT_SCOPE corresponding to the native | 559 // TODO(wingo): Add an outer SCRIPT_SCOPE corresponding to the native |
560 // context, which will have the "this" binding for script scopes. | 560 // context, which will have the "this" binding for script scopes. |
561 DeclarationScope* script_scope = NewScriptScope(); | 561 DeclarationScope* script_scope = NewScriptScope(); |
562 info->set_script_scope(script_scope); | 562 info->set_script_scope(script_scope); |
563 Scope* scope = script_scope; | 563 Scope* scope = script_scope; |
564 if (!context.is_null() && !context->IsNativeContext()) { | 564 if (!context.is_null() && !context->IsNativeContext()) { |
565 scope = Scope::DeserializeScopeChain(info->isolate(), zone(), *context, | 565 scope = Scope::DeserializeScopeChain(info->isolate(), zone(), *context, |
566 script_scope, ast_value_factory(), | 566 script_scope, ast_value_factory(), |
567 deserialization_mode); | 567 deserialization_mode); |
| 568 DCHECK(!info->is_module() || scope->is_module_scope()); |
568 if (info->context().is_null()) { | 569 if (info->context().is_null()) { |
569 DCHECK(deserialization_mode == | 570 DCHECK(deserialization_mode == |
570 Scope::DeserializationMode::kDeserializeOffHeap); | 571 Scope::DeserializationMode::kDeserializeOffHeap); |
571 } else { | 572 } else { |
572 // The Scope is backed up by ScopeInfo (which is in the V8 heap); this | 573 // The Scope is backed up by ScopeInfo (which is in the V8 heap); this |
573 // means the Parser cannot operate independent of the V8 heap. Tell the | 574 // means the Parser cannot operate independent of the V8 heap. Tell the |
574 // string table to internalize strings and values right after they're | 575 // string table to internalize strings and values right after they're |
575 // created. This kind of parsing can only be done in the main thread. | 576 // created. This kind of parsing can only be done in the main thread. |
576 DCHECK(parsing_on_main_thread_); | 577 DCHECK(parsing_on_main_thread_); |
577 ast_value_factory()->Internalize(info->isolate()); | 578 ast_value_factory()->Internalize(info->isolate()); |
(...skipping 6070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6648 node->Print(Isolate::Current()); | 6649 node->Print(Isolate::Current()); |
6649 } | 6650 } |
6650 #endif // DEBUG | 6651 #endif // DEBUG |
6651 | 6652 |
6652 #undef CHECK_OK | 6653 #undef CHECK_OK |
6653 #undef CHECK_OK_VOID | 6654 #undef CHECK_OK_VOID |
6654 #undef CHECK_FAILED | 6655 #undef CHECK_FAILED |
6655 | 6656 |
6656 } // namespace internal | 6657 } // namespace internal |
6657 } // namespace v8 | 6658 } // namespace v8 |
OLD | NEW |