Chromium Code Reviews| 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1291 // tagged as a small integer. | 1291 // tagged as a small integer. |
| 1292 __ InvokeBuiltin(native, JUMP_JS); | 1292 __ InvokeBuiltin(native, JUMP_JS); |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 | 1295 |
| 1296 // This stub does not handle the inlined cases (Smis, Booleans, undefined). | 1296 // This stub does not handle the inlined cases (Smis, Booleans, undefined). |
| 1297 // The stub returns zero for false, and a non-zero value for true. | 1297 // The stub returns zero for false, and a non-zero value for true. |
| 1298 void ToBooleanStub::Generate(MacroAssembler* masm) { | 1298 void ToBooleanStub::Generate(MacroAssembler* masm) { |
| 1299 Label false_result; | 1299 Label false_result; |
| 1300 Label not_heap_number; | 1300 Label not_heap_number; |
| 1301 Register scratch = r7; | 1301 Register scratch = r9; |
|
Alexandre
2011/02/09 13:57:16
Is this more readable?
Register scratch = r9.is(to
Søren Thygesen Gjesse
2011/02/09 14:48:28
Done.
| |
| 1302 if (scratch.is(tos_)) { | |
| 1303 scratch = r7; | |
| 1304 } | |
| 1305 ASSERT(!tos_.is(scratch)); | |
| 1302 | 1306 |
| 1303 __ LoadRoot(ip, Heap::kNullValueRootIndex); | 1307 __ LoadRoot(ip, Heap::kNullValueRootIndex); |
| 1304 __ cmp(tos_, ip); | 1308 __ cmp(tos_, ip); |
| 1305 __ b(eq, &false_result); | 1309 __ b(eq, &false_result); |
| 1306 | 1310 |
| 1307 // HeapNumber => false iff +0, -0, or NaN. | 1311 // HeapNumber => false iff +0, -0, or NaN. |
| 1308 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); | 1312 __ ldr(scratch, FieldMemOperand(tos_, HeapObject::kMapOffset)); |
| 1309 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 1313 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 1310 __ cmp(scratch, ip); | 1314 __ cmp(scratch, ip); |
| 1311 __ b(¬_heap_number, ne); | 1315 __ b(¬_heap_number, ne); |
| (...skipping 4490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5802 ASSERT(state_ == CompareIC::SMIS); | 5806 ASSERT(state_ == CompareIC::SMIS); |
| 5803 Label miss; | 5807 Label miss; |
| 5804 __ orr(r2, r1, r0); | 5808 __ orr(r2, r1, r0); |
| 5805 __ tst(r2, Operand(kSmiTagMask)); | 5809 __ tst(r2, Operand(kSmiTagMask)); |
| 5806 __ b(ne, &miss); | 5810 __ b(ne, &miss); |
| 5807 | 5811 |
| 5808 if (GetCondition() == eq) { | 5812 if (GetCondition() == eq) { |
| 5809 // For equality we do not care about the sign of the result. | 5813 // For equality we do not care about the sign of the result. |
| 5810 __ sub(r0, r0, r1, SetCC); | 5814 __ sub(r0, r0, r1, SetCC); |
| 5811 } else { | 5815 } else { |
| 5812 __ sub(r1, r1, r0, SetCC); | 5816 // Untag before subtracting to avoid handling overflow. |
| 5813 // Correct sign of result in case of overflow. | 5817 __ SmiUntag(r1); |
| 5814 __ rsb(r1, r1, Operand(0), SetCC, vs); | 5818 __ sub(r0, r1, SmiUntagOperand(r0)); |
| 5815 __ mov(r0, r1); | |
| 5816 } | 5819 } |
| 5817 __ Ret(); | 5820 __ Ret(); |
| 5818 | 5821 |
| 5819 __ bind(&miss); | 5822 __ bind(&miss); |
| 5820 GenerateMiss(masm); | 5823 GenerateMiss(masm); |
| 5821 } | 5824 } |
| 5822 | 5825 |
| 5823 | 5826 |
| 5824 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { | 5827 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { |
| 5825 ASSERT(state_ == CompareIC::HEAP_NUMBERS); | 5828 ASSERT(state_ == CompareIC::HEAP_NUMBERS); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5996 __ SmiTag(r0, scratch1); | 5999 __ SmiTag(r0, scratch1); |
| 5997 __ Ret(); | 6000 __ Ret(); |
| 5998 } | 6001 } |
| 5999 | 6002 |
| 6000 | 6003 |
| 6001 #undef __ | 6004 #undef __ |
| 6002 | 6005 |
| 6003 } } // namespace v8::internal | 6006 } } // namespace v8::internal |
| 6004 | 6007 |
| 6005 #endif // V8_TARGET_ARCH_ARM | 6008 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |