| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 const char* GetName() { return "ConvertToDoubleStub"; } | 302 const char* GetName() { return "ConvertToDoubleStub"; } |
| 303 | 303 |
| 304 #ifdef DEBUG | 304 #ifdef DEBUG |
| 305 void Print() { PrintF("ConvertToDoubleStub\n"); } | 305 void Print() { PrintF("ConvertToDoubleStub\n"); } |
| 306 #endif | 306 #endif |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 | 309 |
| 310 void ConvertToDoubleStub::Generate(MacroAssembler* masm) { | 310 void ConvertToDoubleStub::Generate(MacroAssembler* masm) { |
| 311 #ifndef BIG_ENDIAN_FLOATING_POINT | |
| 312 Register exponent = result1_; | |
| 313 Register mantissa = result2_; | |
| 314 #else | |
| 315 Register exponent = result2_; | 311 Register exponent = result2_; |
| 316 Register mantissa = result1_; | 312 Register mantissa = result1_; |
| 317 #endif | 313 |
| 318 Label not_special; | 314 Label not_special; |
| 319 // Convert from Smi to integer. | 315 // Convert from Smi to integer. |
| 320 __ mov(source_, Operand(source_, ASR, kSmiTagSize)); | 316 __ mov(source_, Operand(source_, ASR, kSmiTagSize)); |
| 321 // Move sign bit from source to destination. This works because the sign bit | 317 // Move sign bit from source to destination. This works because the sign bit |
| 322 // in the exponent word of the double has the same position and polarity as | 318 // in the exponent word of the double has the same position and polarity as |
| 323 // the 2's complement sign bit in a Smi. | 319 // the 2's complement sign bit in a Smi. |
| 324 STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u); | 320 STATIC_ASSERT(HeapNumber::kSignMask == 0x80000000u); |
| 325 __ and_(exponent, source_, Operand(HeapNumber::kSignMask), SetCC); | 321 __ and_(exponent, source_, Operand(HeapNumber::kSignMask), SetCC); |
| 326 // Subtract from 0 if source was negative. | 322 // Subtract from 0 if source was negative. |
| 327 __ rsb(source_, source_, Operand(0, RelocInfo::NONE), LeaveCC, ne); | 323 __ rsb(source_, source_, Operand(0, RelocInfo::NONE), LeaveCC, ne); |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 // We currently always use r5 to pass it. | 940 // We currently always use r5 to pass it. |
| 945 ASSERT(heap_number_result.is(r5)); | 941 ASSERT(heap_number_result.is(r5)); |
| 946 | 942 |
| 947 // Push the current return address before the C call. Return will be | 943 // Push the current return address before the C call. Return will be |
| 948 // through pop(pc) below. | 944 // through pop(pc) below. |
| 949 __ push(lr); | 945 __ push(lr); |
| 950 __ PrepareCallCFunction(4, scratch); // Two doubles are 4 arguments. | 946 __ PrepareCallCFunction(4, scratch); // Two doubles are 4 arguments. |
| 951 // Call C routine that may not cause GC or other trouble. | 947 // Call C routine that may not cause GC or other trouble. |
| 952 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()), | 948 __ CallCFunction(ExternalReference::double_fp_operation(op, masm->isolate()), |
| 953 4); | 949 4); |
| 954 // Store answer in the overwritable heap number. | 950 // Store answer in the overwritable heap number. Double returned in |
| 955 #if !defined(USE_ARM_EABI) | 951 // registers r0 and r1. |
| 956 // Double returned in fp coprocessor register 0 and 1, encoded as | |
| 957 // register cr8. Offsets must be divisible by 4 for coprocessor so we | |
| 958 // need to substract the tag from heap_number_result. | |
| 959 __ sub(scratch, heap_number_result, Operand(kHeapObjectTag)); | |
| 960 __ stc(p1, cr8, MemOperand(scratch, HeapNumber::kValueOffset)); | |
| 961 #else | |
| 962 // Double returned in registers 0 and 1. | |
| 963 __ Strd(r0, r1, FieldMemOperand(heap_number_result, | 952 __ Strd(r0, r1, FieldMemOperand(heap_number_result, |
| 964 HeapNumber::kValueOffset)); | 953 HeapNumber::kValueOffset)); |
| 965 #endif | |
| 966 // Place heap_number_result in r0 and return to the pushed return address. | 954 // Place heap_number_result in r0 and return to the pushed return address. |
| 967 __ mov(r0, Operand(heap_number_result)); | 955 __ mov(r0, Operand(heap_number_result)); |
| 968 __ pop(pc); | 956 __ pop(pc); |
| 969 } | 957 } |
| 970 | 958 |
| 971 | 959 |
| 972 // See comment for class. | 960 // See comment for class. |
| 973 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { | 961 void WriteInt32ToHeapNumberStub::Generate(MacroAssembler* masm) { |
| 974 Label max_negative_int; | 962 Label max_negative_int; |
| 975 // the_int_ has the answer which is a signed int32 but not a Smi. | 963 // the_int_ has the answer which is a signed int32 but not a Smi. |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 // r2: Right value (least significant part of mantissa). | 2028 // r2: Right value (least significant part of mantissa). |
| 2041 // r3: Right value (sign, exponent, top of mantissa). | 2029 // r3: Right value (sign, exponent, top of mantissa). |
| 2042 // r5: Address of heap number for result. | 2030 // r5: Address of heap number for result. |
| 2043 | 2031 |
| 2044 __ push(lr); // For later. | 2032 __ push(lr); // For later. |
| 2045 __ PrepareCallCFunction(4, r4); // Two doubles count as 4 arguments. | 2033 __ PrepareCallCFunction(4, r4); // Two doubles count as 4 arguments. |
| 2046 // Call C routine that may not cause GC or other trouble. r5 is callee | 2034 // Call C routine that may not cause GC or other trouble. r5 is callee |
| 2047 // save. | 2035 // save. |
| 2048 __ CallCFunction( | 2036 __ CallCFunction( |
| 2049 ExternalReference::double_fp_operation(op_, masm->isolate()), 4); | 2037 ExternalReference::double_fp_operation(op_, masm->isolate()), 4); |
| 2050 // Store answer in the overwritable heap number. | 2038 // Store answer in the overwritable heap number. Double |
| 2051 #if !defined(USE_ARM_EABI) | 2039 // returned in registers r0 and r1. |
| 2052 // Double returned in fp coprocessor register 0 and 1, encoded as | |
| 2053 // register cr8. Offsets must be divisible by 4 for coprocessor so we | |
| 2054 // need to substract the tag from r5. | |
| 2055 __ sub(r4, r5, Operand(kHeapObjectTag)); | |
| 2056 __ stc(p1, cr8, MemOperand(r4, HeapNumber::kValueOffset)); | |
| 2057 #else | |
| 2058 // Double returned in registers 0 and 1. | |
| 2059 __ Strd(r0, r1, FieldMemOperand(r5, HeapNumber::kValueOffset)); | 2040 __ Strd(r0, r1, FieldMemOperand(r5, HeapNumber::kValueOffset)); |
| 2060 #endif | |
| 2061 __ mov(r0, Operand(r5)); | 2041 __ mov(r0, Operand(r5)); |
| 2062 // And we are done. | 2042 // And we are done. |
| 2063 __ pop(pc); | 2043 __ pop(pc); |
| 2064 } | 2044 } |
| 2065 } | 2045 } |
| 2066 } | 2046 } |
| 2067 | 2047 |
| 2068 if (!generate_code_to_calculate_answer && | 2048 if (!generate_code_to_calculate_answer && |
| 2069 !slow_reverse.is_linked() && | 2049 !slow_reverse.is_linked() && |
| 2070 !slow.is_linked()) { | 2050 !slow.is_linked()) { |
| (...skipping 4861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6932 __ str(pc, MemOperand(sp, 0)); | 6912 __ str(pc, MemOperand(sp, 0)); |
| 6933 __ Jump(target); // Call the C++ function. | 6913 __ Jump(target); // Call the C++ function. |
| 6934 } | 6914 } |
| 6935 | 6915 |
| 6936 | 6916 |
| 6937 #undef __ | 6917 #undef __ |
| 6938 | 6918 |
| 6939 } } // namespace v8::internal | 6919 } } // namespace v8::internal |
| 6940 | 6920 |
| 6941 #endif // V8_TARGET_ARCH_ARM | 6921 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |