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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 } else { | 666 } else { |
667 if (false_label_ != fall_through_) __ b(false_label_); | 667 if (false_label_ != fall_through_) __ b(false_label_); |
668 } | 668 } |
669 } | 669 } |
670 | 670 |
671 | 671 |
672 void FullCodeGenerator::DoTest(Expression* condition, | 672 void FullCodeGenerator::DoTest(Expression* condition, |
673 Label* if_true, | 673 Label* if_true, |
674 Label* if_false, | 674 Label* if_false, |
675 Label* fall_through) { | 675 Label* fall_through) { |
676 if (CpuFeatures::IsSupported(VFP3)) { | 676 if (CpuFeatures::IsSupported(VFP2)) { |
677 ToBooleanStub stub(result_register()); | 677 ToBooleanStub stub(result_register()); |
678 __ CallStub(&stub); | 678 __ CallStub(&stub); |
679 __ tst(result_register(), result_register()); | 679 __ tst(result_register(), result_register()); |
680 } else { | 680 } else { |
681 // Call the runtime to find the boolean value of the source and then | 681 // Call the runtime to find the boolean value of the source and then |
682 // translate it into control flow to the pair of labels. | 682 // translate it into control flow to the pair of labels. |
683 __ push(result_register()); | 683 __ push(result_register()); |
684 __ CallRuntime(Runtime::kToBool, 1); | 684 __ CallRuntime(Runtime::kToBool, 1); |
685 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 685 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
686 __ cmp(r0, ip); | 686 __ cmp(r0, ip); |
(...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 __ bind(&slow_allocate_heapnumber); | 3043 __ bind(&slow_allocate_heapnumber); |
3044 // Allocate a heap number. | 3044 // Allocate a heap number. |
3045 __ CallRuntime(Runtime::kNumberAlloc, 0); | 3045 __ CallRuntime(Runtime::kNumberAlloc, 0); |
3046 __ mov(r4, Operand(r0)); | 3046 __ mov(r4, Operand(r0)); |
3047 | 3047 |
3048 __ bind(&heapnumber_allocated); | 3048 __ bind(&heapnumber_allocated); |
3049 | 3049 |
3050 // Convert 32 random bits in r0 to 0.(32 random bits) in a double | 3050 // Convert 32 random bits in r0 to 0.(32 random bits) in a double |
3051 // by computing: | 3051 // by computing: |
3052 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | 3052 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). |
3053 if (CpuFeatures::IsSupported(VFP3)) { | 3053 if (CpuFeatures::IsSupported(VFP2)) { |
3054 __ PrepareCallCFunction(1, r0); | 3054 __ PrepareCallCFunction(1, r0); |
3055 __ ldr(r0, ContextOperand(context_register(), Context::GLOBAL_INDEX)); | 3055 __ ldr(r0, ContextOperand(context_register(), Context::GLOBAL_INDEX)); |
3056 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); | 3056 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
3057 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); | 3057 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1); |
3058 | 3058 |
3059 CpuFeatures::Scope scope(VFP3); | 3059 CpuFeatures::Scope scope(VFP2); |
3060 // 0x41300000 is the top half of 1.0 x 2^20 as a double. | 3060 // 0x41300000 is the top half of 1.0 x 2^20 as a double. |
3061 // Create this constant using mov/orr to avoid PC relative load. | 3061 // Create this constant using mov/orr to avoid PC relative load. |
3062 __ mov(r1, Operand(0x41000000)); | 3062 __ mov(r1, Operand(0x41000000)); |
3063 __ orr(r1, r1, Operand(0x300000)); | 3063 __ orr(r1, r1, Operand(0x300000)); |
3064 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. | 3064 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. |
3065 __ vmov(d7, r0, r1); | 3065 __ vmov(d7, r0, r1); |
3066 // Move 0x4130000000000000 to VFP. | 3066 // Move 0x4130000000000000 to VFP. |
3067 __ mov(r0, Operand(0, RelocInfo::NONE)); | 3067 __ mov(r0, Operand(0, RelocInfo::NONE)); |
3068 __ vmov(d8, r0, r1); | 3068 __ vmov(d8, r0, r1); |
3069 // Subtract and store the result in the heap number. | 3069 // Subtract and store the result in the heap number. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3172 context()->Plug(r0); | 3172 context()->Plug(r0); |
3173 } | 3173 } |
3174 | 3174 |
3175 | 3175 |
3176 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { | 3176 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { |
3177 // Load the arguments on the stack and call the runtime function. | 3177 // Load the arguments on the stack and call the runtime function. |
3178 ZoneList<Expression*>* args = expr->arguments(); | 3178 ZoneList<Expression*>* args = expr->arguments(); |
3179 ASSERT(args->length() == 2); | 3179 ASSERT(args->length() == 2); |
3180 VisitForStackValue(args->at(0)); | 3180 VisitForStackValue(args->at(0)); |
3181 VisitForStackValue(args->at(1)); | 3181 VisitForStackValue(args->at(1)); |
3182 if (CpuFeatures::IsSupported(VFP3)) { | 3182 if (CpuFeatures::IsSupported(VFP2)) { |
3183 MathPowStub stub(MathPowStub::ON_STACK); | 3183 MathPowStub stub(MathPowStub::ON_STACK); |
3184 __ CallStub(&stub); | 3184 __ CallStub(&stub); |
3185 } else { | 3185 } else { |
3186 __ CallRuntime(Runtime::kMath_pow, 2); | 3186 __ CallRuntime(Runtime::kMath_pow, 2); |
3187 } | 3187 } |
3188 context()->Plug(r0); | 3188 context()->Plug(r0); |
3189 } | 3189 } |
3190 | 3190 |
3191 | 3191 |
3192 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { | 3192 void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) { |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4577 *context_length = 0; | 4577 *context_length = 0; |
4578 return previous_; | 4578 return previous_; |
4579 } | 4579 } |
4580 | 4580 |
4581 | 4581 |
4582 #undef __ | 4582 #undef __ |
4583 | 4583 |
4584 } } // namespace v8::internal | 4584 } } // namespace v8::internal |
4585 | 4585 |
4586 #endif // V8_TARGET_ARCH_ARM | 4586 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |