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

Unified Diff: src/jump-target-light.cc

Issue 1961004: First step towards making JumpTarget work on ARM. Instead... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 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
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

Powered by Google App Engine
This is Rietveld 408576698