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