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 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3020 __ bind(&slow_allocate_heapnumber); | 3020 __ bind(&slow_allocate_heapnumber); |
3021 // Allocate a heap number. | 3021 // Allocate a heap number. |
3022 __ CallRuntime(Runtime::kNumberAlloc, 0); | 3022 __ CallRuntime(Runtime::kNumberAlloc, 0); |
3023 __ mov(r4, Operand(r0)); | 3023 __ mov(r4, Operand(r0)); |
3024 | 3024 |
3025 __ bind(&heapnumber_allocated); | 3025 __ bind(&heapnumber_allocated); |
3026 | 3026 |
3027 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | 3027 // Convert 32 random bits in r0 to 0.(32 random bits) in a double |
3028 // by computing: | 3028 // by computing: |
3029 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3029 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3030 if (CpuFeatures::IsSupported(VFP2)) { | 3030 __ PrepareCallCFunction(1, r0); |
3031 __ PrepareCallCFunction(1, r0); | 3031 __ ldr(r0, |
3032 __ ldr(r0, | 3032 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); |
3033 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | 3033 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); |
3034 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); | 3034 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3035 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | |
3036 | 3035 |
3037 CpuFeatureScope scope(masm(), VFP2); | 3036 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3038 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3037 // Create this constant using mov/orr to avoid PC relative load. |
3039 // Create this constant using mov/orr to avoid PC relative load. | 3038 __ mov(r1, Operand(0x41000000)); |
3040 __ mov(r1, Operand(0x41000000)); | 3039 __ orr(r1, r1, Operand(0x300000)); |
3041 __ orr(r1, r1, Operand(0x300000)); | 3040 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
3042 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | 3041 __ vmov(d7, r0, r1); |
3043 __ vmov(d7, r0, r1); | 3042 // Move 0x4130000000000000 to VFP. |
3044 // Move 0x4130000000000000 to VFP. | 3043 __ mov(r0, Operand::Zero()); |
3045 __ mov(r0, Operand::Zero()); | 3044 __ vmov(d8, r0, r1); |
3046 __ vmov(d8, r0, r1); | 3045 // Subtract and store the result in the heap number. |
3047 // Subtract and store the result in the heap number. | 3046 __ vsub(d7, d7, d8); |
3048 __ vsub(d7, d7, d8); | 3047 __ sub(r0, r4, Operand(kHeapObjectTag)); |
3049 __ sub(r0, r4, Operand(kHeapObjectTag)); | 3048 __ vstr(d7, r0, HeapNumber::kValueOffset); |
3050 __ vstr(d7, r0, HeapNumber::kValueOffset); | 3049 __ mov(r0, r4); |
3051 __ mov(r0, r4); | |
3052 } else { | |
3053 __ PrepareCallCFunction(2, r0); | |
3054 __ ldr(r1, | |
3055 ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX)); | |
3056 __ mov(r0, Operand(r4)); | |
3057 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kNativeContextOffset)); | |
3058 __ CallCFunction( | |
3059 ExternalReference::fill_heap_number_with_random_function(isolate()), 2); | |
3060 } | |
3061 | 3050 |
3062 context()->Plug(r0); | 3051 context()->Plug(r0); |
3063 } | 3052 } |
3064 | 3053 |
3065 | 3054 |
3066 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { | 3055 void FullCodeGenerator::EmitSubString(CallRuntime* expr) { |
3067 // Load the arguments on the stack and call the stub. | 3056 // Load the arguments on the stack and call the stub. |
3068 SubStringStub stub; | 3057 SubStringStub stub; |
3069 ZoneList<Expression*>* args = expr->arguments(); | 3058 ZoneList<Expression*>* args = expr->arguments(); |
3070 ASSERT(args->length() == 3); | 3059 ASSERT(args->length() == 3); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3187 } | 3176 } |
3188 | 3177 |
3189 | 3178 |
3190 | 3179 |
3191 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { | 3180 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { |
3192 // Load the arguments on the stack and call the runtime function. | 3181 // Load the arguments on the stack and call the runtime function. |
3193 ZoneList<Expression*>* args = expr->arguments(); | 3182 ZoneList<Expression*>* args = expr->arguments(); |
3194 ASSERT(args->length() == 2); | 3183 ASSERT(args->length() == 2); |
3195 VisitForStackValue(args->at(0)); | 3184 VisitForStackValue(args->at(0)); |
3196 VisitForStackValue(args->at(1)); | 3185 VisitForStackValue(args->at(1)); |
3197 if (CpuFeatures::IsSupported(VFP2)) { | 3186 MathPowStub stub(MathPowStub::ON_STACK); |
3198 MathPowStub stub(MathPowStub::ON_STACK); | 3187 __ CallStub(&stub); |
3199 __ CallStub(&stub); | |
3200 } else { | |
3201 __ CallRuntime(Runtime::kMath_pow, 2); | |
3202 } | |
3203 context()->Plug(r0); | 3188 context()->Plug(r0); |
3204 } | 3189 } |
3205 | 3190 |
3206 | 3191 |
3207 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { | 3192 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { |
3208 ZoneList<Expression*>* args = expr->arguments(); | 3193 ZoneList<Expression*>* args = expr->arguments(); |
3209 ASSERT(args->length() == 2); | 3194 ASSERT(args->length() == 2); |
3210 VisitForStackValue(args->at(0)); // Load the object. | 3195 VisitForStackValue(args->at(0)); // Load the object. |
3211 VisitForAccumulatorValue(args->at(1)); // Load the value. | 3196 VisitForAccumulatorValue(args->at(1)); // Load the value. |
3212 __ pop(r1); // r0 = value. r1 = object. | 3197 __ pop(r1); // r0 = value. r1 = object. |
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4583 *context_length = 0; | 4568 *context_length = 0; |
4584 return previous_; | 4569 return previous_; |
4585 } | 4570 } |
4586 | 4571 |
4587 | 4572 |
4588 #undef __ | 4573 #undef __ |
4589 | 4574 |
4590 } } // namespace v8::internal | 4575 } } // namespace v8::internal |
4591 | 4576 |
4592 #endif // V8_TARGET_ARCH_ARM | 4577 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |