Author: [email protected]
Date: Wed Jan 14 06:52:27 2009
New Revision: 1073
Modified:
branches/experimental/toiger/src/codegen-ia32.cc
branches/experimental/toiger/src/jump-target-ia32.cc
Log:
Assert that, when jumping or binding a label, there is no value in the
compiler's cc_reg_ global state variable.
Review URL: http://codereview.chromium.org/18046
Modified: branches/experimental/toiger/src/codegen-ia32.cc
==============================================================================
--- branches/experimental/toiger/src/codegen-ia32.cc (original)
+++ branches/experimental/toiger/src/codegen-ia32.cc Wed Jan 14 06:52:27
2009
@@ -441,13 +441,14 @@
// Convert cc_reg_ into a boolean value.
JumpTarget loaded(this);
JumpTarget materialize_true(this);
- materialize_true.Branch(cc_reg_);
+ Condition cc = cc_reg_;
+ cc_reg_ = no_condition;
+ materialize_true.Branch(cc);
frame_->EmitPush(Immediate(Factory::false_value()));
loaded.Jump();
materialize_true.Bind();
frame_->EmitPush(Immediate(Factory::true_value()));
loaded.Bind();
- cc_reg_ = no_condition;
}
if (true_target.is_linked() || false_target.is_linked()) {
@@ -1401,8 +1402,8 @@
void CodeGenerator::Branch(bool if_true, JumpTarget* target) {
ASSERT(has_cc());
Condition cc = if_true ? cc_reg_ : NegateCondition(cc_reg_);
- target->Branch(cc);
cc_reg_ = no_condition;
+ target->Branch(cc);
}
Modified: branches/experimental/toiger/src/jump-target-ia32.cc
==============================================================================
--- branches/experimental/toiger/src/jump-target-ia32.cc (original)
+++ branches/experimental/toiger/src/jump-target-ia32.cc Wed Jan 14
06:52:27 2009
@@ -63,6 +63,7 @@
// Precondition: there is a current frame. There may or may not be an
// expected frame at the label.
ASSERT(cgen_ != NULL);
+ ASSERT(!cgen_->has_cc());
VirtualFrame* current_frame = cgen_->frame();
ASSERT(current_frame != NULL);
@@ -100,6 +101,7 @@
// expected frame at the label.
ASSERT(cgen_ != NULL);
ASSERT(masm_ != NULL);
+ ASSERT(!cgen_->has_cc());
VirtualFrame* current_frame = cgen_->frame();
ASSERT(current_frame != NULL);
@@ -202,6 +204,7 @@
// at the label.
ASSERT(cgen_ != NULL);
ASSERT(masm_ != NULL);
+ ASSERT(!cgen_->has_cc());
VirtualFrame* current_frame = cgen_->frame();
ASSERT(current_frame != NULL);
@@ -227,6 +230,7 @@
// the label (and possibly both). The label is unbound.
ASSERT(cgen_ != NULL);
ASSERT(masm_ != NULL);
+ ASSERT(!cgen_->has_cc());
VirtualFrame* current_frame = cgen_->frame();
ASSERT(current_frame != NULL || expected_frame_ != NULL);
@@ -264,66 +268,24 @@
void JumpTarget::Bind(Result* arg) {
ASSERT(cgen_ != NULL);
-#ifdef DEBUG
- // We want register results at the call site to stay in the same
- // registers.
- bool had_entry_frame = false;
- Result::Type arg_type;
- Register arg_reg;
-#endif
-
if (cgen_->has_valid_frame()) {
-#ifdef DEBUG
- had_entry_frame = true;
- arg_type = arg->type();
- arg_reg = arg->is_register() ? arg->reg() : no_reg;
-#endif
cgen_->frame()->Push(arg);
}
Bind();
*arg = cgen_->frame()->Pop();
-
- ASSERT(!had_entry_frame || arg->type() == arg_type);
- ASSERT(!had_entry_frame || !arg->is_register() ||
arg->reg().is(arg_reg));
}
void JumpTarget::Bind(Result* arg0, Result* arg1) {
ASSERT(cgen_ != NULL);
-#ifdef DEBUG
- // We want register results at the call site to stay in the same
- // registers.
- bool had_entry_frame = false;
- Result::Type arg0_type;
- Register arg0_reg;
- Result::Type arg1_type;
- Register arg1_reg;
-#endif
-
if (cgen_->frame() != NULL) {
-#ifdef DEBUG
- had_entry_frame = true;
- arg0_type = arg0->type();
- arg0_reg = arg0->is_register() ? arg0->reg() : no_reg;
- arg1_type = arg1->type();
- arg1_reg = arg1->is_register() ? arg1->reg() : no_reg;
-#endif
cgen_->frame()->Push(arg0);
cgen_->frame()->Push(arg1);
}
Bind();
*arg1 = cgen_->frame()->Pop();
*arg0 = cgen_->frame()->Pop();
-
- ASSERT(!had_entry_frame || arg0->type() == arg0_type);
- ASSERT(!had_entry_frame ||
- !arg0->is_register() ||
- arg0->reg().is(arg0_reg));
- ASSERT(!had_entry_frame || arg1->type() == arg1_type);
- ASSERT(!had_entry_frame ||
- !arg1->is_register() ||
- arg1->reg().is(arg1_reg));
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---