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

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

Issue 2018403002: [turbofan] Emit explicit checkpoint before operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 6 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 | « no previous file | src/compiler/bytecode-graph-builder.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 411
412 412
413 // Helper for generating before and after frame states. 413 // Helper for generating before and after frame states.
414 class AstGraphBuilder::FrameStateBeforeAndAfter { 414 class AstGraphBuilder::FrameStateBeforeAndAfter {
415 public: 415 public:
416 FrameStateBeforeAndAfter(AstGraphBuilder* builder, BailoutId id_before) 416 FrameStateBeforeAndAfter(AstGraphBuilder* builder, BailoutId id_before)
417 : builder_(builder), frame_state_before_(nullptr) { 417 : builder_(builder), frame_state_before_(nullptr) {
418 frame_state_before_ = id_before == BailoutId::None() 418 frame_state_before_ = id_before == BailoutId::None()
419 ? builder_->GetEmptyFrameState() 419 ? builder_->GetEmptyFrameState()
420 : builder_->environment()->Checkpoint(id_before); 420 : builder_->environment()->Checkpoint(id_before);
421 // Create an explicit checkpoint node for before the operation.
422 Node* node = builder_->NewNode(builder_->common()->Checkpoint());
423 DCHECK_EQ(IrOpcode::kDead,
424 NodeProperties::GetFrameStateInput(node, 0)->opcode());
425 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_before_);
421 } 426 }
422 427
423 void AddToNode( 428 void AddToNode(
424 Node* node, BailoutId id_after, 429 Node* node, BailoutId id_after,
425 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()) { 430 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()) {
426 int count = OperatorProperties::GetFrameStateInputCount(node->op()); 431 int count = OperatorProperties::GetFrameStateInputCount(node->op());
427 DCHECK_LE(count, 2); 432 DCHECK_LE(count, 2);
428 433
429 if (count >= 1) { 434 if (count >= 1) {
430 // Add the frame state for after the operation. 435 // Add the frame state for after the operation.
431 DCHECK_EQ(IrOpcode::kDead, 436 DCHECK_EQ(IrOpcode::kDead,
432 NodeProperties::GetFrameStateInput(node, 0)->opcode()); 437 NodeProperties::GetFrameStateInput(node, 0)->opcode());
433 438
434 bool node_has_exception = NodeProperties::IsExceptionalCall(node); 439 bool node_has_exception = NodeProperties::IsExceptionalCall(node);
435 440
436 Node* frame_state_after = 441 Node* frame_state_after =
437 id_after == BailoutId::None() 442 id_after == BailoutId::None()
438 ? builder_->GetEmptyFrameState() 443 ? builder_->GetEmptyFrameState()
439 : builder_->environment()->Checkpoint(id_after, combine, 444 : builder_->environment()->Checkpoint(id_after, combine,
440 node_has_exception); 445 node_has_exception);
441 446
442 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after); 447 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after);
443 } 448 }
444 449
445 if (count >= 2) { 450 if (count >= 2) {
446 // Add the frame state for before the operation. 451 // Add the frame state for before the operation.
452 // TODO(mstarzinger): Get rid of frame state input before!
447 DCHECK_EQ(IrOpcode::kDead, 453 DCHECK_EQ(IrOpcode::kDead,
448 NodeProperties::GetFrameStateInput(node, 1)->opcode()); 454 NodeProperties::GetFrameStateInput(node, 1)->opcode());
449 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_); 455 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
450 } 456 }
451 } 457 }
452 458
453 private: 459 private:
454 AstGraphBuilder* builder_; 460 AstGraphBuilder* builder_;
455 Node* frame_state_before_; 461 Node* frame_state_before_;
456 }; 462 };
(...skipping 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 // Phi does not exist yet, introduce one. 4376 // Phi does not exist yet, introduce one.
4371 value = NewPhi(inputs, value, control); 4377 value = NewPhi(inputs, value, control);
4372 value->ReplaceInput(inputs - 1, other); 4378 value->ReplaceInput(inputs - 1, other);
4373 } 4379 }
4374 return value; 4380 return value;
4375 } 4381 }
4376 4382
4377 } // namespace compiler 4383 } // namespace compiler
4378 } // namespace internal 4384 } // namespace internal
4379 } // namespace v8 4385 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698