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