| Index: src/jump-target-light.cc
|
| ===================================================================
|
| --- src/jump-target-light.cc (revision 4592)
|
| +++ src/jump-target-light.cc (working copy)
|
| @@ -34,53 +34,76 @@
|
| namespace internal {
|
|
|
|
|
| -void JumpTarget::Jump(Result* arg) {
|
| - UNIMPLEMENTED();
|
| -}
|
| +DeferredCode::DeferredCode()
|
| + : masm_(CodeGeneratorScope::Current()->masm()),
|
| + statement_position_(masm_->current_statement_position()),
|
| + position_(masm_->current_position()) {
|
| + ASSERT(statement_position_ != RelocInfo::kNoPosition);
|
| + ASSERT(position_ != RelocInfo::kNoPosition);
|
|
|
| + CodeGeneratorScope::Current()->AddDeferred(this);
|
|
|
| -void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) {
|
| - UNIMPLEMENTED();
|
| +#ifdef DEBUG
|
| + CodeGeneratorScope::Current()->frame()->AssertIsSpilled();
|
| +#endif
|
| }
|
|
|
|
|
| -void JumpTarget::Branch(Condition cc, Result* arg0, Result* arg1, Hint hint) {
|
| - UNIMPLEMENTED();
|
| -}
|
| +// -------------------------------------------------------------------------
|
| +// BreakTarget implementation.
|
|
|
|
|
| -void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) {
|
| - UNIMPLEMENTED();
|
| +void BreakTarget::SetExpectedHeight() {
|
| + expected_height_ = cgen()->frame()->height();
|
| }
|
|
|
|
|
| -void JumpTarget::Bind(Result* arg) {
|
| - UNIMPLEMENTED();
|
| +void BreakTarget::Jump() {
|
| + ASSERT(cgen()->has_valid_frame());
|
| +
|
| + int count = cgen()->frame()->height() - expected_height_;
|
| + if (count > 0) {
|
| + cgen()->frame()->Drop(count);
|
| + }
|
| + DoJump();
|
| }
|
|
|
|
|
| -void JumpTarget::Bind(Result* arg0, Result* arg1) {
|
| - UNIMPLEMENTED();
|
| -}
|
| +void BreakTarget::Branch(Condition cc, Hint hint) {
|
| + if (cc == al) {
|
| + Jump();
|
| + return;
|
| + }
|
|
|
| + ASSERT(cgen()->has_valid_frame());
|
|
|
| -void JumpTarget::ComputeEntryFrame() {
|
| - UNIMPLEMENTED();
|
| + int count = cgen()->frame()->height() - expected_height_;
|
| + if (count > 0) {
|
| + // We negate and branch here rather than using DoBranch's negate
|
| + // and branch. This gives us a hook to remove statement state
|
| + // from the frame.
|
| + JumpTarget fall_through;
|
| + // Branch to fall through will not negate, because it is a
|
| + // forward-only target.
|
| + fall_through.Branch(NegateCondition(cc), NegateHint(hint));
|
| + // Emit merge code.
|
| + cgen()->frame()->Drop(count);
|
| + DoJump();
|
| + fall_through.Bind();
|
| + } else {
|
| + DoBranch(cc, hint);
|
| + }
|
| }
|
|
|
|
|
| -DeferredCode::DeferredCode()
|
| - : masm_(CodeGeneratorScope::Current()->masm()),
|
| - statement_position_(masm_->current_statement_position()),
|
| - position_(masm_->current_position()) {
|
| - ASSERT(statement_position_ != RelocInfo::kNoPosition);
|
| - ASSERT(position_ != RelocInfo::kNoPosition);
|
| -
|
| - CodeGeneratorScope::Current()->AddDeferred(this);
|
| -
|
| -#ifdef DEBUG
|
| - CodeGeneratorScope::Current()->frame()->AssertIsSpilled();
|
| -#endif
|
| +void BreakTarget::Bind() {
|
| + if (cgen()->has_valid_frame()) {
|
| + int count = cgen()->frame()->height() - expected_height_;
|
| + if (count > 0) {
|
| + cgen()->frame()->Drop(count);
|
| + }
|
| + }
|
| + DoBind();
|
| }
|
|
|
| } } // namespace v8::internal
|
|
|