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

Side by Side Diff: src/jump-target-ia32.cc

Issue 19425: Change FastCharCodeAt to use a virtual frame. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: '' Created 11 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/jump-target.h ('k') | no next file » | 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void JumpTarget::Jump(Result* arg0, Result* arg1) { 105 void JumpTarget::Jump(Result* arg0, Result* arg1) {
106 ASSERT(cgen_ != NULL); 106 ASSERT(cgen_ != NULL);
107 ASSERT(cgen_->has_valid_frame()); 107 ASSERT(cgen_->has_valid_frame());
108 108
109 cgen_->frame()->Push(arg0); 109 cgen_->frame()->Push(arg0);
110 cgen_->frame()->Push(arg1); 110 cgen_->frame()->Push(arg1);
111 Jump(); 111 Jump();
112 } 112 }
113 113
114 114
115 void JumpTarget::Jump(Result* arg0, Result* arg1, Result* arg2) {
116 ASSERT(cgen_ != NULL);
117 ASSERT(cgen_->has_valid_frame());
118
119 cgen_->frame()->Push(arg0);
120 cgen_->frame()->Push(arg1);
121 cgen_->frame()->Push(arg2);
122 Jump();
123 }
124
125
115 void JumpTarget::Branch(Condition cc, Hint hint) { 126 void JumpTarget::Branch(Condition cc, Hint hint) {
116 ASSERT(cgen_ != NULL); 127 ASSERT(cgen_ != NULL);
117 ASSERT(cgen_->has_valid_frame()); 128 ASSERT(cgen_->has_valid_frame());
118 129
119 if (is_bound()) { 130 if (is_bound()) {
120 // Backward branch. We have an expected frame to merge to on the 131 // Backward branch. We have an expected frame to merge to on the
121 // backward edge. We negate the condition and emit the merge code 132 // backward edge. We negate the condition and emit the merge code
122 // here. 133 // here.
123 // 134 //
124 // TODO(210): we should try to avoid negating the condition in the 135 // TODO(210): we should try to avoid negating the condition in the
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 cgen_->frame()->Push(arg0); 208 cgen_->frame()->Push(arg0);
198 cgen_->frame()->Push(arg1); 209 cgen_->frame()->Push(arg1);
199 Branch(cc, hint); 210 Branch(cc, hint);
200 *arg1 = cgen_->frame()->Pop(); 211 *arg1 = cgen_->frame()->Pop();
201 *arg0 = cgen_->frame()->Pop(); 212 *arg0 = cgen_->frame()->Pop();
202 213
203 ASSERT_ARGCHECK(arg0); 214 ASSERT_ARGCHECK(arg0);
204 ASSERT_ARGCHECK(arg1); 215 ASSERT_ARGCHECK(arg1);
205 } 216 }
206 217
218
219 void JumpTarget::Branch(Condition cc,
220 Result* arg0,
221 Result* arg1,
222 Result* arg2,
223 Hint hint) {
224 ASSERT(cgen_ != NULL);
225 ASSERT(cgen_->frame() != NULL);
226
227 // We want to check that non-frame registers at the call site stay in
228 // the same registers on the fall-through branch.
229 DECLARE_ARGCHECK_VARS(arg0);
230 DECLARE_ARGCHECK_VARS(arg1);
231 DECLARE_ARGCHECK_VARS(arg2);
232
233 cgen_->frame()->Push(arg0);
234 cgen_->frame()->Push(arg1);
235 cgen_->frame()->Push(arg2);
236 Branch(cc, hint);
237 *arg2 = cgen_->frame()->Pop();
238 *arg1 = cgen_->frame()->Pop();
239 *arg0 = cgen_->frame()->Pop();
240
241 ASSERT_ARGCHECK(arg0);
242 ASSERT_ARGCHECK(arg1);
243 ASSERT_ARGCHECK(arg2);
244 }
245
246
247 void JumpTarget::Branch(Condition cc,
248 Result* arg0,
249 Result* arg1,
250 Result* arg2,
251 Result* arg3,
252 Hint hint) {
253 ASSERT(cgen_ != NULL);
254 ASSERT(cgen_->frame() != NULL);
255
256 // We want to check that non-frame registers at the call site stay in
257 // the same registers on the fall-through branch.
258 DECLARE_ARGCHECK_VARS(arg0);
259 DECLARE_ARGCHECK_VARS(arg1);
260 DECLARE_ARGCHECK_VARS(arg2);
261 DECLARE_ARGCHECK_VARS(arg3);
262
263 cgen_->frame()->Push(arg0);
264 cgen_->frame()->Push(arg1);
265 cgen_->frame()->Push(arg2);
266 cgen_->frame()->Push(arg3);
267 Branch(cc, hint);
268 *arg3 = cgen_->frame()->Pop();
269 *arg2 = cgen_->frame()->Pop();
270 *arg1 = cgen_->frame()->Pop();
271 *arg0 = cgen_->frame()->Pop();
272
273 ASSERT_ARGCHECK(arg0);
274 ASSERT_ARGCHECK(arg1);
275 ASSERT_ARGCHECK(arg2);
276 ASSERT_ARGCHECK(arg3);
277 }
278
207 #undef DECLARE_ARGCHECK_VARS 279 #undef DECLARE_ARGCHECK_VARS
208 #undef ASSERT_ARGCHECK 280 #undef ASSERT_ARGCHECK
209 281
210 282
211 void JumpTarget::Call() { 283 void JumpTarget::Call() {
212 // Call is used to push the address of the catch block on the stack as 284 // Call is used to push the address of the catch block on the stack as
213 // a return address when compiling try/catch and try/finally. We 285 // a return address when compiling try/catch and try/finally. We
214 // fully spill the frame before making the call. The expected frame 286 // fully spill the frame before making the call. The expected frame
215 // at the label (which should be the only one) is the spilled current 287 // at the label (which should be the only one) is the spilled current
216 // frame plus an in-memory return address. The "fall-through" frame 288 // frame plus an in-memory return address. The "fall-through" frame
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (cgen_->has_valid_frame()) { 371 if (cgen_->has_valid_frame()) {
300 cgen_->frame()->Push(arg0); 372 cgen_->frame()->Push(arg0);
301 cgen_->frame()->Push(arg1); 373 cgen_->frame()->Push(arg1);
302 } 374 }
303 Bind(); 375 Bind();
304 *arg1 = cgen_->frame()->Pop(); 376 *arg1 = cgen_->frame()->Pop();
305 *arg0 = cgen_->frame()->Pop(); 377 *arg0 = cgen_->frame()->Pop();
306 } 378 }
307 379
308 380
381 void JumpTarget::Bind(Result* arg0, Result* arg1, Result* arg2) {
382 ASSERT(cgen_ != NULL);
383
384 if (cgen_->has_valid_frame()) {
385 cgen_->frame()->Push(arg0);
386 cgen_->frame()->Push(arg1);
387 cgen_->frame()->Push(arg2);
388 }
389 Bind();
390 *arg2 = cgen_->frame()->Pop();
391 *arg1 = cgen_->frame()->Pop();
392 *arg0 = cgen_->frame()->Pop();
393 }
394
395
396 void JumpTarget::Bind(Result* arg0, Result* arg1, Result* arg2, Result* arg3) {
397 ASSERT(cgen_ != NULL);
398
399 if (cgen_->has_valid_frame()) {
400 cgen_->frame()->Push(arg0);
401 cgen_->frame()->Push(arg1);
402 cgen_->frame()->Push(arg2);
403 cgen_->frame()->Push(arg3);
404 }
405 Bind();
406 *arg3 = cgen_->frame()->Pop();
407 *arg2 = cgen_->frame()->Pop();
408 *arg1 = cgen_->frame()->Pop();
409 *arg0 = cgen_->frame()->Pop();
410 }
411
412
309 void JumpTarget::CopyTo(JumpTarget* destination) { 413 void JumpTarget::CopyTo(JumpTarget* destination) {
310 ASSERT(destination != NULL); 414 ASSERT(destination != NULL);
311 destination->cgen_ = cgen_; 415 destination->cgen_ = cgen_;
312 destination->masm_ = masm_; 416 destination->masm_ = masm_;
313 destination->direction_ = direction_; 417 destination->direction_ = direction_;
314 destination->reaching_frames_.Clear(); 418 destination->reaching_frames_.Clear();
315 destination->merge_labels_.Clear(); 419 destination->merge_labels_.Clear();
316 ASSERT(reaching_frames_.length() == merge_labels_.length()); 420 ASSERT(reaching_frames_.length() == merge_labels_.length());
317 for (int i = 0; i < reaching_frames_.length(); i++) { 421 for (int i = 0; i < reaching_frames_.length(); i++) {
318 destination->reaching_frames_.Add(reaching_frames_[i]); 422 destination->reaching_frames_.Add(reaching_frames_[i]);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 478
375 #ifdef DEBUG 479 #ifdef DEBUG
376 is_shadowing_ = false; 480 is_shadowing_ = false;
377 #endif 481 #endif
378 } 482 }
379 483
380 #undef __ 484 #undef __
381 485
382 486
383 } } // namespace v8::internal 487 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/jump-target.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698