| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 elements_[index].set_sync(); | 150 elements_[index].set_sync(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 // Clear the dirty bits for the range of elements in | 154 // Clear the dirty bits for the range of elements in |
| 155 // [min(stack_pointer_ + 1,begin), end]. | 155 // [min(stack_pointer_ + 1,begin), end]. |
| 156 void VirtualFrame::SyncRange(int begin, int end) { | 156 void VirtualFrame::SyncRange(int begin, int end) { |
| 157 ASSERT(begin >= 0); | 157 ASSERT(begin >= 0); |
| 158 ASSERT(end < elements_.length()); | 158 ASSERT(end < element_count()); |
| 159 // Sync elements below the range if they have not been materialized | 159 // Sync elements below the range if they have not been materialized |
| 160 // on the stack. | 160 // on the stack. |
| 161 int start = Min(begin, stack_pointer_ + 1); | 161 int start = Min(begin, stack_pointer_ + 1); |
| 162 | 162 |
| 163 // If positive we have to adjust the stack pointer. | 163 // If positive we have to adjust the stack pointer. |
| 164 int delta = end - stack_pointer_; | 164 int delta = end - stack_pointer_; |
| 165 if (delta > 0) { | 165 if (delta > 0) { |
| 166 stack_pointer_ = end; | 166 stack_pointer_ = end; |
| 167 __ sub(Operand(esp), Immediate(delta * kPointerSize)); | 167 __ sub(Operand(esp), Immediate(delta * kPointerSize)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 for (int i = start; i <= end; i++) { | 170 for (int i = start; i <= end; i++) { |
| 171 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); | 171 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 | 175 |
| 176 void VirtualFrame::MakeMergable(int mergable_elements) { | 176 void VirtualFrame::MakeMergable(int mergable_elements) { |
| 177 if (mergable_elements == JumpTarget::kAllElements) { | 177 if (mergable_elements == JumpTarget::kAllElements) { |
| 178 mergable_elements = elements_.length(); | 178 mergable_elements = element_count(); |
| 179 } | 179 } |
| 180 ASSERT(mergable_elements <= elements_.length()); | 180 ASSERT(mergable_elements <= element_count()); |
| 181 | 181 |
| 182 int start_index = elements_.length() - mergable_elements; | 182 int start_index = element_count() - mergable_elements; |
| 183 for (int i = start_index; i < elements_.length(); i++) { | 183 for (int i = start_index; i < element_count(); i++) { |
| 184 FrameElement element = elements_[i]; | 184 FrameElement element = elements_[i]; |
| 185 | 185 |
| 186 if (element.is_constant() || element.is_copy()) { | 186 if (element.is_constant() || element.is_copy()) { |
| 187 if (element.is_synced()) { | 187 if (element.is_synced()) { |
| 188 // Just spill. | 188 // Just spill. |
| 189 elements_[i] = FrameElement::MemoryElement(); | 189 elements_[i] = FrameElement::MemoryElement(); |
| 190 } else { | 190 } else { |
| 191 // Allocate to a register. | 191 // Allocate to a register. |
| 192 FrameElement backing_element; // Invalid if not a copy. | 192 FrameElement backing_element; // Invalid if not a copy. |
| 193 if (element.is_copy()) { | 193 if (element.is_copy()) { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // Move registers, constants, and copies to memory. Perform moves | 273 // Move registers, constants, and copies to memory. Perform moves |
| 274 // from the top downward in the frame in order to leave the backing | 274 // from the top downward in the frame in order to leave the backing |
| 275 // stores of copies in registers. | 275 // stores of copies in registers. |
| 276 // | 276 // |
| 277 // Moving memory-backed copies to memory requires a spare register | 277 // Moving memory-backed copies to memory requires a spare register |
| 278 // for the memory-to-memory moves. Since we are performing a merge, | 278 // for the memory-to-memory moves. Since we are performing a merge, |
| 279 // we use esi (which is already saved in the frame). We keep track | 279 // we use esi (which is already saved in the frame). We keep track |
| 280 // of the index of the frame element esi is caching or kIllegalIndex | 280 // of the index of the frame element esi is caching or kIllegalIndex |
| 281 // if esi has not been disturbed. | 281 // if esi has not been disturbed. |
| 282 int esi_caches = kIllegalIndex; | 282 int esi_caches = kIllegalIndex; |
| 283 for (int i = elements_.length() - 1; i >= 0; i--) { | 283 for (int i = element_count() - 1; i >= 0; i--) { |
| 284 FrameElement target = expected->elements_[i]; | 284 FrameElement target = expected->elements_[i]; |
| 285 if (target.is_register()) continue; // Handle registers later. | 285 if (target.is_register()) continue; // Handle registers later. |
| 286 if (target.is_memory()) { | 286 if (target.is_memory()) { |
| 287 FrameElement source = elements_[i]; | 287 FrameElement source = elements_[i]; |
| 288 switch (source.type()) { | 288 switch (source.type()) { |
| 289 case FrameElement::INVALID: | 289 case FrameElement::INVALID: |
| 290 // Not a legal merge move. | 290 // Not a legal merge move. |
| 291 UNREACHABLE(); | 291 UNREACHABLE(); |
| 292 break; | 292 break; |
| 293 | 293 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 __ mov(ebp, Operand(esp)); | 474 __ mov(ebp, Operand(esp)); |
| 475 | 475 |
| 476 // Store the context in the frame. The context is kept in esi and a | 476 // Store the context in the frame. The context is kept in esi and a |
| 477 // copy is stored in the frame. The external reference to esi | 477 // copy is stored in the frame. The external reference to esi |
| 478 // remains. | 478 // remains. |
| 479 EmitPush(esi); | 479 EmitPush(esi); |
| 480 | 480 |
| 481 // Store the function in the frame. The frame owns the register | 481 // Store the function in the frame. The frame owns the register |
| 482 // reference now (ie, it can keep it in edi or spill it later). | 482 // reference now (ie, it can keep it in edi or spill it later). |
| 483 Push(edi); | 483 Push(edi); |
| 484 SyncElementAt(elements_.length() - 1); | 484 SyncElementAt(element_count() - 1); |
| 485 cgen()->allocator()->Unuse(edi); | 485 cgen()->allocator()->Unuse(edi); |
| 486 } | 486 } |
| 487 | 487 |
| 488 | 488 |
| 489 void VirtualFrame::Exit() { | 489 void VirtualFrame::Exit() { |
| 490 Comment cmnt(masm(), "[ Exit JS frame"); | 490 Comment cmnt(masm(), "[ Exit JS frame"); |
| 491 // Record the location of the JS exit code for patching when setting | 491 // Record the location of the JS exit code for patching when setting |
| 492 // break point. | 492 // break point. |
| 493 __ RecordJSReturn(); | 493 __ RecordJSReturn(); |
| 494 | 494 |
| 495 // Avoid using the leave instruction here, because it is too | 495 // Avoid using the leave instruction here, because it is too |
| 496 // short. We need the return sequence to be a least the size of a | 496 // short. We need the return sequence to be a least the size of a |
| 497 // call instruction to support patching the exit code in the | 497 // call instruction to support patching the exit code in the |
| 498 // debugger. See VisitReturnStatement for the full return sequence. | 498 // debugger. See VisitReturnStatement for the full return sequence. |
| 499 __ mov(esp, Operand(ebp)); | 499 __ mov(esp, Operand(ebp)); |
| 500 stack_pointer_ = frame_pointer(); | 500 stack_pointer_ = frame_pointer(); |
| 501 for (int i = elements_.length() - 1; i > stack_pointer_; i--) { | 501 for (int i = element_count() - 1; i > stack_pointer_; i--) { |
| 502 FrameElement last = elements_.RemoveLast(); | 502 FrameElement last = elements_.RemoveLast(); |
| 503 if (last.is_register()) { | 503 if (last.is_register()) { |
| 504 Unuse(last.reg()); | 504 Unuse(last.reg()); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 EmitPop(ebp); | 508 EmitPop(ebp); |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 void VirtualFrame::AllocateStackSlots() { | 512 void VirtualFrame::AllocateStackSlots() { |
| 513 int count = local_count(); | 513 int count = local_count(); |
| 514 if (count > 0) { | 514 if (count > 0) { |
| 515 Comment cmnt(masm(), "[ Allocate space for locals"); | 515 Comment cmnt(masm(), "[ Allocate space for locals"); |
| 516 // The locals are initialized to a constant (the undefined value), but | 516 // The locals are initialized to a constant (the undefined value), but |
| 517 // we sync them with the actual frame to allocate space for spilling | 517 // we sync them with the actual frame to allocate space for spilling |
| 518 // them later. First sync everything above the stack pointer so we can | 518 // them later. First sync everything above the stack pointer so we can |
| 519 // use pushes to allocate and initialize the locals. | 519 // use pushes to allocate and initialize the locals. |
| 520 SyncRange(stack_pointer_ + 1, elements_.length() - 1); | 520 SyncRange(stack_pointer_ + 1, element_count() - 1); |
| 521 Handle<Object> undefined = Factory::undefined_value(); | 521 Handle<Object> undefined = Factory::undefined_value(); |
| 522 FrameElement initial_value = | 522 FrameElement initial_value = |
| 523 FrameElement::ConstantElement(undefined, FrameElement::SYNCED); | 523 FrameElement::ConstantElement(undefined, FrameElement::SYNCED); |
| 524 Result temp = cgen()->allocator()->Allocate(); | 524 Result temp = cgen()->allocator()->Allocate(); |
| 525 ASSERT(temp.is_valid()); | 525 ASSERT(temp.is_valid()); |
| 526 __ Set(temp.reg(), Immediate(undefined)); | 526 __ Set(temp.reg(), Immediate(undefined)); |
| 527 for (int i = 0; i < count; i++) { | 527 for (int i = 0; i < count; i++) { |
| 528 elements_.Add(initial_value); | 528 elements_.Add(initial_value); |
| 529 stack_pointer_++; | 529 stack_pointer_++; |
| 530 __ push(temp.reg()); | 530 __ push(temp.reg()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 553 } | 553 } |
| 554 | 554 |
| 555 | 555 |
| 556 int VirtualFrame::InvalidateFrameSlotAt(int index) { | 556 int VirtualFrame::InvalidateFrameSlotAt(int index) { |
| 557 FrameElement original = elements_[index]; | 557 FrameElement original = elements_[index]; |
| 558 | 558 |
| 559 // Is this element the backing store of any copies? | 559 // Is this element the backing store of any copies? |
| 560 int new_backing_index = kIllegalIndex; | 560 int new_backing_index = kIllegalIndex; |
| 561 if (original.is_copied()) { | 561 if (original.is_copied()) { |
| 562 // Verify it is copied, and find first copy. | 562 // Verify it is copied, and find first copy. |
| 563 for (int i = index + 1; i < elements_.length(); i++) { | 563 for (int i = index + 1; i < element_count(); i++) { |
| 564 if (elements_[i].is_copy() && elements_[i].index() == index) { | 564 if (elements_[i].is_copy() && elements_[i].index() == index) { |
| 565 new_backing_index = i; | 565 new_backing_index = i; |
| 566 break; | 566 break; |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 } | 569 } |
| 570 | 570 |
| 571 if (new_backing_index == kIllegalIndex) { | 571 if (new_backing_index == kIllegalIndex) { |
| 572 // No copies found, return kIllegalIndex. | 572 // No copies found, return kIllegalIndex. |
| 573 if (original.is_register()) { | 573 if (original.is_register()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 594 elements_[index] = FrameElement::InvalidElement(); | 594 elements_[index] = FrameElement::InvalidElement(); |
| 595 // Set the new backing element. | 595 // Set the new backing element. |
| 596 if (elements_[new_backing_index].is_synced()) { | 596 if (elements_[new_backing_index].is_synced()) { |
| 597 elements_[new_backing_index] = | 597 elements_[new_backing_index] = |
| 598 FrameElement::RegisterElement(backing_reg, FrameElement::SYNCED); | 598 FrameElement::RegisterElement(backing_reg, FrameElement::SYNCED); |
| 599 } else { | 599 } else { |
| 600 elements_[new_backing_index] = | 600 elements_[new_backing_index] = |
| 601 FrameElement::RegisterElement(backing_reg, FrameElement::NOT_SYNCED); | 601 FrameElement::RegisterElement(backing_reg, FrameElement::NOT_SYNCED); |
| 602 } | 602 } |
| 603 // Update the other copies. | 603 // Update the other copies. |
| 604 for (int i = new_backing_index + 1; i < elements_.length(); i++) { | 604 for (int i = new_backing_index + 1; i < element_count(); i++) { |
| 605 if (elements_[i].is_copy() && elements_[i].index() == index) { | 605 if (elements_[i].is_copy() && elements_[i].index() == index) { |
| 606 elements_[i].set_index(new_backing_index); | 606 elements_[i].set_index(new_backing_index); |
| 607 elements_[new_backing_index].set_copied(); | 607 elements_[new_backing_index].set_copied(); |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 return new_backing_index; | 610 return new_backing_index; |
| 611 } | 611 } |
| 612 | 612 |
| 613 | 613 |
| 614 void VirtualFrame::TakeFrameSlotAt(int index) { | 614 void VirtualFrame::TakeFrameSlotAt(int index) { |
| 615 ASSERT(index >= 0); | 615 ASSERT(index >= 0); |
| 616 ASSERT(index <= elements_.length()); | 616 ASSERT(index <= element_count()); |
| 617 FrameElement original = elements_[index]; | 617 FrameElement original = elements_[index]; |
| 618 int new_backing_store_index = InvalidateFrameSlotAt(index); | 618 int new_backing_store_index = InvalidateFrameSlotAt(index); |
| 619 if (new_backing_store_index != kIllegalIndex) { | 619 if (new_backing_store_index != kIllegalIndex) { |
| 620 elements_.Add(CopyElementAt(new_backing_store_index)); | 620 elements_.Add(CopyElementAt(new_backing_store_index)); |
| 621 return; | 621 return; |
| 622 } | 622 } |
| 623 | 623 |
| 624 switch (original.type()) { | 624 switch (original.type()) { |
| 625 case FrameElement::MEMORY: { | 625 case FrameElement::MEMORY: { |
| 626 // Emit code to load the original element's data into a register. | 626 // Emit code to load the original element's data into a register. |
| 627 // Push that register as a FrameElement on top of the frame. | 627 // Push that register as a FrameElement on top of the frame. |
| 628 Result fresh = cgen()->allocator()->Allocate(); | 628 Result fresh = cgen()->allocator()->Allocate(); |
| 629 ASSERT(fresh.is_valid()); | 629 ASSERT(fresh.is_valid()); |
| 630 FrameElement new_element = | 630 FrameElement new_element = |
| 631 FrameElement::RegisterElement(fresh.reg(), | 631 FrameElement::RegisterElement(fresh.reg(), |
| 632 FrameElement::NOT_SYNCED); | 632 FrameElement::NOT_SYNCED); |
| 633 Use(fresh.reg(), elements_.length()); | 633 Use(fresh.reg(), element_count()); |
| 634 elements_.Add(new_element); | 634 elements_.Add(new_element); |
| 635 __ mov(fresh.reg(), Operand(ebp, fp_relative(index))); | 635 __ mov(fresh.reg(), Operand(ebp, fp_relative(index))); |
| 636 break; | 636 break; |
| 637 } | 637 } |
| 638 case FrameElement::REGISTER: | 638 case FrameElement::REGISTER: |
| 639 Use(original.reg(), elements_.length()); | 639 Use(original.reg(), element_count()); |
| 640 // Fall through. | 640 // Fall through. |
| 641 case FrameElement::CONSTANT: | 641 case FrameElement::CONSTANT: |
| 642 case FrameElement::COPY: | 642 case FrameElement::COPY: |
| 643 original.clear_sync(); | 643 original.clear_sync(); |
| 644 elements_.Add(original); | 644 elements_.Add(original); |
| 645 break; | 645 break; |
| 646 case FrameElement::INVALID: | 646 case FrameElement::INVALID: |
| 647 UNREACHABLE(); | 647 UNREACHABLE(); |
| 648 break; | 648 break; |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 void VirtualFrame::StoreToFrameSlotAt(int index) { | 653 void VirtualFrame::StoreToFrameSlotAt(int index) { |
| 654 // Store the value on top of the frame to the virtual frame slot at | 654 // Store the value on top of the frame to the virtual frame slot at |
| 655 // a given index. The value on top of the frame is left in place. | 655 // a given index. The value on top of the frame is left in place. |
| 656 // This is a duplicating operation, so it can create copies. | 656 // This is a duplicating operation, so it can create copies. |
| 657 ASSERT(index >= 0); | 657 ASSERT(index >= 0); |
| 658 ASSERT(index < elements_.length()); | 658 ASSERT(index < element_count()); |
| 659 | 659 |
| 660 int top_index = elements_.length() - 1; | 660 int top_index = element_count() - 1; |
| 661 FrameElement top = elements_[top_index]; | 661 FrameElement top = elements_[top_index]; |
| 662 FrameElement original = elements_[index]; | 662 FrameElement original = elements_[index]; |
| 663 if (top.is_copy() && top.index() == index) return; | 663 if (top.is_copy() && top.index() == index) return; |
| 664 ASSERT(top.is_valid()); | 664 ASSERT(top.is_valid()); |
| 665 | 665 |
| 666 InvalidateFrameSlotAt(index); | 666 InvalidateFrameSlotAt(index); |
| 667 | 667 |
| 668 // InvalidateFrameSlotAt can potentially change any frame element, due | 668 // InvalidateFrameSlotAt can potentially change any frame element, due |
| 669 // to spilling registers to allocate temporaries in order to preserve | 669 // to spilling registers to allocate temporaries in order to preserve |
| 670 // the copy-on-write semantics of aliased elements. Reload top from | 670 // the copy-on-write semantics of aliased elements. Reload top from |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // The old backing element becomes a copy of the new backing | 717 // The old backing element becomes a copy of the new backing |
| 718 // element. | 718 // element. |
| 719 FrameElement new_element = CopyElementAt(index); | 719 FrameElement new_element = CopyElementAt(index); |
| 720 elements_[backing_index] = new_element; | 720 elements_[backing_index] = new_element; |
| 721 if (backing_element.is_synced()) { | 721 if (backing_element.is_synced()) { |
| 722 elements_[backing_index].set_sync(); | 722 elements_[backing_index].set_sync(); |
| 723 } | 723 } |
| 724 | 724 |
| 725 // All the copies of the old backing element (including the top | 725 // All the copies of the old backing element (including the top |
| 726 // element) become copies of the new backing element. | 726 // element) become copies of the new backing element. |
| 727 for (int i = backing_index + 1; i < elements_.length(); i++) { | 727 for (int i = backing_index + 1; i < element_count(); i++) { |
| 728 if (elements_[i].is_copy() && elements_[i].index() == backing_index) { | 728 if (elements_[i].is_copy() && elements_[i].index() == backing_index) { |
| 729 elements_[i].set_index(index); | 729 elements_[i].set_index(index); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 } | 732 } |
| 733 return; | 733 return; |
| 734 } | 734 } |
| 735 | 735 |
| 736 // Move the top element to the stored-to slot and replace it (the | 736 // Move the top element to the stored-to slot and replace it (the |
| 737 // top element) with a copy. | 737 // top element) with a copy. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 __ Set(num_args.reg(), Immediate(arg_count)); | 969 __ Set(num_args.reg(), Immediate(arg_count)); |
| 970 | 970 |
| 971 function.Unuse(); | 971 function.Unuse(); |
| 972 num_args.Unuse(); | 972 num_args.Unuse(); |
| 973 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL); | 973 return RawCallCodeObject(ic, RelocInfo::CONSTRUCT_CALL); |
| 974 } | 974 } |
| 975 | 975 |
| 976 | 976 |
| 977 void VirtualFrame::Drop(int count) { | 977 void VirtualFrame::Drop(int count) { |
| 978 ASSERT(height() >= count); | 978 ASSERT(height() >= count); |
| 979 int num_virtual_elements = (elements_.length() - 1) - stack_pointer_; | 979 int num_virtual_elements = (element_count() - 1) - stack_pointer_; |
| 980 | 980 |
| 981 // Emit code to lower the stack pointer if necessary. | 981 // Emit code to lower the stack pointer if necessary. |
| 982 if (num_virtual_elements < count) { | 982 if (num_virtual_elements < count) { |
| 983 int num_dropped = count - num_virtual_elements; | 983 int num_dropped = count - num_virtual_elements; |
| 984 stack_pointer_ -= num_dropped; | 984 stack_pointer_ -= num_dropped; |
| 985 __ add(Operand(esp), Immediate(num_dropped * kPointerSize)); | 985 __ add(Operand(esp), Immediate(num_dropped * kPointerSize)); |
| 986 } | 986 } |
| 987 | 987 |
| 988 // Discard elements from the virtual frame and free any registers. | 988 // Discard elements from the virtual frame and free any registers. |
| 989 for (int i = 0; i < count; i++) { | 989 for (int i = 0; i < count; i++) { |
| 990 FrameElement dropped = elements_.RemoveLast(); | 990 FrameElement dropped = elements_.RemoveLast(); |
| 991 if (dropped.is_register()) { | 991 if (dropped.is_register()) { |
| 992 Unuse(dropped.reg()); | 992 Unuse(dropped.reg()); |
| 993 } | 993 } |
| 994 } | 994 } |
| 995 } | 995 } |
| 996 | 996 |
| 997 | 997 |
| 998 Result VirtualFrame::Pop() { | 998 Result VirtualFrame::Pop() { |
| 999 FrameElement element = elements_.RemoveLast(); | 999 FrameElement element = elements_.RemoveLast(); |
| 1000 int index = elements_.length(); | 1000 int index = element_count(); |
| 1001 ASSERT(element.is_valid()); | 1001 ASSERT(element.is_valid()); |
| 1002 | 1002 |
| 1003 bool pop_needed = (stack_pointer_ == index); | 1003 bool pop_needed = (stack_pointer_ == index); |
| 1004 if (pop_needed) { | 1004 if (pop_needed) { |
| 1005 stack_pointer_--; | 1005 stack_pointer_--; |
| 1006 if (element.is_memory()) { | 1006 if (element.is_memory()) { |
| 1007 Result temp = cgen()->allocator()->Allocate(); | 1007 Result temp = cgen()->allocator()->Allocate(); |
| 1008 ASSERT(temp.is_valid()); | 1008 ASSERT(temp.is_valid()); |
| 1009 temp.set_static_type(element.static_type()); | 1009 temp.set_static_type(element.static_type()); |
| 1010 __ pop(temp.reg()); | 1010 __ pop(temp.reg()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 } else if (element.is_register()) { | 1045 } else if (element.is_register()) { |
| 1046 return Result(element.reg(), element.static_type()); | 1046 return Result(element.reg(), element.static_type()); |
| 1047 } else { | 1047 } else { |
| 1048 ASSERT(element.is_constant()); | 1048 ASSERT(element.is_constant()); |
| 1049 return Result(element.handle()); | 1049 return Result(element.handle()); |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 | 1053 |
| 1054 void VirtualFrame::EmitPop(Register reg) { | 1054 void VirtualFrame::EmitPop(Register reg) { |
| 1055 ASSERT(stack_pointer_ == elements_.length() - 1); | 1055 ASSERT(stack_pointer_ == element_count() - 1); |
| 1056 stack_pointer_--; | 1056 stack_pointer_--; |
| 1057 elements_.RemoveLast(); | 1057 elements_.RemoveLast(); |
| 1058 __ pop(reg); | 1058 __ pop(reg); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 void VirtualFrame::EmitPop(Operand operand) { | 1062 void VirtualFrame::EmitPop(Operand operand) { |
| 1063 ASSERT(stack_pointer_ == elements_.length() - 1); | 1063 ASSERT(stack_pointer_ == element_count() - 1); |
| 1064 stack_pointer_--; | 1064 stack_pointer_--; |
| 1065 elements_.RemoveLast(); | 1065 elements_.RemoveLast(); |
| 1066 __ pop(operand); | 1066 __ pop(operand); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 | 1069 |
| 1070 void VirtualFrame::EmitPush(Register reg) { | 1070 void VirtualFrame::EmitPush(Register reg) { |
| 1071 ASSERT(stack_pointer_ == elements_.length() - 1); | 1071 ASSERT(stack_pointer_ == element_count() - 1); |
| 1072 elements_.Add(FrameElement::MemoryElement()); | 1072 elements_.Add(FrameElement::MemoryElement()); |
| 1073 stack_pointer_++; | 1073 stack_pointer_++; |
| 1074 __ push(reg); | 1074 __ push(reg); |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 | 1077 |
| 1078 void VirtualFrame::EmitPush(Operand operand) { | 1078 void VirtualFrame::EmitPush(Operand operand) { |
| 1079 ASSERT(stack_pointer_ == elements_.length() - 1); | 1079 ASSERT(stack_pointer_ == element_count() - 1); |
| 1080 elements_.Add(FrameElement::MemoryElement()); | 1080 elements_.Add(FrameElement::MemoryElement()); |
| 1081 stack_pointer_++; | 1081 stack_pointer_++; |
| 1082 __ push(operand); | 1082 __ push(operand); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 | 1085 |
| 1086 void VirtualFrame::EmitPush(Immediate immediate) { | 1086 void VirtualFrame::EmitPush(Immediate immediate) { |
| 1087 ASSERT(stack_pointer_ == elements_.length() - 1); | 1087 ASSERT(stack_pointer_ == element_count() - 1); |
| 1088 elements_.Add(FrameElement::MemoryElement()); | 1088 elements_.Add(FrameElement::MemoryElement()); |
| 1089 stack_pointer_++; | 1089 stack_pointer_++; |
| 1090 __ push(immediate); | 1090 __ push(immediate); |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 | 1093 |
| 1094 #undef __ | 1094 #undef __ |
| 1095 | 1095 |
| 1096 } } // namespace v8::internal | 1096 } } // namespace v8::internal |
| OLD | NEW |