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 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1919 | 1919 |
1920 // Try to store the result in a heap number. | 1920 // Try to store the result in a heap number. |
1921 __ bind(&try_float); | 1921 __ bind(&try_float); |
1922 if (mode_ == UNARY_NO_OVERWRITE) { | 1922 if (mode_ == UNARY_NO_OVERWRITE) { |
1923 Label slow_allocate_heapnumber, heapnumber_allocated; | 1923 Label slow_allocate_heapnumber, heapnumber_allocated; |
1924 __ AllocateHeapNumber(r0, r2, r3, r6, &slow_allocate_heapnumber); | 1924 __ AllocateHeapNumber(r0, r2, r3, r6, &slow_allocate_heapnumber); |
1925 __ jmp(&heapnumber_allocated); | 1925 __ jmp(&heapnumber_allocated); |
1926 | 1926 |
1927 __ bind(&slow_allocate_heapnumber); | 1927 __ bind(&slow_allocate_heapnumber); |
1928 __ EnterInternalFrame(); | 1928 __ EnterInternalFrame(); |
1929 __ push(r1); | 1929 __ push(r0); // Push the heap number, not the untagged int32. |
Lasse Reichstein
2011/05/25 08:44:49
Are you sure that AllocateHeapNumber above doesn't
| |
1930 __ CallRuntime(Runtime::kNumberAlloc, 0); | 1930 __ CallRuntime(Runtime::kNumberAlloc, 0); |
1931 __ pop(r1); | 1931 // Get the heap number into r2, now that the new heap number is in r0. |
1932 __ pop(r2); | |
1932 __ LeaveInternalFrame(); | 1933 __ LeaveInternalFrame(); |
1933 | 1934 |
1935 // Convert the heap number in r2 to an untagged integer in r1. | |
1936 // This can't go slow-case because it's the same number we already | |
1937 // converted once again. | |
1938 __ ConvertToInt32(r2, r1, r3, r4, d0, slow); | |
Lasse Reichstein
2011/05/25 08:44:49
Don't forget to negate the result.
(If this isn't
| |
1939 | |
1934 __ bind(&heapnumber_allocated); | 1940 __ bind(&heapnumber_allocated); |
1935 } | 1941 } |
1936 | 1942 |
1937 if (CpuFeatures::IsSupported(VFP3)) { | 1943 if (CpuFeatures::IsSupported(VFP3)) { |
1938 // Convert the int32 in r1 to the heap number in r0. r2 is corrupted. | 1944 // Convert the int32 in r1 to the heap number in r0. r2 is corrupted. |
1939 CpuFeatures::Scope scope(VFP3); | 1945 CpuFeatures::Scope scope(VFP3); |
1940 __ vmov(s0, r1); | 1946 __ vmov(s0, r1); |
1941 __ vcvt_f64_s32(d0, s0); | 1947 __ vcvt_f64_s32(d0, s0); |
1942 __ sub(r2, r0, Operand(kHeapObjectTag)); | 1948 __ sub(r2, r0, Operand(kHeapObjectTag)); |
1943 __ vstr(d0, r2, HeapNumber::kValueOffset); | 1949 __ vstr(d0, r2, HeapNumber::kValueOffset); |
Lasse Reichstein
2011/05/25 08:44:49
Shouldn't this just be
__ vstr(d0, r0, HeapNumb
| |
1944 __ Ret(); | 1950 __ Ret(); |
1945 } else { | 1951 } else { |
1946 // WriteInt32ToHeapNumberStub does not trigger GC, so we do not | 1952 // WriteInt32ToHeapNumberStub does not trigger GC, so we do not |
1947 // have to set up a frame. | 1953 // have to set up a frame. |
1948 WriteInt32ToHeapNumberStub stub(r1, r0, r2); | 1954 WriteInt32ToHeapNumberStub stub(r1, r0, r2); |
1949 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 1955 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
1950 } | 1956 } |
1951 } | 1957 } |
1952 | 1958 |
1953 | 1959 |
(...skipping 4435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6389 __ mov(result, Operand(0)); | 6395 __ mov(result, Operand(0)); |
6390 __ Ret(); | 6396 __ Ret(); |
6391 } | 6397 } |
6392 | 6398 |
6393 | 6399 |
6394 #undef __ | 6400 #undef __ |
6395 | 6401 |
6396 } } // namespace v8::internal | 6402 } } // namespace v8::internal |
6397 | 6403 |
6398 #endif // V8_TARGET_ARCH_ARM | 6404 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |