OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-flags.h" | 10 #include "src/interpreter/bytecode-flags.h" |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 native_function_literals_(0, info->zone()), | 676 native_function_literals_(0, info->zone()), |
677 execution_control_(nullptr), | 677 execution_control_(nullptr), |
678 execution_context_(nullptr), | 678 execution_context_(nullptr), |
679 execution_result_(nullptr), | 679 execution_result_(nullptr), |
680 register_allocator_(nullptr), | 680 register_allocator_(nullptr), |
681 generator_resume_points_(info->literal()->yield_count(), info->zone()), | 681 generator_resume_points_(info->literal()->yield_count(), info->zone()), |
682 generator_state_(), | 682 generator_state_(), |
683 loop_depth_(0), | 683 loop_depth_(0), |
684 home_object_symbol_(info->isolate()->factory()->home_object_symbol()), | 684 home_object_symbol_(info->isolate()->factory()->home_object_symbol()), |
685 prototype_string_(info->isolate()->factory()->prototype_string()) { | 685 prototype_string_(info->isolate()->factory()->prototype_string()) { |
686 InitializeAstVisitor(info->isolate()->stack_guard()->real_climit()); | |
687 } | 686 } |
688 | 687 |
689 Handle<BytecodeArray> BytecodeGenerator::FinalizeBytecode(Isolate* isolate) { | 688 Handle<BytecodeArray> BytecodeGenerator::FinalizeBytecode(Isolate* isolate) { |
690 // Create an inner HandleScope to avoid unnecessarily canonicalizing handles | 689 // Create an inner HandleScope to avoid unnecessarily canonicalizing handles |
691 // created as part of bytecode finalization. | 690 // created as part of bytecode finalization. |
692 HandleScope scope(isolate); | 691 HandleScope scope(isolate); |
693 AllocateDeferredConstants(); | 692 AllocateDeferredConstants(); |
694 if (HasStackOverflow()) return Handle<BytecodeArray>(); | 693 if (HasStackOverflow()) return Handle<BytecodeArray>(); |
695 return scope.CloseAndEscape(builder()->ToBytecodeArray(isolate)); | 694 return scope.CloseAndEscape(builder()->ToBytecodeArray(isolate)); |
696 } | 695 } |
(...skipping 22 matching lines...) Expand all Loading... |
719 native_function_literals_) { | 718 native_function_literals_) { |
720 NativeFunctionLiteral* expr = literal.first; | 719 NativeFunctionLiteral* expr = literal.first; |
721 Handle<SharedFunctionInfo> shared_info = | 720 Handle<SharedFunctionInfo> shared_info = |
722 Compiler::GetSharedFunctionInfoForNative(expr->extension(), | 721 Compiler::GetSharedFunctionInfoForNative(expr->extension(), |
723 expr->name()); | 722 expr->name()); |
724 if (shared_info.is_null()) return SetStackOverflow(); | 723 if (shared_info.is_null()) return SetStackOverflow(); |
725 builder()->InsertConstantPoolEntryAt(literal.second, shared_info); | 724 builder()->InsertConstantPoolEntryAt(literal.second, shared_info); |
726 } | 725 } |
727 } | 726 } |
728 | 727 |
729 void BytecodeGenerator::GenerateBytecode() { | 728 void BytecodeGenerator::GenerateBytecode(uintptr_t stack_limit) { |
730 DisallowHeapAllocation no_allocation; | 729 DisallowHeapAllocation no_allocation; |
731 DisallowHandleAllocation no_handles; | 730 DisallowHandleAllocation no_handles; |
732 DisallowHandleDereference no_deref; | 731 DisallowHandleDereference no_deref; |
733 | 732 |
| 733 InitializeAstVisitor(stack_limit); |
| 734 |
734 // Initialize the incoming context. | 735 // Initialize the incoming context. |
735 ContextScope incoming_context(this, scope(), false); | 736 ContextScope incoming_context(this, scope(), false); |
736 | 737 |
737 // Initialize control scope. | 738 // Initialize control scope. |
738 ControlScopeForTopLevel control(this); | 739 ControlScopeForTopLevel control(this); |
739 | 740 |
740 RegisterAllocationScope register_scope(this); | 741 RegisterAllocationScope register_scope(this); |
741 | 742 |
742 if (IsResumableFunction(info()->literal()->kind())) { | 743 if (IsResumableFunction(info()->literal()->kind())) { |
743 generator_state_ = register_allocator()->NewRegister(); | 744 generator_state_ = register_allocator()->NewRegister(); |
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 return execution_context()->scope()->language_mode(); | 3404 return execution_context()->scope()->language_mode(); |
3404 } | 3405 } |
3405 | 3406 |
3406 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3407 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3407 return TypeFeedbackVector::GetIndex(slot); | 3408 return TypeFeedbackVector::GetIndex(slot); |
3408 } | 3409 } |
3409 | 3410 |
3410 } // namespace interpreter | 3411 } // namespace interpreter |
3411 } // namespace internal | 3412 } // namespace internal |
3412 } // namespace v8 | 3413 } // namespace v8 |
OLD | NEW |