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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 Label is_smi; | 1362 Label is_smi; |
1363 Label load_result_from_cache; | 1363 Label load_result_from_cache; |
1364 if (!object_is_smi) { | 1364 if (!object_is_smi) { |
1365 __ JumpIfSmi(object, &is_smi); | 1365 __ JumpIfSmi(object, &is_smi); |
1366 if (CpuFeatures::IsSupported(VFP3)) { | 1366 if (CpuFeatures::IsSupported(VFP3)) { |
1367 CpuFeatures::Scope scope(VFP3); | 1367 CpuFeatures::Scope scope(VFP3); |
1368 __ CheckMap(object, | 1368 __ CheckMap(object, |
1369 scratch1, | 1369 scratch1, |
1370 Heap::kHeapNumberMapRootIndex, | 1370 Heap::kHeapNumberMapRootIndex, |
1371 not_found, | 1371 not_found, |
1372 true); | 1372 DONT_DO_SMI_CHECK); |
1373 | 1373 |
1374 STATIC_ASSERT(8 == kDoubleSize); | 1374 STATIC_ASSERT(8 == kDoubleSize); |
1375 __ add(scratch1, | 1375 __ add(scratch1, |
1376 object, | 1376 object, |
1377 Operand(HeapNumber::kValueOffset - kHeapObjectTag)); | 1377 Operand(HeapNumber::kValueOffset - kHeapObjectTag)); |
1378 __ ldm(ia, scratch1, scratch1.bit() | scratch2.bit()); | 1378 __ ldm(ia, scratch1, scratch1.bit() | scratch2.bit()); |
1379 __ eor(scratch1, scratch1, Operand(scratch2)); | 1379 __ eor(scratch1, scratch1, Operand(scratch2)); |
1380 __ and_(scratch1, scratch1, Operand(mask)); | 1380 __ and_(scratch1, scratch1, Operand(mask)); |
1381 | 1381 |
1382 // Calculate address of entry in string cache: each entry consists | 1382 // Calculate address of entry in string cache: each entry consists |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 // of the double into r2, r3. | 3014 // of the double into r2, r3. |
3015 __ IntegerToDoubleConversionWithVFP3(r0, r3, r2); | 3015 __ IntegerToDoubleConversionWithVFP3(r0, r3, r2); |
3016 __ b(&loaded); | 3016 __ b(&loaded); |
3017 | 3017 |
3018 __ bind(&input_not_smi); | 3018 __ bind(&input_not_smi); |
3019 // Check if input is a HeapNumber. | 3019 // Check if input is a HeapNumber. |
3020 __ CheckMap(r0, | 3020 __ CheckMap(r0, |
3021 r1, | 3021 r1, |
3022 Heap::kHeapNumberMapRootIndex, | 3022 Heap::kHeapNumberMapRootIndex, |
3023 &calculate, | 3023 &calculate, |
3024 true); | 3024 DONT_DO_SMI_CHECK); |
3025 // Input is a HeapNumber. Load it to a double register and store the | 3025 // Input is a HeapNumber. Load it to a double register and store the |
3026 // low and high words into r2, r3. | 3026 // low and high words into r2, r3. |
3027 __ vldr(d0, FieldMemOperand(r0, HeapNumber::kValueOffset)); | 3027 __ vldr(d0, FieldMemOperand(r0, HeapNumber::kValueOffset)); |
3028 __ vmov(r2, r3, d0); | 3028 __ vmov(r2, r3, d0); |
3029 } else { | 3029 } else { |
3030 // Input is untagged double in d2. Output goes to d2. | 3030 // Input is untagged double in d2. Output goes to d2. |
3031 __ vmov(r2, r3, d2); | 3031 __ vmov(r2, r3, d2); |
3032 } | 3032 } |
3033 __ bind(&loaded); | 3033 __ bind(&loaded); |
3034 // r2 = low 32 bits of double value | 3034 // r2 = low 32 bits of double value |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3557 __ mov(r5, | 3557 __ mov(r5, |
3558 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); | 3558 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); |
3559 __ ldr(r5, MemOperand(r5)); | 3559 __ ldr(r5, MemOperand(r5)); |
3560 __ Push(r8, r7, r6, r5); | 3560 __ Push(r8, r7, r6, r5); |
3561 | 3561 |
3562 // Setup frame pointer for the frame to be pushed. | 3562 // Setup frame pointer for the frame to be pushed. |
3563 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); | 3563 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); |
3564 | 3564 |
3565 #ifdef ENABLE_LOGGING_AND_PROFILING | 3565 #ifdef ENABLE_LOGGING_AND_PROFILING |
3566 // If this is the outermost JS call, set js_entry_sp value. | 3566 // If this is the outermost JS call, set js_entry_sp value. |
| 3567 Label non_outermost_js; |
3567 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); | 3568 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); |
3568 __ mov(r5, Operand(ExternalReference(js_entry_sp))); | 3569 __ mov(r5, Operand(ExternalReference(js_entry_sp))); |
3569 __ ldr(r6, MemOperand(r5)); | 3570 __ ldr(r6, MemOperand(r5)); |
3570 __ cmp(r6, Operand(0, RelocInfo::NONE)); | 3571 __ cmp(r6, Operand(0)); |
3571 __ str(fp, MemOperand(r5), eq); | 3572 __ b(ne, &non_outermost_js); |
| 3573 __ str(fp, MemOperand(r5)); |
| 3574 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 3575 Label cont; |
| 3576 __ b(&cont); |
| 3577 __ bind(&non_outermost_js); |
| 3578 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); |
| 3579 __ bind(&cont); |
| 3580 __ push(ip); |
3572 #endif | 3581 #endif |
3573 | 3582 |
3574 // Call a faked try-block that does the invoke. | 3583 // Call a faked try-block that does the invoke. |
3575 __ bl(&invoke); | 3584 __ bl(&invoke); |
3576 | 3585 |
3577 // Caught exception: Store result (exception) in the pending | 3586 // Caught exception: Store result (exception) in the pending |
3578 // exception field in the JSEnv and return a failure sentinel. | 3587 // exception field in the JSEnv and return a failure sentinel. |
3579 // Coming in here the fp will be invalid because the PushTryHandler below | 3588 // Coming in here the fp will be invalid because the PushTryHandler below |
3580 // sets it to 0 to signal the existence of the JSEntry frame. | 3589 // sets it to 0 to signal the existence of the JSEntry frame. |
3581 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, | 3590 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3619 __ mov(ip, Operand(entry)); | 3628 __ mov(ip, Operand(entry)); |
3620 } | 3629 } |
3621 __ ldr(ip, MemOperand(ip)); // deref address | 3630 __ ldr(ip, MemOperand(ip)); // deref address |
3622 | 3631 |
3623 // Branch and link to JSEntryTrampoline. We don't use the double underscore | 3632 // Branch and link to JSEntryTrampoline. We don't use the double underscore |
3624 // macro for the add instruction because we don't want the coverage tool | 3633 // macro for the add instruction because we don't want the coverage tool |
3625 // inserting instructions here after we read the pc. | 3634 // inserting instructions here after we read the pc. |
3626 __ mov(lr, Operand(pc)); | 3635 __ mov(lr, Operand(pc)); |
3627 masm->add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 3636 masm->add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
3628 | 3637 |
3629 // Unlink this frame from the handler chain. When reading the | 3638 // Unlink this frame from the handler chain. |
3630 // address of the next handler, there is no need to use the address | 3639 __ PopTryHandler(); |
3631 // displacement since the current stack pointer (sp) points directly | |
3632 // to the stack handler. | |
3633 __ ldr(r3, MemOperand(sp, StackHandlerConstants::kNextOffset)); | |
3634 __ mov(ip, Operand(ExternalReference(Isolate::k_handler_address, isolate))); | |
3635 __ str(r3, MemOperand(ip)); | |
3636 // No need to restore registers | |
3637 __ add(sp, sp, Operand(StackHandlerConstants::kSize)); | |
3638 | 3640 |
| 3641 __ bind(&exit); // r0 holds result |
3639 #ifdef ENABLE_LOGGING_AND_PROFILING | 3642 #ifdef ENABLE_LOGGING_AND_PROFILING |
3640 // If current FP value is the same as js_entry_sp value, it means that | 3643 // Check if the current stack frame is marked as the outermost JS frame. |
3641 // the current function is the outermost. | 3644 Label non_outermost_js_2; |
| 3645 __ pop(r5); |
| 3646 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
| 3647 __ b(ne, &non_outermost_js_2); |
| 3648 __ mov(r6, Operand(0)); |
3642 __ mov(r5, Operand(ExternalReference(js_entry_sp))); | 3649 __ mov(r5, Operand(ExternalReference(js_entry_sp))); |
3643 __ ldr(r6, MemOperand(r5)); | 3650 __ str(r6, MemOperand(r5)); |
3644 __ cmp(fp, Operand(r6)); | 3651 __ bind(&non_outermost_js_2); |
3645 __ mov(r6, Operand(0, RelocInfo::NONE), LeaveCC, eq); | |
3646 __ str(r6, MemOperand(r5), eq); | |
3647 #endif | 3652 #endif |
3648 | 3653 |
3649 __ bind(&exit); // r0 holds result | |
3650 // Restore the top frame descriptors from the stack. | 3654 // Restore the top frame descriptors from the stack. |
3651 __ pop(r3); | 3655 __ pop(r3); |
3652 __ mov(ip, | 3656 __ mov(ip, |
3653 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); | 3657 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); |
3654 __ str(r3, MemOperand(ip)); | 3658 __ str(r3, MemOperand(ip)); |
3655 | 3659 |
3656 // Reset the stack to the callee saved registers. | 3660 // Reset the stack to the callee saved registers. |
3657 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); | 3661 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); |
3658 | 3662 |
3659 // Restore callee-saved registers and return. | 3663 // Restore callee-saved registers and return. |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4682 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { | 4686 MacroAssembler* masm, const RuntimeCallHelper& call_helper) { |
4683 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); | 4687 __ Abort("Unexpected fallthrough to CharCodeAt slow case"); |
4684 | 4688 |
4685 // Index is not a smi. | 4689 // Index is not a smi. |
4686 __ bind(&index_not_smi_); | 4690 __ bind(&index_not_smi_); |
4687 // If index is a heap number, try converting it to an integer. | 4691 // If index is a heap number, try converting it to an integer. |
4688 __ CheckMap(index_, | 4692 __ CheckMap(index_, |
4689 scratch_, | 4693 scratch_, |
4690 Heap::kHeapNumberMapRootIndex, | 4694 Heap::kHeapNumberMapRootIndex, |
4691 index_not_number_, | 4695 index_not_number_, |
4692 true); | 4696 DONT_DO_SMI_CHECK); |
4693 call_helper.BeforeCall(masm); | 4697 call_helper.BeforeCall(masm); |
4694 __ Push(object_, index_); | 4698 __ Push(object_, index_); |
4695 __ push(index_); // Consumed by runtime conversion function. | 4699 __ push(index_); // Consumed by runtime conversion function. |
4696 if (index_flags_ == STRING_INDEX_IS_NUMBER) { | 4700 if (index_flags_ == STRING_INDEX_IS_NUMBER) { |
4697 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); | 4701 __ CallRuntime(Runtime::kNumberToIntegerMapMinusZero, 1); |
4698 } else { | 4702 } else { |
4699 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); | 4703 ASSERT(index_flags_ == STRING_INDEX_IS_ARRAY_INDEX); |
4700 // NumberToSmi discards numbers that are not exact integers. | 4704 // NumberToSmi discards numbers that are not exact integers. |
4701 __ CallRuntime(Runtime::kNumberToSmi, 1); | 4705 __ CallRuntime(Runtime::kNumberToSmi, 1); |
4702 } | 4706 } |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6365 __ mov(result, Operand(0)); | 6369 __ mov(result, Operand(0)); |
6366 __ Ret(); | 6370 __ Ret(); |
6367 } | 6371 } |
6368 | 6372 |
6369 | 6373 |
6370 #undef __ | 6374 #undef __ |
6371 | 6375 |
6372 } } // namespace v8::internal | 6376 } } // namespace v8::internal |
6373 | 6377 |
6374 #endif // V8_TARGET_ARCH_ARM | 6378 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |