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