OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3007 } | 3007 } |
3008 | 3008 |
3009 | 3009 |
3010 void MacroAssembler::AbortIfNotSmi(Register object) { | 3010 void MacroAssembler::AbortIfNotSmi(Register object) { |
3011 STATIC_ASSERT(kSmiTag == 0); | 3011 STATIC_ASSERT(kSmiTag == 0); |
3012 tst(object, Operand(kSmiTagMask)); | 3012 tst(object, Operand(kSmiTagMask)); |
3013 Assert(eq, "Operand is not smi"); | 3013 Assert(eq, "Operand is not smi"); |
3014 } | 3014 } |
3015 | 3015 |
3016 | 3016 |
| 3017 void MacroAssembler::AbortIfNotFixedArray(Register object, Register scratch) { |
| 3018 Label ok, fail; |
| 3019 CheckMap(object, |
| 3020 scratch, |
| 3021 isolate()->factory()->fixed_array_map(), |
| 3022 &fail, |
| 3023 DONT_DO_SMI_CHECK); |
| 3024 jmp(&ok); |
| 3025 bind(&fail); |
| 3026 Abort("Operand is not a fixed array"); |
| 3027 bind(&ok); |
| 3028 } |
| 3029 |
| 3030 |
3017 void MacroAssembler::AbortIfNotString(Register object) { | 3031 void MacroAssembler::AbortIfNotString(Register object) { |
3018 STATIC_ASSERT(kSmiTag == 0); | 3032 STATIC_ASSERT(kSmiTag == 0); |
3019 tst(object, Operand(kSmiTagMask)); | 3033 tst(object, Operand(kSmiTagMask)); |
3020 Assert(ne, "Operand is not a string"); | 3034 Assert(ne, "Operand is not a string"); |
3021 push(object); | 3035 push(object); |
3022 ldr(object, FieldMemOperand(object, HeapObject::kMapOffset)); | 3036 ldr(object, FieldMemOperand(object, HeapObject::kMapOffset)); |
3023 CompareInstanceType(object, object, FIRST_NONSTRING_TYPE); | 3037 CompareInstanceType(object, object, FIRST_NONSTRING_TYPE); |
3024 pop(object); | 3038 pop(object); |
3025 Assert(lo, "Operand is not a string"); | 3039 Assert(lo, "Operand is not a string"); |
3026 } | 3040 } |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 bind(&in_bounds); | 3680 bind(&in_bounds); |
3667 Vmov(temp_double_reg, 0.5); | 3681 Vmov(temp_double_reg, 0.5); |
3668 vadd(temp_double_reg, input_reg, temp_double_reg); | 3682 vadd(temp_double_reg, input_reg, temp_double_reg); |
3669 vcvt_u32_f64(temp_double_reg.low(), temp_double_reg); | 3683 vcvt_u32_f64(temp_double_reg.low(), temp_double_reg); |
3670 vmov(result_reg, temp_double_reg.low()); | 3684 vmov(result_reg, temp_double_reg.low()); |
3671 bind(&done); | 3685 bind(&done); |
3672 } | 3686 } |
3673 | 3687 |
3674 | 3688 |
3675 void MacroAssembler::LoadInstanceDescriptors(Register map, | 3689 void MacroAssembler::LoadInstanceDescriptors(Register map, |
3676 Register descriptors) { | 3690 Register descriptors, |
| 3691 Register scratch) { |
3677 ldr(descriptors, | 3692 ldr(descriptors, |
3678 FieldMemOperand(map, Map::kInstanceDescriptorsOrBitField3Offset)); | 3693 FieldMemOperand(map, Map::kInstanceDescriptorsOrBackPointerOffset)); |
3679 Label not_smi; | 3694 |
3680 JumpIfNotSmi(descriptors, ¬_smi); | 3695 Label ok, fail; |
| 3696 CheckMap(descriptors, |
| 3697 scratch, |
| 3698 isolate()->factory()->fixed_array_map(), |
| 3699 &fail, |
| 3700 DONT_DO_SMI_CHECK); |
| 3701 jmp(&ok); |
| 3702 bind(&fail); |
3681 mov(descriptors, Operand(FACTORY->empty_descriptor_array())); | 3703 mov(descriptors, Operand(FACTORY->empty_descriptor_array())); |
3682 bind(¬_smi); | 3704 bind(&ok); |
| 3705 |
| 3706 if (emit_debug_code()) { |
| 3707 AbortIfNotFixedArray(descriptors, scratch); |
| 3708 } |
3683 } | 3709 } |
3684 | 3710 |
3685 | 3711 |
3686 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { | 3712 void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) { |
3687 Label next; | 3713 Label next; |
3688 // Preload a couple of values used in the loop. | 3714 // Preload a couple of values used in the loop. |
3689 Register empty_fixed_array_value = r6; | 3715 Register empty_fixed_array_value = r6; |
3690 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); | 3716 LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex); |
3691 Register empty_descriptor_array_value = r7; | 3717 Register empty_descriptor_array_value = r7; |
3692 LoadRoot(empty_descriptor_array_value, | 3718 LoadRoot(empty_descriptor_array_value, |
3693 Heap::kEmptyDescriptorArrayRootIndex); | 3719 Heap::kEmptyDescriptorArrayRootIndex); |
3694 mov(r1, r0); | 3720 mov(r1, r0); |
3695 bind(&next); | 3721 bind(&next); |
3696 | 3722 |
3697 // Check that there are no elements. Register r1 contains the | 3723 // Check that there are no elements. Register r1 contains the |
3698 // current JS object we've reached through the prototype chain. | 3724 // current JS object we've reached through the prototype chain. |
3699 ldr(r2, FieldMemOperand(r1, JSObject::kElementsOffset)); | 3725 ldr(r2, FieldMemOperand(r1, JSObject::kElementsOffset)); |
3700 cmp(r2, empty_fixed_array_value); | 3726 cmp(r2, empty_fixed_array_value); |
3701 b(ne, call_runtime); | 3727 b(ne, call_runtime); |
3702 | 3728 |
3703 // Check that instance descriptors are not empty so that we can | 3729 // Check that instance descriptors are not empty so that we can |
3704 // check for an enum cache. Leave the map in r2 for the subsequent | 3730 // check for an enum cache. Leave the map in r2 for the subsequent |
3705 // prototype load. | 3731 // prototype load. |
3706 ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 3732 ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
3707 ldr(r3, FieldMemOperand(r2, Map::kInstanceDescriptorsOrBitField3Offset)); | 3733 ldr(r3, FieldMemOperand(r2, Map::kInstanceDescriptorsOrBackPointerOffset)); |
3708 JumpIfSmi(r3, call_runtime); | 3734 |
| 3735 CheckMap(r3, |
| 3736 r7, |
| 3737 isolate()->factory()->fixed_array_map(), |
| 3738 call_runtime, |
| 3739 DONT_DO_SMI_CHECK); |
| 3740 |
| 3741 if (emit_debug_code()) { |
| 3742 AbortIfNotFixedArray(r3, r7); |
| 3743 } |
3709 | 3744 |
3710 // Check that there is an enum cache in the non-empty instance | 3745 // Check that there is an enum cache in the non-empty instance |
3711 // descriptors (r3). This is the case if the next enumeration | 3746 // descriptors (r3). This is the case if the next enumeration |
3712 // index field does not contain a smi. | 3747 // index field does not contain a smi. |
3713 ldr(r3, FieldMemOperand(r3, DescriptorArray::kEnumerationIndexOffset)); | 3748 ldr(r3, FieldMemOperand(r3, DescriptorArray::kEnumerationIndexOffset)); |
3714 JumpIfSmi(r3, call_runtime); | 3749 JumpIfSmi(r3, call_runtime); |
3715 | 3750 |
3716 // For all objects but the receiver, check that the cache is empty. | 3751 // For all objects but the receiver, check that the cache is empty. |
3717 Label check_prototype; | 3752 Label check_prototype; |
3718 cmp(r1, r0); | 3753 cmp(r1, r0); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3788 void CodePatcher::EmitCondition(Condition cond) { | 3823 void CodePatcher::EmitCondition(Condition cond) { |
3789 Instr instr = Assembler::instr_at(masm_.pc_); | 3824 Instr instr = Assembler::instr_at(masm_.pc_); |
3790 instr = (instr & ~kCondMask) | cond; | 3825 instr = (instr & ~kCondMask) | cond; |
3791 masm_.emit(instr); | 3826 masm_.emit(instr); |
3792 } | 3827 } |
3793 | 3828 |
3794 | 3829 |
3795 } } // namespace v8::internal | 3830 } } // namespace v8::internal |
3796 | 3831 |
3797 #endif // V8_TARGET_ARCH_ARM | 3832 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |