OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 17 matching lines...) Expand all Loading... |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
31 #include "jump-target-inl.h" | 31 #include "jump-target-inl.h" |
32 #include "register-allocator-inl.h" | 32 #include "register-allocator-inl.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 | 37 |
| 38 bool JumpTarget::compiling_deferred_code_ = false; |
| 39 |
| 40 |
38 void JumpTarget::Jump(Result* arg) { | 41 void JumpTarget::Jump(Result* arg) { |
39 ASSERT(cgen()->has_valid_frame()); | 42 ASSERT(cgen()->has_valid_frame()); |
40 | 43 |
41 cgen()->frame()->Push(arg); | 44 cgen()->frame()->Push(arg); |
42 DoJump(); | 45 DoJump(); |
43 } | 46 } |
44 | 47 |
45 | 48 |
46 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { | 49 void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) { |
47 ASSERT(cgen()->has_valid_frame()); | 50 ASSERT(cgen()->has_valid_frame()); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } else if (frame->elements_[loc].is_synced()) { | 356 } else if (frame->elements_[loc].is_synced()) { |
354 // Needs to be restored on exit but not saved on entry. | 357 // Needs to be restored on exit but not saved on entry. |
355 registers_[i] = frame->fp_relative(loc) | kSyncedFlag; | 358 registers_[i] = frame->fp_relative(loc) | kSyncedFlag; |
356 } else { | 359 } else { |
357 int offset = frame->fp_relative(loc); | 360 int offset = frame->fp_relative(loc); |
358 registers_[i] = (offset < sp_offset) ? kPush : offset; | 361 registers_[i] = (offset < sp_offset) ? kPush : offset; |
359 } | 362 } |
360 } | 363 } |
361 } | 364 } |
362 | 365 |
| 366 |
| 367 void JumpTarget::Unuse() { |
| 368 reaching_frames_.Clear(); |
| 369 merge_labels_.Clear(); |
| 370 entry_frame_ = NULL; |
| 371 entry_label_.Unuse(); |
| 372 } |
| 373 |
| 374 |
| 375 void JumpTarget::AddReachingFrame(VirtualFrame* frame) { |
| 376 ASSERT(reaching_frames_.length() == merge_labels_.length()); |
| 377 ASSERT(entry_frame_ == NULL); |
| 378 Label fresh; |
| 379 merge_labels_.Add(fresh); |
| 380 reaching_frames_.Add(frame); |
| 381 } |
| 382 |
| 383 |
| 384 // ------------------------------------------------------------------------- |
| 385 // BreakTarget implementation. |
| 386 |
| 387 void BreakTarget::set_direction(Directionality direction) { |
| 388 JumpTarget::set_direction(direction); |
| 389 ASSERT(cgen()->has_valid_frame()); |
| 390 expected_height_ = cgen()->frame()->height(); |
| 391 } |
| 392 |
| 393 |
| 394 void BreakTarget::CopyTo(BreakTarget* destination) { |
| 395 ASSERT(destination != NULL); |
| 396 destination->direction_ = direction_; |
| 397 destination->reaching_frames_.Rewind(0); |
| 398 destination->reaching_frames_.AddAll(reaching_frames_); |
| 399 destination->merge_labels_.Rewind(0); |
| 400 destination->merge_labels_.AddAll(merge_labels_); |
| 401 destination->entry_frame_ = entry_frame_; |
| 402 destination->entry_label_ = entry_label_; |
| 403 destination->expected_height_ = expected_height_; |
| 404 } |
| 405 |
| 406 |
| 407 void BreakTarget::Branch(Condition cc, Hint hint) { |
| 408 ASSERT(cgen()->has_valid_frame()); |
| 409 |
| 410 int count = cgen()->frame()->height() - expected_height_; |
| 411 if (count > 0) { |
| 412 // We negate and branch here rather than using DoBranch's negate |
| 413 // and branch. This gives us a hook to remove statement state |
| 414 // from the frame. |
| 415 JumpTarget fall_through; |
| 416 // Branch to fall through will not negate, because it is a |
| 417 // forward-only target. |
| 418 fall_through.Branch(NegateCondition(cc), NegateHint(hint)); |
| 419 Jump(); // May emit merge code here. |
| 420 fall_through.Bind(); |
| 421 } else { |
| 422 DoBranch(cc, hint); |
| 423 } |
| 424 } |
| 425 |
363 } } // namespace v8::internal | 426 } } // namespace v8::internal |
OLD | NEW |