OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 size += 3; // Need full four-byte displacement in lea. | 143 size += 3; // Need full four-byte displacement in lea. |
144 } | 144 } |
145 return size; | 145 return size; |
146 } | 146 } |
147 } | 147 } |
148 // Size of movq(destination, src); | 148 // Size of movq(destination, src); |
149 return 10; | 149 return 10; |
150 } | 150 } |
151 | 151 |
152 | 152 |
| 153 void MacroAssembler::PushAddress(ExternalReference source) { |
| 154 int64_t address = reinterpret_cast<int64_t>(source.address()); |
| 155 if (is_int32(address) && !Serializer::enabled()) { |
| 156 if (emit_debug_code()) { |
| 157 movq(kScratchRegister, BitCast<int64_t>(kZapValue), RelocInfo::NONE); |
| 158 } |
| 159 push(Immediate(static_cast<int32_t>(address))); |
| 160 return; |
| 161 } |
| 162 LoadAddress(kScratchRegister, source); |
| 163 push(kScratchRegister); |
| 164 } |
| 165 |
| 166 |
153 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { | 167 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { |
154 ASSERT(root_array_available_); | 168 ASSERT(root_array_available_); |
155 movq(destination, Operand(kRootRegister, | 169 movq(destination, Operand(kRootRegister, |
156 (index << kPointerSizeLog2) - kRootRegisterBias)); | 170 (index << kPointerSizeLog2) - kRootRegisterBias)); |
157 } | 171 } |
158 | 172 |
159 | 173 |
160 void MacroAssembler::LoadRootIndexed(Register destination, | 174 void MacroAssembler::LoadRootIndexed(Register destination, |
161 Register variable_offset, | 175 Register variable_offset, |
162 int fixed_offset) { | 176 int fixed_offset) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 664 |
651 static int Offset(ExternalReference ref0, ExternalReference ref1) { | 665 static int Offset(ExternalReference ref0, ExternalReference ref1) { |
652 int64_t offset = (ref0.address() - ref1.address()); | 666 int64_t offset = (ref0.address() - ref1.address()); |
653 // Check that fits into int. | 667 // Check that fits into int. |
654 ASSERT(static_cast<int>(offset) == offset); | 668 ASSERT(static_cast<int>(offset) == offset); |
655 return static_cast<int>(offset); | 669 return static_cast<int>(offset); |
656 } | 670 } |
657 | 671 |
658 | 672 |
659 void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { | 673 void MacroAssembler::PrepareCallApiFunction(int arg_stack_space) { |
660 #ifdef _WIN64 | 674 #if defined(_WIN64) && !defined(__MINGW64__) |
661 // We need to prepare a slot for result handle on stack and put | 675 // We need to prepare a slot for result handle on stack and put |
662 // a pointer to it into 1st arg register. | 676 // a pointer to it into 1st arg register. |
663 EnterApiExitFrame(arg_stack_space + 1); | 677 EnterApiExitFrame(arg_stack_space + 1); |
664 | 678 |
665 // rcx must be used to pass the pointer to the return value slot. | 679 // rcx must be used to pass the pointer to the return value slot. |
666 lea(rcx, StackSpaceOperand(arg_stack_space)); | 680 lea(rcx, StackSpaceOperand(arg_stack_space)); |
667 #else | 681 #else |
668 EnterApiExitFrame(arg_stack_space); | 682 EnterApiExitFrame(arg_stack_space); |
669 #endif | 683 #endif |
670 } | 684 } |
(...skipping 27 matching lines...) Expand all Loading... |
698 Register base_reg = r15; | 712 Register base_reg = r15; |
699 movq(base_reg, next_address); | 713 movq(base_reg, next_address); |
700 movq(prev_next_address_reg, Operand(base_reg, kNextOffset)); | 714 movq(prev_next_address_reg, Operand(base_reg, kNextOffset)); |
701 movq(prev_limit_reg, Operand(base_reg, kLimitOffset)); | 715 movq(prev_limit_reg, Operand(base_reg, kLimitOffset)); |
702 addl(Operand(base_reg, kLevelOffset), Immediate(1)); | 716 addl(Operand(base_reg, kLevelOffset), Immediate(1)); |
703 // Call the api function! | 717 // Call the api function! |
704 movq(rax, reinterpret_cast<int64_t>(function_address), | 718 movq(rax, reinterpret_cast<int64_t>(function_address), |
705 RelocInfo::RUNTIME_ENTRY); | 719 RelocInfo::RUNTIME_ENTRY); |
706 call(rax); | 720 call(rax); |
707 | 721 |
708 #ifdef _WIN64 | 722 #if defined(_WIN64) && !defined(__MINGW64__) |
709 // rax keeps a pointer to v8::Handle, unpack it. | 723 // rax keeps a pointer to v8::Handle, unpack it. |
710 movq(rax, Operand(rax, 0)); | 724 movq(rax, Operand(rax, 0)); |
711 #endif | 725 #endif |
712 // Check if the result handle holds 0. | 726 // Check if the result handle holds 0. |
713 testq(rax, rax); | 727 testq(rax, rax); |
714 j(zero, &empty_result); | 728 j(zero, &empty_result); |
715 // It was non-zero. Dereference to get the result value. | 729 // It was non-zero. Dereference to get the result value. |
716 movq(rax, Operand(rax, 0)); | 730 movq(rax, Operand(rax, 0)); |
717 bind(&prologue); | 731 bind(&prologue); |
718 | 732 |
(...skipping 3703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4422 bind(&check_prototype); | 4436 bind(&check_prototype); |
4423 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4437 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4424 cmpq(rcx, null_value); | 4438 cmpq(rcx, null_value); |
4425 j(not_equal, &next); | 4439 j(not_equal, &next); |
4426 } | 4440 } |
4427 | 4441 |
4428 | 4442 |
4429 } } // namespace v8::internal | 4443 } } // namespace v8::internal |
4430 | 4444 |
4431 #endif // V8_TARGET_ARCH_X64 | 4445 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |