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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 12316065: Set instruction/use_index when adding an input to an IL instruction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 2b102112bf6acce75a48ffa2c7486e3c16396bef..8bae9ce44cf4b3ef6216025a1f24611b805cdcc2 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -70,13 +70,12 @@ CheckClassInstr::CheckClassInstr(Value* value,
intptr_t deopt_id,
const ICData& unary_checks)
: unary_checks_(unary_checks) {
- ASSERT(value != NULL);
ASSERT(unary_checks.IsZoneHandle());
// Expected useful check data.
- ASSERT(!unary_checks_.IsNull() &&
- (unary_checks_.NumberOfChecks() > 0) &&
- (unary_checks_.num_args_tested() == 1));
- inputs_[0] = value;
+ ASSERT(!unary_checks_.IsNull());
+ ASSERT(unary_checks_.NumberOfChecks() > 0);
+ ASSERT(unary_checks_.num_args_tested() == 1);
+ SetInputAt(0, value);
deopt_id_ = deopt_id;
// Otherwise use CheckSmiInstr.
ASSERT((unary_checks_.NumberOfChecks() != 1) ||
@@ -535,8 +534,6 @@ void Definition::ReplaceWith(Definition* other,
for (intptr_t i = other->InputCount() - 1; i >= 0; --i) {
Value* input = other->InputAt(i);
input->definition()->AddInputUse(input);
- input->set_instruction(other);
- input->set_use_index(i);
}
// Take other's environment from this definition.
ASSERT(other->env() == NULL);
@@ -570,6 +567,19 @@ void Definition::ReplaceWith(Definition* other,
}
+BranchInstr::BranchInstr(ComparisonInstr* comparison, bool is_checked)
+ : comparison_(comparison), is_checked_(is_checked) {
+ for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
Vyacheslav Egorov (Google) 2013/02/22 16:13:36 Why are we going backwards? Seems like a micro-op
Kevin Millikin (Google) 2013/02/25 11:08:07 I disagree.
+ comparison->InputAt(i)->set_instruction(this);
+ }
+}
+
+
+void BranchInstr::RawSetInputAt(intptr_t i, Value* value) {
+ comparison()->SetInputAt(i, value);
Vyacheslav Egorov (Google) 2013/02/22 16:13:36 I think here you should delegate to RawSetInputAt.
Kevin Millikin (Google) 2013/02/25 11:08:07 Oops, OK. It's always seemed arbitrary (and more
+}
+
+
// A misleadingly named function for use in template functions that replace
// both definitions with definitions and branch comparisons with
// comparisons. In the branch case, leave the branch intact and replace its
@@ -589,9 +599,7 @@ void BranchInstr::SetComparison(ComparisonInstr* comp) {
// The new comparison's input uses are already recorded in their
// definition's use lists.
for (intptr_t i = comp->InputCount() - 1; i >= 0; --i) {
- Value* input = comp->InputAt(i);
- input->set_instruction(this);
- input->set_use_index(i);
+ comp->InputAt(i)->set_instruction(this);
}
// There should be no need to copy or unuse an environment.
ASSERT(comparison()->env() == NULL);
@@ -755,13 +763,10 @@ void BlockEntryInstr::ReplaceAsPredecessorWith(BlockEntryInstr* new_block) {
for (intptr_t use_idx = old_index;
use_idx != new_index;
use_idx += step) {
- Value* use = phi->InputAt(use_idx + step);
- phi->SetInputAt(use_idx, use);
- use->set_use_index(use_idx);
+ phi->SetInputAt(use_idx, phi->InputAt(use_idx + step));
}
// Write the predecessor use.
phi->SetInputAt(new_index, pred_use);
- pred_use->set_use_index(new_index);
}
}
}
@@ -2171,6 +2176,23 @@ intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) {
}
+InvokeMathCFunctionInstr::InvokeMathCFunctionInstr(
+ ZoneGrowableArray<Value*>* inputs,
+ InstanceCallInstr* instance_call,
+ MethodRecognizer::Kind recognized_kind)
+ : inputs_(inputs),
+ locs_(NULL),
+ recognized_kind_(recognized_kind) {
+ ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_));
+ for (intptr_t i = 0; i < inputs_->length(); ++i) {
+ ASSERT((*inputs)[i] != NULL);
+ (*inputs)[i]->set_instruction(this);
+ (*inputs)[i]->set_use_index(i);
+ }
+ deopt_id_ = instance_call->deopt_id();
+}
+
+
intptr_t InvokeMathCFunctionInstr::ArgumentCountFor(
MethodRecognizer::Kind kind) {
switch (kind) {
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698