Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2240463002: [Interpreter] Introduce InterpreterCompilationJob (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_peekhole
Patch Set: DISALLOW_COPY_AND_ASSIGN Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 execution_control_(nullptr), 619 execution_control_(nullptr),
620 execution_context_(nullptr), 620 execution_context_(nullptr),
621 execution_result_(nullptr), 621 execution_result_(nullptr),
622 register_allocator_(nullptr), 622 register_allocator_(nullptr),
623 generator_resume_points_(info->literal()->yield_count(), info->zone()), 623 generator_resume_points_(info->literal()->yield_count(), info->zone()),
624 generator_state_(), 624 generator_state_(),
625 loop_depth_(0) { 625 loop_depth_(0) {
626 InitializeAstVisitor(isolate()->stack_guard()->real_climit()); 626 InitializeAstVisitor(isolate()->stack_guard()->real_climit());
627 } 627 }
628 628
629 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() { 629 Handle<BytecodeArray> BytecodeGenerator::FinalizeBytecode() {
630 // Create an inner HandleScope to avoid unnecessarily canonicalizing handles 630 // Create an inner HandleScope to avoid unnecessarily canonicalizing handles
631 // created as part of bytecode finalization. 631 // created as part of bytecode finalization.
632 HandleScope scope(isolate()); 632 HandleScope scope(isolate());
633 633 AllocateDeferredConstants();
634 GenerateBytecode();
635 FinalizeBytecode();
636
637 if (HasStackOverflow()) return Handle<BytecodeArray>(); 634 if (HasStackOverflow()) return Handle<BytecodeArray>();
638
639 return scope.CloseAndEscape(builder()->ToBytecodeArray()); 635 return scope.CloseAndEscape(builder()->ToBytecodeArray());
640 } 636 }
641 637
642 void BytecodeGenerator::FinalizeBytecode() { 638 void BytecodeGenerator::AllocateDeferredConstants() {
643 // Build global declaration pair arrays. 639 // Build global declaration pair arrays.
644 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) { 640 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) {
645 Handle<FixedArray> declarations = 641 Handle<FixedArray> declarations =
646 globals_builder->AllocateDeclarationPairs(info()); 642 globals_builder->AllocateDeclarationPairs(info());
647 if (declarations.is_null()) return SetStackOverflow(); 643 if (declarations.is_null()) return SetStackOverflow();
648 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(), 644 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(),
649 declarations); 645 declarations);
650 } 646 }
651 647
652 // Find or build shared function infos. 648 // Find or build shared function infos.
(...skipping 2624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 return execution_context()->scope()->language_mode(); 3273 return execution_context()->scope()->language_mode();
3278 } 3274 }
3279 3275
3280 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3276 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3281 return TypeFeedbackVector::GetIndex(slot); 3277 return TypeFeedbackVector::GetIndex(slot);
3282 } 3278 }
3283 3279
3284 } // namespace interpreter 3280 } // namespace interpreter
3285 } // namespace internal 3281 } // namespace internal
3286 } // namespace v8 3282 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698