OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 __ Branch(&error, ne, scratch, Operand(zero_reg)); | 175 __ Branch(&error, ne, scratch, Operand(zero_reg)); |
176 __ Move(result_reg, scratch3); | 176 __ Move(result_reg, scratch3); |
177 __ Branch(&done); | 177 __ Branch(&done); |
178 __ bind(&error); | 178 __ bind(&error); |
179 } | 179 } |
180 | 180 |
181 // Load the double value and perform a manual truncation. | 181 // Load the double value and perform a manual truncation. |
182 Register input_high = scratch2; | 182 Register input_high = scratch2; |
183 Register input_low = scratch3; | 183 Register input_low = scratch3; |
184 | 184 |
185 __ lw(input_low, MemOperand(input_reg, double_offset)); | 185 __ lw(input_low, |
186 __ lw(input_high, MemOperand(input_reg, double_offset + kIntSize)); | 186 MemOperand(input_reg, double_offset + Register::kMantissaOffset)); |
| 187 __ lw(input_high, |
| 188 MemOperand(input_reg, double_offset + Register::kExponentOffset)); |
187 | 189 |
188 Label normal_exponent, restore_sign; | 190 Label normal_exponent, restore_sign; |
189 // Extract the biased exponent in result. | 191 // Extract the biased exponent in result. |
190 __ Ext(result_reg, | 192 __ Ext(result_reg, |
191 input_high, | 193 input_high, |
192 HeapNumber::kExponentShift, | 194 HeapNumber::kExponentShift, |
193 HeapNumber::kExponentBits); | 195 HeapNumber::kExponentBits); |
194 | 196 |
195 // Check for Infinity and NaNs, which should return 0. | 197 // Check for Infinity and NaNs, which should return 0. |
196 __ Subu(scratch, result_reg, HeapNumber::kExponentMask); | 198 __ Subu(scratch, result_reg, HeapNumber::kExponentMask); |
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3302 // a0: object | 3304 // a0: object |
3303 // a1: instance type. | 3305 // a1: instance type. |
3304 __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); | 3306 __ Branch(¬_heap_number, ne, a1, Operand(HEAP_NUMBER_TYPE)); |
3305 __ Ret(USE_DELAY_SLOT); | 3307 __ Ret(USE_DELAY_SLOT); |
3306 __ mov(v0, a0); | 3308 __ mov(v0, a0); |
3307 __ bind(¬_heap_number); | 3309 __ bind(¬_heap_number); |
3308 | 3310 |
3309 Label not_string, slow_string; | 3311 Label not_string, slow_string; |
3310 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); | 3312 __ Branch(¬_string, hs, a1, Operand(FIRST_NONSTRING_TYPE)); |
3311 // Check if string has a cached array index. | 3313 // Check if string has a cached array index. |
3312 __ ld(a2, FieldMemOperand(a0, String::kHashFieldOffset)); | 3314 __ lwu(a2, FieldMemOperand(a0, String::kHashFieldOffset)); |
3313 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); | 3315 __ And(at, a2, Operand(String::kContainsCachedArrayIndexMask)); |
3314 __ Branch(&slow_string, ne, at, Operand(zero_reg)); | 3316 __ Branch(&slow_string, ne, at, Operand(zero_reg)); |
3315 __ IndexFromHash(a2, a0); | 3317 __ IndexFromHash(a2, a0); |
3316 __ Ret(USE_DELAY_SLOT); | 3318 __ Ret(USE_DELAY_SLOT); |
3317 __ mov(v0, a0); | 3319 __ mov(v0, a0); |
3318 __ bind(&slow_string); | 3320 __ bind(&slow_string); |
3319 __ push(a0); // Push argument. | 3321 __ push(a0); // Push argument. |
3320 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); | 3322 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
3321 __ bind(¬_string); | 3323 __ bind(¬_string); |
3322 | 3324 |
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5595 // ----------- S t a t e ------------- | 5597 // ----------- S t a t e ------------- |
5596 // -- a0 : callee | 5598 // -- a0 : callee |
5597 // -- a4 : call_data | 5599 // -- a4 : call_data |
5598 // -- a2 : holder | 5600 // -- a2 : holder |
5599 // -- a1 : api_function_address | 5601 // -- a1 : api_function_address |
5600 // -- a3 : number of arguments if argc is a register | 5602 // -- a3 : number of arguments if argc is a register |
5601 // -- cp : context | 5603 // -- cp : context |
5602 // -- | 5604 // -- |
5603 // -- sp[0] : last argument | 5605 // -- sp[0] : last argument |
5604 // -- ... | 5606 // -- ... |
5605 // -- sp[(argc - 1)* 4] : first argument | 5607 // -- sp[(argc - 1)* 8] : first argument |
5606 // -- sp[argc * 4] : receiver | 5608 // -- sp[argc * 8] : receiver |
5607 // ----------------------------------- | 5609 // ----------------------------------- |
5608 | 5610 |
5609 Register callee = a0; | 5611 Register callee = a0; |
5610 Register call_data = a4; | 5612 Register call_data = a4; |
5611 Register holder = a2; | 5613 Register holder = a2; |
5612 Register api_function_address = a1; | 5614 Register api_function_address = a1; |
5613 Register context = cp; | 5615 Register context = cp; |
5614 | 5616 |
5615 typedef FunctionCallbackArguments FCA; | 5617 typedef FunctionCallbackArguments FCA; |
5616 | 5618 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5655 // Arguments is after the return address. | 5657 // Arguments is after the return address. |
5656 __ Daddu(a0, sp, Operand(1 * kPointerSize)); | 5658 __ Daddu(a0, sp, Operand(1 * kPointerSize)); |
5657 // FunctionCallbackInfo::implicit_args_ | 5659 // FunctionCallbackInfo::implicit_args_ |
5658 __ sd(scratch, MemOperand(a0, 0 * kPointerSize)); | 5660 __ sd(scratch, MemOperand(a0, 0 * kPointerSize)); |
5659 if (argc.is_immediate()) { | 5661 if (argc.is_immediate()) { |
5660 // FunctionCallbackInfo::values_ | 5662 // FunctionCallbackInfo::values_ |
5661 __ Daddu(at, scratch, | 5663 __ Daddu(at, scratch, |
5662 Operand((FCA::kArgsLength - 1 + argc.immediate()) * kPointerSize)); | 5664 Operand((FCA::kArgsLength - 1 + argc.immediate()) * kPointerSize)); |
5663 __ sd(at, MemOperand(a0, 1 * kPointerSize)); | 5665 __ sd(at, MemOperand(a0, 1 * kPointerSize)); |
5664 // FunctionCallbackInfo::length_ = argc | 5666 // FunctionCallbackInfo::length_ = argc |
| 5667 // Stored as int field, 32-bit integers within struct on stack always left |
| 5668 // justified by n64 ABI. |
5665 __ li(at, Operand(argc.immediate())); | 5669 __ li(at, Operand(argc.immediate())); |
5666 __ sd(at, MemOperand(a0, 2 * kPointerSize)); | 5670 __ sw(at, MemOperand(a0, 2 * kPointerSize)); |
5667 // FunctionCallbackInfo::is_construct_call_ = 0 | 5671 // FunctionCallbackInfo::is_construct_call_ = 0 |
5668 __ sd(zero_reg, MemOperand(a0, 3 * kPointerSize)); | 5672 __ sw(zero_reg, MemOperand(a0, 2 * kPointerSize + kIntSize)); |
5669 } else { | 5673 } else { |
5670 // FunctionCallbackInfo::values_ | 5674 // FunctionCallbackInfo::values_ |
5671 __ dsll(at, argc.reg(), kPointerSizeLog2); | 5675 __ dsll(at, argc.reg(), kPointerSizeLog2); |
5672 __ Daddu(at, at, scratch); | 5676 __ Daddu(at, at, scratch); |
5673 __ Daddu(at, at, Operand((FCA::kArgsLength - 1) * kPointerSize)); | 5677 __ Daddu(at, at, Operand((FCA::kArgsLength - 1) * kPointerSize)); |
5674 __ sd(at, MemOperand(a0, 1 * kPointerSize)); | 5678 __ sd(at, MemOperand(a0, 1 * kPointerSize)); |
5675 // FunctionCallbackInfo::length_ = argc | 5679 // FunctionCallbackInfo::length_ = argc |
5676 __ sd(argc.reg(), MemOperand(a0, 2 * kPointerSize)); | 5680 // Stored as int field, 32-bit integers within struct on stack always left |
| 5681 // justified by n64 ABI. |
| 5682 __ sw(argc.reg(), MemOperand(a0, 2 * kPointerSize)); |
5677 // FunctionCallbackInfo::is_construct_call_ | 5683 // FunctionCallbackInfo::is_construct_call_ |
5678 __ Daddu(argc.reg(), argc.reg(), Operand(FCA::kArgsLength + 1)); | 5684 __ Daddu(argc.reg(), argc.reg(), Operand(FCA::kArgsLength + 1)); |
5679 __ dsll(at, argc.reg(), kPointerSizeLog2); | 5685 __ dsll(at, argc.reg(), kPointerSizeLog2); |
5680 __ sd(at, MemOperand(a0, 3 * kPointerSize)); | 5686 __ sw(at, MemOperand(a0, 2 * kPointerSize + kIntSize)); |
5681 } | 5687 } |
5682 | 5688 |
5683 ExternalReference thunk_ref = | 5689 ExternalReference thunk_ref = |
5684 ExternalReference::invoke_function_callback(masm->isolate()); | 5690 ExternalReference::invoke_function_callback(masm->isolate()); |
5685 | 5691 |
5686 AllowExternalCallThatCantCauseGC scope(masm); | 5692 AllowExternalCallThatCantCauseGC scope(masm); |
5687 MemOperand context_restore_operand( | 5693 MemOperand context_restore_operand( |
5688 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 5694 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
5689 // Stores return the first js argument. | 5695 // Stores return the first js argument. |
5690 int return_value_offset = 0; | 5696 int return_value_offset = 0; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5754 MemOperand(fp, 6 * kPointerSize), NULL); | 5760 MemOperand(fp, 6 * kPointerSize), NULL); |
5755 } | 5761 } |
5756 | 5762 |
5757 | 5763 |
5758 #undef __ | 5764 #undef __ |
5759 | 5765 |
5760 } // namespace internal | 5766 } // namespace internal |
5761 } // namespace v8 | 5767 } // namespace v8 |
5762 | 5768 |
5763 #endif // V8_TARGET_ARCH_MIPS64 | 5769 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |