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

Side by Side Diff: src/jump-target-ia32.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/jump-target-arm.cc ('k') | src/virtual-frame-arm.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 19 matching lines...) Expand all
30 #include "codegen.h" 30 #include "codegen.h"
31 #include "jump-target.h" 31 #include "jump-target.h"
32 32
33 namespace v8 { namespace internal { 33 namespace v8 { namespace internal {
34 34
35 // ------------------------------------------------------------------------- 35 // -------------------------------------------------------------------------
36 // JumpTarget implementation. 36 // JumpTarget implementation.
37 37
38 #define __ masm_-> 38 #define __ masm_->
39 39
40 JumpTarget::JumpTarget(CodeGenerator* cgen) { 40 JumpTarget::JumpTarget(CodeGenerator* cgen)
41 ASSERT(cgen != NULL); 41 : expected_frame_(NULL),
42 expected_frame_ = NULL; 42 code_generator_(cgen),
43 code_generator_ = cgen; 43 masm_(cgen->masm()) {
44 masm_ = cgen->masm();
45 } 44 }
46 45
47 46
48 JumpTarget::JumpTarget() 47 JumpTarget::JumpTarget()
49 : expected_frame_(NULL), 48 : expected_frame_(NULL),
50 code_generator_(NULL), 49 code_generator_(NULL),
51 masm_(NULL) { 50 masm_(NULL) {
52 } 51 }
53 52
54 53
55 void JumpTarget::set_code_generator(CodeGenerator* cgen) { 54 void JumpTarget::set_code_generator(CodeGenerator* cgen) {
56 ASSERT(cgen != NULL); 55 ASSERT(cgen != NULL);
57 ASSERT(code_generator_ == NULL); 56 ASSERT(code_generator_ == NULL);
58 code_generator_ = cgen; 57 code_generator_ = cgen;
59 masm_ = cgen->masm(); 58 masm_ = cgen->masm();
60 } 59 }
61 60
62 61
63 void JumpTarget::Jump() { 62 void JumpTarget::Jump() {
64 // Precondition: there is a current frame. There may or may not be an 63 // Precondition: there is a current frame. There may or may not be an
65 // expected frame at the label. 64 // expected frame at the label.
66 ASSERT(code_generator_ != NULL); 65 ASSERT(code_generator_ != NULL);
67 ASSERT(masm_ != NULL);
68 66
69 VirtualFrame* current_frame = code_generator_->frame(); 67 VirtualFrame* current_frame = code_generator_->frame();
70 ASSERT(current_frame != NULL); 68 ASSERT(current_frame != NULL);
71 69
72 if (expected_frame_ == NULL) { 70 if (expected_frame_ == NULL) {
73 expected_frame_ = current_frame; 71 expected_frame_ = current_frame;
74 code_generator_->set_frame(NULL); 72 code_generator_->set_frame(NULL);
75 // The frame at the actual function return will always have height 73 // The frame at the actual function return will always have height
76 // zero. 74 // zero.
77 if (code_generator_->IsActualFunctionReturn(this)) { 75 if (code_generator_->IsActualFunctionReturn(this)) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 VirtualFrame* current_frame = code_generator_->frame(); 130 VirtualFrame* current_frame = code_generator_->frame();
133 ASSERT(current_frame != NULL); 131 ASSERT(current_frame != NULL);
134 ASSERT(expected_frame_ == NULL); 132 ASSERT(expected_frame_ == NULL);
135 133
136 expected_frame_ = new VirtualFrame(current_frame); 134 expected_frame_ = new VirtualFrame(current_frame);
137 // Adjust the expected frame's height to account for the return address 135 // Adjust the expected frame's height to account for the return address
138 // pushed by the call instruction. 136 // pushed by the call instruction.
139 expected_frame_->Adjust(1); 137 expected_frame_->Adjust(1);
140 138
141 __ call(&label_); 139 __ call(&label_);
142
143 // Postcondition: there is both a current frame and an expected frame at 140 // Postcondition: there is both a current frame and an expected frame at
144 // the label. The current frame is one shorter than the one at the label 141 // the label. The current frame is one shorter than the one at the label
145 // (which contains the 'return address', ie, the eip register and possibly 142 // (which contains the return address in memory).
146 // cs register).
147 } 143 }
148 144
149 145
150 void JumpTarget::Bind() { 146 void JumpTarget::Bind() {
147 // Precondition: there is either a current frame or an expected frame at
148 // the label (and possibly both). The label is unbound.
151 ASSERT(code_generator_ != NULL); 149 ASSERT(code_generator_ != NULL);
152 ASSERT(masm_ != NULL); 150 ASSERT(masm_ != NULL);
153 151
154 // Precondition: there is either a current frame or an expected frame at
155 // the label (and possibly both). The label is unbound.
156 VirtualFrame* current_frame = code_generator_->frame(); 152 VirtualFrame* current_frame = code_generator_->frame();
157 ASSERT(current_frame != NULL || expected_frame_ != NULL); 153 ASSERT(current_frame != NULL || expected_frame_ != NULL);
158 ASSERT(!label_.is_bound()); 154 ASSERT(!label_.is_bound());
159 155
160 if (expected_frame_ == NULL) { 156 if (expected_frame_ == NULL) {
161 expected_frame_ = new VirtualFrame(current_frame); 157 expected_frame_ = new VirtualFrame(current_frame);
162 // The frame at the actual function return will always have height 158 // The frame at the actual function return will always have height
163 // zero. 159 // zero.
164 if (code_generator_->IsActualFunctionReturn(this)) { 160 if (code_generator_->IsActualFunctionReturn(this)) {
165 expected_frame_->Forget(expected_frame_->height()); 161 expected_frame_->Forget(expected_frame_->height());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 208
213 #ifdef DEBUG 209 #ifdef DEBUG
214 is_shadowing_ = false; 210 is_shadowing_ = false;
215 #endif 211 #endif
216 } 212 }
217 213
218 #undef __ 214 #undef __
219 215
220 216
221 } } // namespace v8::internal 217 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jump-target-arm.cc ('k') | src/virtual-frame-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698