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

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

Issue 2523893003: Reland of [ignition/turbo] Perform liveness analysis on the bytecodes (Closed)
Patch Set: Fix debugger special casing and liveness disabling Created 4 years 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/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 .CompareOperation(Token::Value::EQ_STRICT, index) 715 .CompareOperation(Token::Value::EQ_STRICT, index)
716 .JumpIfTrue(&(targets[i])); 716 .JumpIfTrue(&(targets[i]));
717 } 717 }
718 BuildAbort(BailoutReason::kInvalidJumpTableIndex); 718 BuildAbort(BailoutReason::kInvalidJumpTableIndex);
719 } 719 }
720 720
721 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, 721 void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt,
722 LoopBuilder* loop_builder) { 722 LoopBuilder* loop_builder) {
723 // Recall that stmt->yield_count() is always zero inside ordinary 723 // Recall that stmt->yield_count() is always zero inside ordinary
724 // (i.e. non-generator) functions. 724 // (i.e. non-generator) functions.
725 if (stmt->yield_count() == 0) {
726 loop_builder->LoopHeader();
727 } else {
728 // Collect all labels for generator resume points within the loop (if any)
729 // so
730 // that they can be bound to the loop header below. Also create fresh labels
731 // for these resume points, to be used inside the loop.
732 ZoneVector<BytecodeLabel> resume_points_in_loop(zone());
733 size_t first_yield = stmt->first_yield_id();
734 DCHECK_LE(first_yield + stmt->yield_count(),
735 generator_resume_points_.size());
736 for (size_t id = first_yield; id < first_yield + stmt->yield_count();
737 id++) {
738 auto& label = generator_resume_points_[id];
739 resume_points_in_loop.push_back(label);
740 generator_resume_points_[id] = BytecodeLabel();
741 }
725 742
726 // Collect all labels for generator resume points within the loop (if any) so 743 loop_builder->LoopHeader(&resume_points_in_loop);
rmcilroy 2016/11/28 10:00:31 Why did you need to change this code here?
Leszek Swirski 2016/11/28 11:07:22 Oh, this was a drive-by fix -- I had changed LoopB
727 // that they can be bound to the loop header below. Also create fresh labels
728 // for these resume points, to be used inside the loop.
729 ZoneVector<BytecodeLabel> resume_points_in_loop(zone());
730 size_t first_yield = stmt->first_yield_id();
731 DCHECK_LE(first_yield + stmt->yield_count(), generator_resume_points_.size());
732 for (size_t id = first_yield; id < first_yield + stmt->yield_count(); id++) {
733 auto& label = generator_resume_points_[id];
734 resume_points_in_loop.push_back(label);
735 generator_resume_points_[id] = BytecodeLabel();
736 }
737 744
738 loop_builder->LoopHeader(&resume_points_in_loop);
739
740 if (stmt->yield_count() > 0) {
741 // If we are not resuming, fall through to loop body. 745 // If we are not resuming, fall through to loop body.
742 // If we are resuming, perform state dispatch. 746 // If we are resuming, perform state dispatch.
743 BytecodeLabel not_resuming; 747 BytecodeLabel not_resuming;
744 builder() 748 builder()
745 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)) 749 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
746 .CompareOperation(Token::Value::EQ, generator_state_) 750 .CompareOperation(Token::Value::EQ, generator_state_)
747 .JumpIfTrue(&not_resuming); 751 .JumpIfTrue(&not_resuming);
748 BuildIndexedJump(generator_state_, first_yield, 752 BuildIndexedJump(generator_state_, first_yield,
749 stmt->yield_count(), generator_resume_points_); 753 stmt->yield_count(), generator_resume_points_);
750 builder()->Bind(&not_resuming); 754 builder()->Bind(&not_resuming);
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 } 3200 }
3197 3201
3198 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3202 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3199 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3203 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3200 : Runtime::kStoreKeyedToSuper_Sloppy; 3204 : Runtime::kStoreKeyedToSuper_Sloppy;
3201 } 3205 }
3202 3206
3203 } // namespace interpreter 3207 } // namespace interpreter
3204 } // namespace internal 3208 } // namespace internal
3205 } // namespace v8 3209 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698