| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 case CodeStub::SubString: { | 740 case CodeStub::SubString: { |
| 741 SubStringStub stub; | 741 SubStringStub stub; |
| 742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 742 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 743 break; | 743 break; |
| 744 } | 744 } |
| 745 case CodeStub::StringCharAt: { | 745 case CodeStub::StringCharAt: { |
| 746 StringCharAtStub stub; | 746 StringCharAtStub stub; |
| 747 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 747 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 748 break; | 748 break; |
| 749 } | 749 } |
| 750 case CodeStub::MathPow: { | |
| 751 Abort("MathPowStub unimplemented."); | |
| 752 break; | |
| 753 } | |
| 754 case CodeStub::NumberToString: { | 750 case CodeStub::NumberToString: { |
| 755 NumberToStringStub stub; | 751 NumberToStringStub stub; |
| 756 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 752 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 757 break; | 753 break; |
| 758 } | 754 } |
| 759 case CodeStub::StringAdd: { | 755 case CodeStub::StringAdd: { |
| 760 StringAddStub stub(NO_STRING_ADD_FLAGS); | 756 StringAddStub stub(NO_STRING_ADD_FLAGS); |
| 761 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 757 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 762 break; | 758 break; |
| 763 } | 759 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 } | 1128 } |
| 1133 | 1129 |
| 1134 | 1130 |
| 1135 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { | 1131 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { |
| 1136 Register result = ToRegister(instr->result()); | 1132 Register result = ToRegister(instr->result()); |
| 1137 Register array = ToRegister(instr->InputAt(0)); | 1133 Register array = ToRegister(instr->InputAt(0)); |
| 1138 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset)); | 1134 __ ldr(result, FieldMemOperand(array, JSArray::kLengthOffset)); |
| 1139 } | 1135 } |
| 1140 | 1136 |
| 1141 | 1137 |
| 1142 void LCodeGen::DoPixelArrayLength(LPixelArrayLength* instr) { | 1138 void LCodeGen::DoExternalArrayLength(LExternalArrayLength* instr) { |
| 1143 Register result = ToRegister(instr->result()); | 1139 Register result = ToRegister(instr->result()); |
| 1144 Register array = ToRegister(instr->InputAt(0)); | 1140 Register array = ToRegister(instr->InputAt(0)); |
| 1145 __ ldr(result, FieldMemOperand(array, PixelArray::kLengthOffset)); | 1141 __ ldr(result, FieldMemOperand(array, ExternalArray::kLengthOffset)); |
| 1146 } | 1142 } |
| 1147 | 1143 |
| 1148 | 1144 |
| 1149 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { | 1145 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { |
| 1150 Register result = ToRegister(instr->result()); | 1146 Register result = ToRegister(instr->result()); |
| 1151 Register array = ToRegister(instr->InputAt(0)); | 1147 Register array = ToRegister(instr->InputAt(0)); |
| 1152 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); | 1148 __ ldr(result, FieldMemOperand(array, FixedArray::kLengthOffset)); |
| 1153 } | 1149 } |
| 1154 | 1150 |
| 1155 | 1151 |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 Register input = ToRegister(instr->InputAt(0)); | 2199 Register input = ToRegister(instr->InputAt(0)); |
| 2204 Register scratch = scratch0(); | 2200 Register scratch = scratch0(); |
| 2205 | 2201 |
| 2206 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); | 2202 __ ldr(result, FieldMemOperand(input, JSObject::kElementsOffset)); |
| 2207 if (FLAG_debug_code) { | 2203 if (FLAG_debug_code) { |
| 2208 Label done; | 2204 Label done; |
| 2209 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); | 2205 __ ldr(scratch, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 2210 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); | 2206 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); |
| 2211 __ cmp(scratch, ip); | 2207 __ cmp(scratch, ip); |
| 2212 __ b(eq, &done); | 2208 __ b(eq, &done); |
| 2213 __ LoadRoot(ip, Heap::kPixelArrayMapRootIndex); | 2209 __ LoadRoot(ip, Heap::kExternalPixelArrayMapRootIndex); |
| 2214 __ cmp(scratch, ip); | 2210 __ cmp(scratch, ip); |
| 2215 __ b(eq, &done); | 2211 __ b(eq, &done); |
| 2216 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); | 2212 __ LoadRoot(ip, Heap::kFixedCOWArrayMapRootIndex); |
| 2217 __ cmp(scratch, ip); | 2213 __ cmp(scratch, ip); |
| 2218 __ Check(eq, "Check for fast elements failed."); | 2214 __ Check(eq, "Check for fast elements failed."); |
| 2219 __ bind(&done); | 2215 __ bind(&done); |
| 2220 } | 2216 } |
| 2221 } | 2217 } |
| 2222 | 2218 |
| 2223 | 2219 |
| 2224 void LCodeGen::DoLoadPixelArrayExternalPointer( | 2220 void LCodeGen::DoLoadExternalArrayPointer( |
| 2225 LLoadPixelArrayExternalPointer* instr) { | 2221 LLoadExternalArrayPointer* instr) { |
| 2226 Register to_reg = ToRegister(instr->result()); | 2222 Register to_reg = ToRegister(instr->result()); |
| 2227 Register from_reg = ToRegister(instr->InputAt(0)); | 2223 Register from_reg = ToRegister(instr->InputAt(0)); |
| 2228 __ ldr(to_reg, FieldMemOperand(from_reg, PixelArray::kExternalPointerOffset)); | 2224 __ ldr(to_reg, FieldMemOperand(from_reg, |
| 2225 ExternalArray::kExternalPointerOffset)); |
| 2229 } | 2226 } |
| 2230 | 2227 |
| 2231 | 2228 |
| 2232 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { | 2229 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { |
| 2233 Register arguments = ToRegister(instr->arguments()); | 2230 Register arguments = ToRegister(instr->arguments()); |
| 2234 Register length = ToRegister(instr->length()); | 2231 Register length = ToRegister(instr->length()); |
| 2235 Register index = ToRegister(instr->index()); | 2232 Register index = ToRegister(instr->index()); |
| 2236 Register result = ToRegister(instr->result()); | 2233 Register result = ToRegister(instr->result()); |
| 2237 | 2234 |
| 2238 // Bailout index is not a valid argument index. Use unsigned check to get | 2235 // Bailout index is not a valid argument index. Use unsigned check to get |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2259 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); | 2256 __ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize)); |
| 2260 | 2257 |
| 2261 // Check for the hole value. | 2258 // Check for the hole value. |
| 2262 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); | 2259 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); |
| 2263 __ cmp(result, scratch); | 2260 __ cmp(result, scratch); |
| 2264 DeoptimizeIf(eq, instr->environment()); | 2261 DeoptimizeIf(eq, instr->environment()); |
| 2265 } | 2262 } |
| 2266 | 2263 |
| 2267 | 2264 |
| 2268 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { | 2265 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { |
| 2269 Register external_elements = ToRegister(instr->external_pointer()); | 2266 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2270 Register key = ToRegister(instr->key()); | 2267 Register key = ToRegister(instr->key()); |
| 2271 Register result = ToRegister(instr->result()); | 2268 Register result = ToRegister(instr->result()); |
| 2272 | 2269 |
| 2273 // Load the result. | 2270 // Load the result. |
| 2274 __ ldrb(result, MemOperand(external_elements, key)); | 2271 __ ldrb(result, MemOperand(external_pointer, key)); |
| 2275 } | 2272 } |
| 2276 | 2273 |
| 2277 | 2274 |
| 2278 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2275 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
| 2279 ASSERT(ToRegister(instr->object()).is(r1)); | 2276 ASSERT(ToRegister(instr->object()).is(r1)); |
| 2280 ASSERT(ToRegister(instr->key()).is(r0)); | 2277 ASSERT(ToRegister(instr->key()).is(r0)); |
| 2281 | 2278 |
| 2282 Handle<Code> ic(Isolate::Current()->builtins()-> | 2279 Handle<Code> ic(Isolate::Current()->builtins()-> |
| 2283 builtin(Builtins::KeyedLoadIC_Initialize)); | 2280 builtin(Builtins::KeyedLoadIC_Initialize)); |
| 2284 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2281 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 } | 2640 } |
| 2644 | 2641 |
| 2645 | 2642 |
| 2646 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 2643 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| 2647 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 2644 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 2648 ASSERT(ToDoubleRegister(instr->result()).is(input)); | 2645 ASSERT(ToDoubleRegister(instr->result()).is(input)); |
| 2649 __ vsqrt(input, input); | 2646 __ vsqrt(input, input); |
| 2650 } | 2647 } |
| 2651 | 2648 |
| 2652 | 2649 |
| 2650 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
| 2651 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 2652 Register scratch = scratch0(); |
| 2653 SwVfpRegister single_scratch = double_scratch0().low(); |
| 2654 DoubleRegister double_scratch = double_scratch0(); |
| 2655 ASSERT(ToDoubleRegister(instr->result()).is(input)); |
| 2656 |
| 2657 // Add +0 to convert -0 to +0. |
| 2658 __ mov(scratch, Operand(0)); |
| 2659 __ vmov(single_scratch, scratch); |
| 2660 __ vcvt_f64_s32(double_scratch, single_scratch); |
| 2661 __ vadd(input, input, double_scratch); |
| 2662 __ vsqrt(input, input); |
| 2663 } |
| 2664 |
| 2665 |
| 2653 void LCodeGen::DoPower(LPower* instr) { | 2666 void LCodeGen::DoPower(LPower* instr) { |
| 2654 LOperand* left = instr->InputAt(0); | 2667 LOperand* left = instr->InputAt(0); |
| 2655 LOperand* right = instr->InputAt(1); | 2668 LOperand* right = instr->InputAt(1); |
| 2656 Register scratch = scratch0(); | 2669 Register scratch = scratch0(); |
| 2657 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 2670 DoubleRegister result_reg = ToDoubleRegister(instr->result()); |
| 2658 Representation exponent_type = instr->hydrogen()->right()->representation(); | 2671 Representation exponent_type = instr->hydrogen()->right()->representation(); |
| 2659 if (exponent_type.IsDouble()) { | 2672 if (exponent_type.IsDouble()) { |
| 2660 // Prepare arguments and call C function. | 2673 // Prepare arguments and call C function. |
| 2661 __ PrepareCallCFunction(4, scratch); | 2674 __ PrepareCallCFunction(4, scratch); |
| 2662 __ vmov(r0, r1, ToDoubleRegister(left)); | 2675 __ vmov(r0, r1, ToDoubleRegister(left)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2739 break; | 2752 break; |
| 2740 case kMathFloor: | 2753 case kMathFloor: |
| 2741 DoMathFloor(instr); | 2754 DoMathFloor(instr); |
| 2742 break; | 2755 break; |
| 2743 case kMathRound: | 2756 case kMathRound: |
| 2744 DoMathRound(instr); | 2757 DoMathRound(instr); |
| 2745 break; | 2758 break; |
| 2746 case kMathSqrt: | 2759 case kMathSqrt: |
| 2747 DoMathSqrt(instr); | 2760 DoMathSqrt(instr); |
| 2748 break; | 2761 break; |
| 2762 case kMathPowHalf: |
| 2763 DoMathPowHalf(instr); |
| 2764 break; |
| 2749 case kMathCos: | 2765 case kMathCos: |
| 2750 DoMathCos(instr); | 2766 DoMathCos(instr); |
| 2751 break; | 2767 break; |
| 2752 case kMathSin: | 2768 case kMathSin: |
| 2753 DoMathSin(instr); | 2769 DoMathSin(instr); |
| 2754 break; | 2770 break; |
| 2755 case kMathLog: | 2771 case kMathLog: |
| 2756 DoMathLog(instr); | 2772 DoMathLog(instr); |
| 2757 break; | 2773 break; |
| 2758 default: | 2774 default: |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2904 } | 2920 } |
| 2905 | 2921 |
| 2906 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2922 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 2907 // Compute address of modified element and store it into key register. | 2923 // Compute address of modified element and store it into key register. |
| 2908 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); | 2924 __ add(key, scratch, Operand(FixedArray::kHeaderSize)); |
| 2909 __ RecordWrite(elements, key, value); | 2925 __ RecordWrite(elements, key, value); |
| 2910 } | 2926 } |
| 2911 } | 2927 } |
| 2912 | 2928 |
| 2913 | 2929 |
| 2930 void LCodeGen::DoStorePixelArrayElement(LStorePixelArrayElement* instr) { |
| 2931 Register external_pointer = ToRegister(instr->external_pointer()); |
| 2932 Register key = ToRegister(instr->key()); |
| 2933 Register value = ToRegister(instr->value()); |
| 2934 |
| 2935 // Clamp the value to [0..255]. |
| 2936 __ Usat(value, 8, Operand(value)); |
| 2937 __ strb(value, MemOperand(external_pointer, key, LSL, 0)); |
| 2938 } |
| 2939 |
| 2940 |
| 2914 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 2941 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 2915 ASSERT(ToRegister(instr->object()).is(r2)); | 2942 ASSERT(ToRegister(instr->object()).is(r2)); |
| 2916 ASSERT(ToRegister(instr->key()).is(r1)); | 2943 ASSERT(ToRegister(instr->key()).is(r1)); |
| 2917 ASSERT(ToRegister(instr->value()).is(r0)); | 2944 ASSERT(ToRegister(instr->value()).is(r0)); |
| 2918 | 2945 |
| 2919 Handle<Code> ic(Isolate::Current()->builtins()->builtin( | 2946 Handle<Code> ic(Isolate::Current()->builtins()->builtin( |
| 2920 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict | 2947 info_->is_strict() ? Builtins::KeyedStoreIC_Initialize_Strict |
| 2921 : Builtins::KeyedStoreIC_Initialize)); | 2948 : Builtins::KeyedStoreIC_Initialize)); |
| 2922 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2949 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2923 } | 2950 } |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3843 ASSERT(!environment->HasBeenRegistered()); | 3870 ASSERT(!environment->HasBeenRegistered()); |
| 3844 RegisterEnvironmentForDeoptimization(environment); | 3871 RegisterEnvironmentForDeoptimization(environment); |
| 3845 ASSERT(osr_pc_offset_ == -1); | 3872 ASSERT(osr_pc_offset_ == -1); |
| 3846 osr_pc_offset_ = masm()->pc_offset(); | 3873 osr_pc_offset_ = masm()->pc_offset(); |
| 3847 } | 3874 } |
| 3848 | 3875 |
| 3849 | 3876 |
| 3850 #undef __ | 3877 #undef __ |
| 3851 | 3878 |
| 3852 } } // namespace v8::internal | 3879 } } // namespace v8::internal |
| OLD | NEW |