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

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

Issue 10829: Finish porting jump target changes to the ARM platform. The v8 test... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 12 years, 1 month 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
« no previous file with comments | « src/codegen-ia32.cc ('k') | src/jump-target-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jump-target-arm.cc
===================================================================
--- src/jump-target-arm.cc (revision 737)
+++ src/jump-target-arm.cc (working copy)
@@ -37,11 +37,10 @@
#define __ masm_->
-JumpTarget::JumpTarget(CodeGenerator* cgen) {
- ASSERT(cgen != NULL);
- expected_frame_ = NULL;
- code_generator_ = cgen;
- masm_ = cgen->masm();
+JumpTarget::JumpTarget(CodeGenerator* cgen)
+ : expected_frame_(NULL),
+ code_generator_(cgen),
+ masm_(cgen->masm()) {
}
@@ -61,15 +60,91 @@
void JumpTarget::Jump() {
+ // Precondition: there is a current frame. There may or may not be an
+ // expected frame at the label.
+ ASSERT(code_generator_ != NULL);
+
+ VirtualFrame* current_frame = code_generator_->frame();
+ ASSERT(current_frame != NULL);
+
+ if (expected_frame_ == NULL) {
+ expected_frame_ = current_frame;
+ code_generator_->set_frame(NULL);
+ } else {
+ current_frame->MergeTo(expected_frame_);
+ code_generator_->delete_frame();
+ }
+
__ b(&label_);
+ // Postcondition: there is no current frame but there is an expected frame
+ // at the label.
}
+
void JumpTarget::Branch(Condition cc, Hint ignored) {
+ // Precondition: there is a current frame. There may or may not be an
+ // expected frame at the label.
+ ASSERT(code_generator_ != NULL);
+ ASSERT(masm_ != NULL);
+
+ VirtualFrame* current_frame = code_generator_->frame();
+ ASSERT(current_frame != NULL);
+
+ if (expected_frame_ == NULL) {
+ expected_frame_ = new VirtualFrame(current_frame);
+ } else {
+ current_frame->MergeTo(expected_frame_);
+ }
+
__ b(cc, &label_);
+ // Postcondition: there is both a current frame and an expected frame at
+ // the label and they match.
}
+
+void JumpTarget::Call() {
+ // Precondition: there is a current frame, and there is no expected frame
+ // at the label.
+ ASSERT(code_generator_ != NULL);
+ ASSERT(masm_ != NULL);
+
+ VirtualFrame* current_frame = code_generator_->frame();
+ ASSERT(current_frame != NULL);
+ ASSERT(expected_frame_ == NULL);
+
+ expected_frame_ = new VirtualFrame(current_frame);
+ // Adjust the expected frame's height to account for the return address
+ // pushed by the call instruction.
+ expected_frame_->Adjust(1);
+
+ __ bl(&label_);
+ // Postcondition: there is both a current frame and an expected frame at
+ // the label. The current frame is one shorter than the one at the label
+ // (which contains the return address in memory).
+}
+
+
void JumpTarget::Bind() {
+ // Precondition: there is either a current frame or an expected frame at
+ // the label (and possibly both). The label is unbound.
+ ASSERT(code_generator_ != NULL);
+ ASSERT(masm_ != NULL);
+
+ VirtualFrame* current_frame = code_generator_->frame();
+ ASSERT(current_frame != NULL || expected_frame_ != NULL);
+ ASSERT(!label_.is_bound());
+
+ if (expected_frame_ == NULL) {
+ expected_frame_ = new VirtualFrame(current_frame);
+ } else if (current_frame == NULL) {
+ code_generator_->set_frame(new VirtualFrame(expected_frame_));
+ } else {
+ current_frame->MergeTo(expected_frame_);
+ }
+
__ bind(&label_);
+ // Postcondition: there is both a current frame and an expected frame at
+ // the label and they match. The label is bound.
}
« no previous file with comments | « src/codegen-ia32.cc ('k') | src/jump-target-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698