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

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

Issue 2226923002: [Interpereter] Avoid Canonicalizing Handles created during bytecode finalization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@clusterfuzz_stackoverflow
Patch Set: Rebase 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
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::MakeBytecode() {
630 // Create an inner HandleScope to avoid unnecessarily canonicalizing handles
631 // created as part of bytecode finalization.
632 HandleScope scope(isolate());
633
630 GenerateBytecode(); 634 GenerateBytecode();
631 FinalizeBytecode(); 635 FinalizeBytecode();
632 636
633 if (HasStackOverflow()) return Handle<BytecodeArray>(); 637 if (HasStackOverflow()) return Handle<BytecodeArray>();
634 638
635 return builder()->ToBytecodeArray(); 639 return scope.CloseAndEscape(builder()->ToBytecodeArray());
636 } 640 }
637 641
638 void BytecodeGenerator::FinalizeBytecode() { 642 void BytecodeGenerator::FinalizeBytecode() {
639 // Build global declaration pair arrays. 643 // Build global declaration pair arrays.
640 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) { 644 for (GlobalDeclarationsBuilder* globals_builder : global_declarations_) {
641 Handle<FixedArray> declarations = 645 Handle<FixedArray> declarations =
642 globals_builder->AllocateDeclarationPairs(info()); 646 globals_builder->AllocateDeclarationPairs(info());
643 if (declarations.is_null()) return SetStackOverflow(); 647 if (declarations.is_null()) return SetStackOverflow();
644 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(), 648 builder()->InsertConstantPoolEntryAt(globals_builder->constant_pool_entry(),
645 declarations); 649 declarations);
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after
3298 return execution_context()->scope()->language_mode(); 3302 return execution_context()->scope()->language_mode();
3299 } 3303 }
3300 3304
3301 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3305 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3302 return TypeFeedbackVector::GetIndex(slot); 3306 return TypeFeedbackVector::GetIndex(slot);
3303 } 3307 }
3304 3308
3305 } // namespace interpreter 3309 } // namespace interpreter
3306 } // namespace internal 3310 } // namespace internal
3307 } // namespace v8 3311 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698