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

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

Issue 1186033006: [turbofan] Introduce DeadValue and DeadEffect operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 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 | « src/compiler/ast-graph-builder.h ('k') | src/compiler/common-operator.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 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/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 : builder_->environment()->Checkpoint(id_before); 396 : builder_->environment()->Checkpoint(id_before);
397 } 397 }
398 398
399 void AddToNode(Node* node, BailoutId id_after, 399 void AddToNode(Node* node, BailoutId id_after,
400 OutputFrameStateCombine combine) { 400 OutputFrameStateCombine combine) {
401 int count = OperatorProperties::GetFrameStateInputCount(node->op()); 401 int count = OperatorProperties::GetFrameStateInputCount(node->op());
402 DCHECK_LE(count, 2); 402 DCHECK_LE(count, 2);
403 403
404 if (count >= 1) { 404 if (count >= 1) {
405 // Add the frame state for after the operation. 405 // Add the frame state for after the operation.
406 DCHECK_EQ(IrOpcode::kDead, 406 DCHECK_EQ(IrOpcode::kDeadValue,
407 NodeProperties::GetFrameStateInput(node, 0)->opcode()); 407 NodeProperties::GetFrameStateInput(node, 0)->opcode());
408 408
409 Node* frame_state_after = 409 Node* frame_state_after =
410 id_after == BailoutId::None() 410 id_after == BailoutId::None()
411 ? builder_->jsgraph()->EmptyFrameState() 411 ? builder_->jsgraph()->EmptyFrameState()
412 : builder_->environment()->Checkpoint(id_after, combine); 412 : builder_->environment()->Checkpoint(id_after, combine);
413 413
414 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after); 414 NodeProperties::ReplaceFrameStateInput(node, 0, frame_state_after);
415 } 415 }
416 416
417 if (count >= 2) { 417 if (count >= 2) {
418 // Add the frame state for before the operation. 418 // Add the frame state for before the operation.
419 DCHECK_EQ(IrOpcode::kDead, 419 DCHECK_EQ(IrOpcode::kDeadValue,
420 NodeProperties::GetFrameStateInput(node, 1)->opcode()); 420 NodeProperties::GetFrameStateInput(node, 1)->opcode());
421 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_); 421 NodeProperties::ReplaceFrameStateInput(node, 1, frame_state_before_);
422 } 422 }
423 } 423 }
424 424
425 private: 425 private:
426 AstGraphBuilder* builder_; 426 AstGraphBuilder* builder_;
427 Node* frame_state_before_; 427 Node* frame_state_before_;
428 }; 428 };
429 429
(...skipping 3322 matching lines...) Expand 10 before | Expand all | Expand 10 after
3752 return true; 3752 return true;
3753 } 3753 }
3754 return false; 3754 return false;
3755 } 3755 }
3756 3756
3757 3757
3758 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, 3758 void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id,
3759 OutputFrameStateCombine combine) { 3759 OutputFrameStateCombine combine) {
3760 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) { 3760 if (OperatorProperties::GetFrameStateInputCount(node->op()) > 0) {
3761 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); 3761 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
3762 3762 DCHECK_EQ(IrOpcode::kDeadValue,
3763 DCHECK_EQ(IrOpcode::kDead,
3764 NodeProperties::GetFrameStateInput(node, 0)->opcode()); 3763 NodeProperties::GetFrameStateInput(node, 0)->opcode());
3765 NodeProperties::ReplaceFrameStateInput( 3764 NodeProperties::ReplaceFrameStateInput(
3766 node, 0, environment()->Checkpoint(ast_id, combine)); 3765 node, 0, environment()->Checkpoint(ast_id, combine));
3767 } 3766 }
3768 } 3767 }
3769 3768
3770 3769
3771 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( 3770 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
3772 IterationStatement* stmt) { 3771 IterationStatement* stmt) {
3773 if (loop_assignment_analysis_ == NULL) return NULL; 3772 if (loop_assignment_analysis_ == NULL) return NULL;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3808 if (has_control) ++input_count_with_deps; 3807 if (has_control) ++input_count_with_deps;
3809 if (has_effect) ++input_count_with_deps; 3808 if (has_effect) ++input_count_with_deps;
3810 Node** buffer = EnsureInputBufferSize(input_count_with_deps); 3809 Node** buffer = EnsureInputBufferSize(input_count_with_deps);
3811 memcpy(buffer, value_inputs, kPointerSize * value_input_count); 3810 memcpy(buffer, value_inputs, kPointerSize * value_input_count);
3812 Node** current_input = buffer + value_input_count; 3811 Node** current_input = buffer + value_input_count;
3813 if (has_context) { 3812 if (has_context) {
3814 *current_input++ = current_context(); 3813 *current_input++ = current_context();
3815 } 3814 }
3816 for (int i = 0; i < frame_state_count; i++) { 3815 for (int i = 0; i < frame_state_count; i++) {
3817 // The frame state will be inserted later. Here we misuse 3816 // The frame state will be inserted later. Here we misuse
3818 // the {DeadControl} node as a sentinel to be later overwritten 3817 // the {DeadValue} node as a sentinel to be later overwritten
3819 // with the real frame state. 3818 // with the real frame state.
3820 *current_input++ = jsgraph()->DeadControl(); 3819 *current_input++ = jsgraph()->DeadValue();
3821 } 3820 }
3822 if (has_effect) { 3821 if (has_effect) {
3823 *current_input++ = environment_->GetEffectDependency(); 3822 *current_input++ = environment_->GetEffectDependency();
3824 } 3823 }
3825 if (has_control) { 3824 if (has_control) {
3826 *current_input++ = environment_->GetControlDependency(); 3825 *current_input++ = environment_->GetControlDependency();
3827 } 3826 }
3828 result = graph()->NewNode(op, input_count_with_deps, buffer, incomplete); 3827 result = graph()->NewNode(op, input_count_with_deps, buffer, incomplete);
3829 if (!environment()->IsMarkedAsUnreachable()) { 3828 if (!environment()->IsMarkedAsUnreachable()) {
3830 // Update the current control dependency for control-producing nodes. 3829 // Update the current control dependency for control-producing nodes.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 // Phi does not exist yet, introduce one. 4076 // Phi does not exist yet, introduce one.
4078 value = NewPhi(inputs, value, control); 4077 value = NewPhi(inputs, value, control);
4079 value->ReplaceInput(inputs - 1, other); 4078 value->ReplaceInput(inputs - 1, other);
4080 } 4079 }
4081 return value; 4080 return value;
4082 } 4081 }
4083 4082
4084 } // namespace compiler 4083 } // namespace compiler
4085 } // namespace internal 4084 } // namespace internal
4086 } // namespace v8 4085 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698