OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 8025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8036 __ mov(r2, Operand(r3, ASR, r2)); | 8036 __ mov(r2, Operand(r3, ASR, r2)); |
8037 break; | 8037 break; |
8038 case Token::SHR: | 8038 case Token::SHR: |
8039 // Use only the 5 least significant bits of the shift count. | 8039 // Use only the 5 least significant bits of the shift count. |
8040 __ and_(r2, r2, Operand(0x1f)); | 8040 __ and_(r2, r2, Operand(0x1f)); |
8041 __ mov(r2, Operand(r3, LSR, r2), SetCC); | 8041 __ mov(r2, Operand(r3, LSR, r2), SetCC); |
8042 // SHR is special because it is required to produce a positive answer. | 8042 // SHR is special because it is required to produce a positive answer. |
8043 // The code below for writing into heap numbers isn't capable of writing | 8043 // The code below for writing into heap numbers isn't capable of writing |
8044 // the register as an unsigned int so we go to slow case if we hit this | 8044 // the register as an unsigned int so we go to slow case if we hit this |
8045 // case. | 8045 // case. |
8046 __ b(mi, &slow); | 8046 if (CpuFeatures::IsSupported(VFP3)) { |
| 8047 __ b(mi, &result_not_a_smi); |
| 8048 } else { |
| 8049 __ b(mi, &slow); |
| 8050 } |
8047 break; | 8051 break; |
8048 case Token::SHL: | 8052 case Token::SHL: |
8049 // Use only the 5 least significant bits of the shift count. | 8053 // Use only the 5 least significant bits of the shift count. |
8050 __ and_(r2, r2, Operand(0x1f)); | 8054 __ and_(r2, r2, Operand(0x1f)); |
8051 __ mov(r2, Operand(r3, LSL, r2)); | 8055 __ mov(r2, Operand(r3, LSL, r2)); |
8052 break; | 8056 break; |
8053 default: UNREACHABLE(); | 8057 default: UNREACHABLE(); |
8054 } | 8058 } |
8055 // check that the *signed* result fits in a smi | 8059 // check that the *signed* result fits in a smi |
8056 __ add(r3, r2, Operand(0x40000000), SetCC); | 8060 __ add(r3, r2, Operand(0x40000000), SetCC); |
(...skipping 23 matching lines...) Expand all Loading... |
8080 default: break; | 8084 default: break; |
8081 } | 8085 } |
8082 __ bind(&got_a_heap_number); | 8086 __ bind(&got_a_heap_number); |
8083 // r2: Answer as signed int32. | 8087 // r2: Answer as signed int32. |
8084 // r5: Heap number to write answer into. | 8088 // r5: Heap number to write answer into. |
8085 | 8089 |
8086 // Nothing can go wrong now, so move the heap number to r0, which is the | 8090 // Nothing can go wrong now, so move the heap number to r0, which is the |
8087 // result. | 8091 // result. |
8088 __ mov(r0, Operand(r5)); | 8092 __ mov(r0, Operand(r5)); |
8089 | 8093 |
8090 // Tail call that writes the int32 in r2 to the heap number in r0, using | 8094 if (CpuFeatures::IsSupported(VFP3)) { |
8091 // r3 as scratch. r0 is preserved and returned. | 8095 // Convert the int32 in r2 to the heap number in r0. r3 is corrupted. |
8092 WriteInt32ToHeapNumberStub stub(r2, r0, r3); | 8096 CpuFeatures::Scope scope(VFP3); |
8093 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 8097 __ vmov(s0, r2); |
| 8098 if (op_ == Token::SHR) { |
| 8099 __ vcvt_f64_u32(d0, s0); |
| 8100 } else { |
| 8101 __ vcvt_f64_s32(d0, s0); |
| 8102 } |
| 8103 __ sub(r3, r0, Operand(kHeapObjectTag)); |
| 8104 __ vstr(d0, r3, HeapNumber::kValueOffset); |
| 8105 __ Ret(); |
| 8106 } else { |
| 8107 // Tail call that writes the int32 in r2 to the heap number in r0, using |
| 8108 // r3 as scratch. r0 is preserved and returned. |
| 8109 WriteInt32ToHeapNumberStub stub(r2, r0, r3); |
| 8110 __ TailCallStub(&stub); |
| 8111 } |
8094 | 8112 |
8095 if (mode_ != NO_OVERWRITE) { | 8113 if (mode_ != NO_OVERWRITE) { |
8096 __ bind(&have_to_allocate); | 8114 __ bind(&have_to_allocate); |
8097 // Get a new heap number in r5. r4 and r7 are scratch. | 8115 // Get a new heap number in r5. r4 and r7 are scratch. |
8098 __ AllocateHeapNumber(r5, r4, r7, heap_number_map, &slow); | 8116 __ AllocateHeapNumber(r5, r4, r7, heap_number_map, &slow); |
8099 __ jmp(&got_a_heap_number); | 8117 __ jmp(&got_a_heap_number); |
8100 } | 8118 } |
8101 | 8119 |
8102 // If all else failed then we go to the runtime system. | 8120 // If all else failed then we go to the runtime system. |
8103 __ bind(&slow); | 8121 __ bind(&slow); |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8932 | 8950 |
8933 __ bind(&try_float); | 8951 __ bind(&try_float); |
8934 if (!overwrite_) { | 8952 if (!overwrite_) { |
8935 // Allocate a fresh heap number, but don't overwrite r0 until | 8953 // Allocate a fresh heap number, but don't overwrite r0 until |
8936 // we're sure we can do it without going through the slow case | 8954 // we're sure we can do it without going through the slow case |
8937 // that needs the value in r0. | 8955 // that needs the value in r0. |
8938 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); | 8956 __ AllocateHeapNumber(r2, r3, r4, r6, &slow); |
8939 __ mov(r0, Operand(r2)); | 8957 __ mov(r0, Operand(r2)); |
8940 } | 8958 } |
8941 | 8959 |
8942 // WriteInt32ToHeapNumberStub does not trigger GC, so we do not | 8960 if (CpuFeatures::IsSupported(VFP3)) { |
8943 // have to set up a frame. | 8961 // Convert the int32 in r1 to the heap number in r0. r2 is corrupted. |
8944 WriteInt32ToHeapNumberStub stub(r1, r0, r2); | 8962 CpuFeatures::Scope scope(VFP3); |
8945 __ push(lr); | 8963 __ vmov(s0, r1); |
8946 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET); | 8964 __ vcvt_f64_s32(d0, s0); |
8947 __ pop(lr); | 8965 __ sub(r2, r0, Operand(kHeapObjectTag)); |
| 8966 __ vstr(d0, r2, HeapNumber::kValueOffset); |
| 8967 } else { |
| 8968 // WriteInt32ToHeapNumberStub does not trigger GC, so we do not |
| 8969 // have to set up a frame. |
| 8970 WriteInt32ToHeapNumberStub stub(r1, r0, r2); |
| 8971 __ push(lr); |
| 8972 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 8973 __ pop(lr); |
| 8974 } |
8948 } else { | 8975 } else { |
8949 UNIMPLEMENTED(); | 8976 UNIMPLEMENTED(); |
8950 } | 8977 } |
8951 | 8978 |
8952 __ bind(&done); | 8979 __ bind(&done); |
8953 __ StubReturn(1); | 8980 __ StubReturn(1); |
8954 | 8981 |
8955 // Handle the slow case by jumping to the JavaScript builtin. | 8982 // Handle the slow case by jumping to the JavaScript builtin. |
8956 __ bind(&slow); | 8983 __ bind(&slow); |
8957 __ push(r0); | 8984 __ push(r0); |
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11172 __ bind(&string_add_runtime); | 11199 __ bind(&string_add_runtime); |
11173 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 11200 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
11174 } | 11201 } |
11175 | 11202 |
11176 | 11203 |
11177 #undef __ | 11204 #undef __ |
11178 | 11205 |
11179 } } // namespace v8::internal | 11206 } } // namespace v8::internal |
11180 | 11207 |
11181 #endif // V8_TARGET_ARCH_ARM | 11208 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |