| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 __ sub(sp, sp, Operand(difference * kPointerSize)); | 88 __ sub(sp, sp, Operand(difference * kPointerSize)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 MergeMoveRegistersToMemory(expected); | 91 MergeMoveRegistersToMemory(expected); |
| 92 MergeMoveRegistersToRegisters(expected); | 92 MergeMoveRegistersToRegisters(expected); |
| 93 MergeMoveMemoryToRegisters(expected); | 93 MergeMoveMemoryToRegisters(expected); |
| 94 | 94 |
| 95 // Fix any sync bit problems from the bottom-up, stopping when we | 95 // Fix any sync bit problems from the bottom-up, stopping when we |
| 96 // hit the stack pointer or the top of the frame if the stack | 96 // hit the stack pointer or the top of the frame if the stack |
| 97 // pointer is floating above the frame. | 97 // pointer is floating above the frame. |
| 98 int limit = Min(static_cast<int>(stack_pointer_), elements_.length() - 1); | 98 int limit = Min(static_cast<int>(stack_pointer_), element_count() - 1); |
| 99 for (int i = 0; i <= limit; i++) { | 99 for (int i = 0; i <= limit; i++) { |
| 100 FrameElement source = elements_[i]; | 100 FrameElement source = elements_[i]; |
| 101 FrameElement target = expected->elements_[i]; | 101 FrameElement target = expected->elements_[i]; |
| 102 if (source.is_synced() && !target.is_synced()) { | 102 if (source.is_synced() && !target.is_synced()) { |
| 103 elements_[i].clear_sync(); | 103 elements_[i].clear_sync(); |
| 104 } else if (!source.is_synced() && target.is_synced()) { | 104 } else if (!source.is_synced() && target.is_synced()) { |
| 105 SyncElementAt(i); | 105 SyncElementAt(i); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) { | 121 void VirtualFrame::MergeMoveRegistersToMemory(VirtualFrame* expected) { |
| 122 ASSERT(stack_pointer_ >= expected->stack_pointer_); | 122 ASSERT(stack_pointer_ >= expected->stack_pointer_); |
| 123 | 123 |
| 124 // Move registers, constants, and copies to memory. Perform moves | 124 // Move registers, constants, and copies to memory. Perform moves |
| 125 // from the top downward in the frame in order to leave the backing | 125 // from the top downward in the frame in order to leave the backing |
| 126 // stores of copies in registers. | 126 // stores of copies in registers. |
| 127 // On ARM, all elements are in memory. | 127 // On ARM, all elements are in memory. |
| 128 | 128 |
| 129 #ifdef DEBUG | 129 #ifdef DEBUG |
| 130 int start = Min(static_cast<int>(stack_pointer_), elements_.length() - 1); | 130 int start = Min(static_cast<int>(stack_pointer_), element_count() - 1); |
| 131 for (int i = start; i >= 0; i--) { | 131 for (int i = start; i >= 0; i--) { |
| 132 ASSERT(elements_[i].is_memory()); | 132 ASSERT(elements_[i].is_memory()); |
| 133 ASSERT(expected->elements_[i].is_memory()); | 133 ASSERT(expected->elements_[i].is_memory()); |
| 134 } | 134 } |
| 135 #endif | 135 #endif |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) { | 139 void VirtualFrame::MergeMoveRegistersToRegisters(VirtualFrame* expected) { |
| 140 } | 140 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 385 } |
| 386 PrepareForCall(spilled_args, dropped_args); | 386 PrepareForCall(spilled_args, dropped_args); |
| 387 arg0->Unuse(); | 387 arg0->Unuse(); |
| 388 arg1->Unuse(); | 388 arg1->Unuse(); |
| 389 return RawCallCodeObject(code, rmode); | 389 return RawCallCodeObject(code, rmode); |
| 390 } | 390 } |
| 391 | 391 |
| 392 | 392 |
| 393 void VirtualFrame::Drop(int count) { | 393 void VirtualFrame::Drop(int count) { |
| 394 ASSERT(height() >= count); | 394 ASSERT(height() >= count); |
| 395 int num_virtual_elements = (elements_.length() - 1) - stack_pointer_; | 395 int num_virtual_elements = (element_count() - 1) - stack_pointer_; |
| 396 | 396 |
| 397 // Emit code to lower the stack pointer if necessary. | 397 // Emit code to lower the stack pointer if necessary. |
| 398 if (num_virtual_elements < count) { | 398 if (num_virtual_elements < count) { |
| 399 int num_dropped = count - num_virtual_elements; | 399 int num_dropped = count - num_virtual_elements; |
| 400 stack_pointer_ -= num_dropped; | 400 stack_pointer_ -= num_dropped; |
| 401 __ add(sp, sp, Operand(num_dropped * kPointerSize)); | 401 __ add(sp, sp, Operand(num_dropped * kPointerSize)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // Discard elements from the virtual frame and free any registers. | 404 // Discard elements from the virtual frame and free any registers. |
| 405 for (int i = 0; i < count; i++) { | 405 for (int i = 0; i < count; i++) { |
| 406 FrameElement dropped = elements_.RemoveLast(); | 406 FrameElement dropped = elements_.RemoveLast(); |
| 407 if (dropped.is_register()) { | 407 if (dropped.is_register()) { |
| 408 Unuse(dropped.reg()); | 408 Unuse(dropped.reg()); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 | 412 |
| 413 | 413 |
| 414 Result VirtualFrame::Pop() { | 414 Result VirtualFrame::Pop() { |
| 415 UNIMPLEMENTED(); | 415 UNIMPLEMENTED(); |
| 416 return Result(); | 416 return Result(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 | 419 |
| 420 void VirtualFrame::EmitPop(Register reg) { | 420 void VirtualFrame::EmitPop(Register reg) { |
| 421 ASSERT(stack_pointer_ == elements_.length() - 1); | 421 ASSERT(stack_pointer_ == element_count() - 1); |
| 422 stack_pointer_--; | 422 stack_pointer_--; |
| 423 elements_.RemoveLast(); | 423 elements_.RemoveLast(); |
| 424 __ pop(reg); | 424 __ pop(reg); |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void VirtualFrame::EmitPush(Register reg) { | 428 void VirtualFrame::EmitPush(Register reg) { |
| 429 ASSERT(stack_pointer_ == elements_.length() - 1); | 429 ASSERT(stack_pointer_ == element_count() - 1); |
| 430 elements_.Add(FrameElement::MemoryElement()); | 430 elements_.Add(FrameElement::MemoryElement()); |
| 431 stack_pointer_++; | 431 stack_pointer_++; |
| 432 __ push(reg); | 432 __ push(reg); |
| 433 } | 433 } |
| 434 | 434 |
| 435 | 435 |
| 436 #undef __ | 436 #undef __ |
| 437 | 437 |
| 438 } } // namespace v8::internal | 438 } } // namespace v8::internal |
| OLD | NEW |