Chromium Code Reviews| Index: src/jump-target-ia32.cc |
| =================================================================== |
| --- src/jump-target-ia32.cc (revision 1019) |
| +++ src/jump-target-ia32.cc (working copy) |
| @@ -168,6 +168,32 @@ |
| } |
| +void JumpTarget::Branch(Condition cc, Result* arg_1, Result* arg_2, Hint hint) { |
| + ASSERT(cgen_ != NULL); |
| + ASSERT(cgen_->frame() != NULL); |
| + |
| +#ifdef DEBUG |
| + // We want register results at the call site to stay in the same registers |
| + // on the fall-through branch. |
| + Result::Type arg_1_type = arg_1->type(); |
|
Kevin Millikin (Chromium)
2008/12/29 09:05:38
These assertions don't scale so well. We should t
|
| + Register arg_1_reg = arg_1->is_register() ? arg_1->reg() : no_reg; |
| + Result::Type arg_2_type = arg_2->type(); |
| + Register arg_2_reg = arg_2->is_register() ? arg_2->reg() : no_reg; |
| +#endif |
| + |
| + cgen_->frame()->Push(arg_1); |
| + cgen_->frame()->Push(arg_2); |
| + Branch(cc, hint); |
| + *arg_2 = cgen_->frame()->Pop(); |
| + *arg_1 = cgen_->frame()->Pop(); |
| + |
| + ASSERT(arg_1->type() == arg_1_type); |
| + ASSERT(!arg_1->is_register() || arg_1->reg().is(arg_1_reg)); |
| + ASSERT(arg_2->type() == arg_2_type); |
| + ASSERT(!arg_2->is_register() || arg_2->reg().is(arg_2_reg)); |
| +} |
| + |
| + |
| void JumpTarget::Call() { |
| // Precondition: there is a current frame, and there is no expected frame |
| // at the label. |
| @@ -261,6 +287,45 @@ |
| } |
| +void JumpTarget::Bind(Result* arg_1, Result* arg_2) { |
| + 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_1_type; |
| + Register arg_1_reg; |
| + Result::Type arg_2_type; |
| + Register arg_2_reg; |
| +#endif |
| + |
| + if (cgen_->frame() != NULL) { |
| +#ifdef DEBUG |
| + had_entry_frame = true; |
| + arg_1_type = arg_1->type(); |
| + arg_1_reg = arg_1->is_register() ? arg_1->reg() : no_reg; |
| + arg_2_type = arg_2->type(); |
| + arg_2_reg = arg_2->is_register() ? arg_2->reg() : no_reg; |
| +#endif |
| + cgen_->frame()->Push(arg_1); |
| + cgen_->frame()->Push(arg_2); |
| + } |
| + Bind(); |
| + *arg_2 = cgen_->frame()->Pop(); |
| + *arg_1 = cgen_->frame()->Pop(); |
| + |
| + ASSERT(!had_entry_frame || arg_1->type() == arg_1_type); |
| + ASSERT(!had_entry_frame || |
| + !arg_1->is_register() || |
| + arg_1->reg().is(arg_1_reg)); |
| + ASSERT(!had_entry_frame || arg_2->type() == arg_2_type); |
| + ASSERT(!had_entry_frame || |
| + !arg_2->is_register() || |
| + arg_2->reg().is(arg_2_reg)); |
| +} |
| + |
| + |
| // ------------------------------------------------------------------------- |
| // ShadowTarget implementation. |