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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2428503002: [ignition/turbo] Add liveness analysis for the accumulator (Closed)
Patch Set: Remove unused accumulator state value read in release build Created 4 years, 2 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/ast-graph-builder.cc ('k') | src/compiler/liveness-analyzer.h » ('j') | 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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/bytecode-branch-analysis.h" 10 #include "src/compiler/bytecode-branch-analysis.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 return the_register.index() + register_base(); 252 return the_register.index() + register_base();
253 } 253 }
254 } 254 }
255 255
256 bool BytecodeGraphBuilder::Environment::IsLivenessBlockConsistent() const { 256 bool BytecodeGraphBuilder::Environment::IsLivenessBlockConsistent() const {
257 return !builder_->IsLivenessAnalysisEnabled() == 257 return !builder_->IsLivenessAnalysisEnabled() ==
258 (liveness_block() == nullptr); 258 (liveness_block() == nullptr);
259 } 259 }
260 260
261 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const { 261 Node* BytecodeGraphBuilder::Environment::LookupAccumulator() const {
262 DCHECK(IsLivenessBlockConsistent());
263 if (liveness_block() != nullptr) {
264 liveness_block()->LookupAccumulator();
265 }
262 return values()->at(accumulator_base_); 266 return values()->at(accumulator_base_);
263 } 267 }
264 268
265 269
266 Node* BytecodeGraphBuilder::Environment::LookupRegister( 270 Node* BytecodeGraphBuilder::Environment::LookupRegister(
267 interpreter::Register the_register) const { 271 interpreter::Register the_register) const {
268 if (the_register.is_current_context()) { 272 if (the_register.is_current_context()) {
269 return Context(); 273 return Context();
270 } else if (the_register.is_function_closure()) { 274 } else if (the_register.is_function_closure()) {
271 return builder()->GetFunctionClosure(); 275 return builder()->GetFunctionClosure();
(...skipping 16 matching lines...) Expand all
288 liveness_block()->Lookup(i); 292 liveness_block()->Lookup(i);
289 } 293 }
290 } 294 }
291 } 295 }
292 296
293 void BytecodeGraphBuilder::Environment::BindAccumulator( 297 void BytecodeGraphBuilder::Environment::BindAccumulator(
294 Node* node, FrameStateBeforeAndAfter* states) { 298 Node* node, FrameStateBeforeAndAfter* states) {
295 if (states) { 299 if (states) {
296 states->AddToNode(node, OutputFrameStateCombine::PokeAt(0)); 300 states->AddToNode(node, OutputFrameStateCombine::PokeAt(0));
297 } 301 }
302 DCHECK(IsLivenessBlockConsistent());
303 if (liveness_block() != nullptr) {
304 liveness_block()->BindAccumulator();
305 }
298 values()->at(accumulator_base_) = node; 306 values()->at(accumulator_base_) = node;
299 } 307 }
300 308
301 309
302 void BytecodeGraphBuilder::Environment::BindRegister( 310 void BytecodeGraphBuilder::Environment::BindRegister(
303 interpreter::Register the_register, Node* node, 311 interpreter::Register the_register, Node* node,
304 FrameStateBeforeAndAfter* states) { 312 FrameStateBeforeAndAfter* states) {
305 int values_index = RegisterToValuesIndex(the_register); 313 int values_index = RegisterToValuesIndex(the_register);
306 if (states) { 314 if (states) {
307 states->AddToNode(node, OutputFrameStateCombine::PokeAt(accumulator_base_ - 315 states->AddToNode(node, OutputFrameStateCombine::PokeAt(accumulator_base_ -
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 merge_environments_(local_zone), 613 merge_environments_(local_zone),
606 exception_handlers_(local_zone), 614 exception_handlers_(local_zone),
607 current_exception_handler_(0), 615 current_exception_handler_(0),
608 input_buffer_size_(0), 616 input_buffer_size_(0),
609 input_buffer_(nullptr), 617 input_buffer_(nullptr),
610 exit_controls_(local_zone), 618 exit_controls_(local_zone),
611 is_liveness_analysis_enabled_(FLAG_analyze_environment_liveness && 619 is_liveness_analysis_enabled_(FLAG_analyze_environment_liveness &&
612 info->is_deoptimization_enabled()), 620 info->is_deoptimization_enabled()),
613 state_values_cache_(jsgraph), 621 state_values_cache_(jsgraph),
614 liveness_analyzer_( 622 liveness_analyzer_(
615 static_cast<size_t>(bytecode_array()->register_count()), local_zone), 623 static_cast<size_t>(bytecode_array()->register_count()), true,
624 local_zone),
616 source_positions_(source_positions) {} 625 source_positions_(source_positions) {}
617 626
618 Node* BytecodeGraphBuilder::GetNewTarget() { 627 Node* BytecodeGraphBuilder::GetNewTarget() {
619 if (!new_target_.is_set()) { 628 if (!new_target_.is_set()) {
620 int params = bytecode_array()->parameter_count(); 629 int params = bytecode_array()->parameter_count();
621 int index = Linkage::GetJSCallNewTargetParamIndex(params); 630 int index = Linkage::GetJSCallNewTargetParamIndex(params);
622 const Operator* op = common()->Parameter(index, "%new.target"); 631 const Operator* op = common()->Parameter(index, "%new.target");
623 Node* node = NewNode(op, graph()->start()); 632 Node* node = NewNode(op, graph()->start());
624 new_target_.set(node); 633 new_target_.set(node);
625 } 634 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 700
692 return true; 701 return true;
693 } 702 }
694 703
695 void BytecodeGraphBuilder::ClearNonLiveSlotsInFrameStates() { 704 void BytecodeGraphBuilder::ClearNonLiveSlotsInFrameStates() {
696 if (!IsLivenessAnalysisEnabled()) { 705 if (!IsLivenessAnalysisEnabled()) {
697 return; 706 return;
698 } 707 }
699 NonLiveFrameStateSlotReplacer replacer( 708 NonLiveFrameStateSlotReplacer replacer(
700 &state_values_cache_, jsgraph()->OptimizedOutConstant(), 709 &state_values_cache_, jsgraph()->OptimizedOutConstant(),
701 liveness_analyzer()->local_count(), local_zone()); 710 liveness_analyzer()->local_count(), true, local_zone());
702 liveness_analyzer()->Run(&replacer); 711 liveness_analyzer()->Run(&replacer);
703 if (FLAG_trace_environment_liveness) { 712 if (FLAG_trace_environment_liveness) {
704 OFStream os(stdout); 713 OFStream os(stdout);
705 liveness_analyzer()->Print(os); 714 liveness_analyzer()->Print(os);
706 } 715 }
707 } 716 }
708 717
709 void BytecodeGraphBuilder::VisitBytecodes() { 718 void BytecodeGraphBuilder::VisitBytecodes() {
710 BytecodeBranchAnalysis analysis(bytecode_array(), local_zone()); 719 BytecodeBranchAnalysis analysis(bytecode_array(), local_zone());
711 BytecodeLoopAnalysis loop_analysis(bytecode_array(), &analysis, local_zone()); 720 BytecodeLoopAnalysis loop_analysis(bytecode_array(), &analysis, local_zone());
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 source_positions_->set_current_position(it->source_position()); 2281 source_positions_->set_current_position(it->source_position());
2273 it->Advance(); 2282 it->Advance();
2274 } else { 2283 } else {
2275 DCHECK_GT(it->code_offset(), offset); 2284 DCHECK_GT(it->code_offset(), offset);
2276 } 2285 }
2277 } 2286 }
2278 2287
2279 } // namespace compiler 2288 } // namespace compiler
2280 } // namespace internal 2289 } // namespace internal
2281 } // namespace v8 2290 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/liveness-analyzer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698