Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: src/arm/codegen-arm.cc

Issue 6691054: [Arguments] Merge (7442,7496] from bleeding_edge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/arguments
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/cpu-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 755
756 // Check if the value is a smi. 756 // Check if the value is a smi.
757 __ cmp(tos, Operand(Smi::FromInt(0))); 757 __ cmp(tos, Operand(Smi::FromInt(0)));
758 758
759 if (!known_smi) { 759 if (!known_smi) {
760 false_target->Branch(eq); 760 false_target->Branch(eq);
761 __ tst(tos, Operand(kSmiTagMask)); 761 __ tst(tos, Operand(kSmiTagMask));
762 true_target->Branch(eq); 762 true_target->Branch(eq);
763 763
764 // Slow case. 764 // Slow case.
765 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 765 if (CpuFeatures::IsSupported(VFP3)) {
766 CpuFeatures::Scope scope(VFP3); 766 CpuFeatures::Scope scope(VFP3);
767 // Implements the slow case by using ToBooleanStub. 767 // Implements the slow case by using ToBooleanStub.
768 // The ToBooleanStub takes a single argument, and 768 // The ToBooleanStub takes a single argument, and
769 // returns a non-zero value for true, or zero for false. 769 // returns a non-zero value for true, or zero for false.
770 // Both the argument value and the return value use the 770 // Both the argument value and the return value use the
771 // register assigned to tos_ 771 // register assigned to tos_
772 ToBooleanStub stub(tos); 772 ToBooleanStub stub(tos);
773 frame_->CallStub(&stub, 0); 773 frame_->CallStub(&stub, 0);
774 // Convert the result in "tos" to a condition code. 774 // Convert the result in "tos" to a condition code.
775 __ cmp(tos, Operand(0, RelocInfo::NONE)); 775 __ cmp(tos, Operand(0, RelocInfo::NONE));
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 952
953 __ b(cond, &non_smi_input_); 953 __ b(cond, &non_smi_input_);
954 } 954 }
955 955
956 956
957 // For bit operations the result is always 32bits so we handle the case where 957 // For bit operations the result is always 32bits so we handle the case where
958 // the result does not fit in a Smi without calling the generic stub. 958 // the result does not fit in a Smi without calling the generic stub.
959 void DeferredInlineSmiOperation::JumpToAnswerOutOfRange(Condition cond) { 959 void DeferredInlineSmiOperation::JumpToAnswerOutOfRange(Condition cond) {
960 ASSERT(Token::IsBitOp(op_)); 960 ASSERT(Token::IsBitOp(op_));
961 961
962 if ((op_ == Token::SHR) && 962 if ((op_ == Token::SHR) && !CpuFeatures::IsSupported(VFP3)) {
963 !Isolate::Current()->cpu_features()->IsSupported(VFP3)) {
964 // >>> requires an unsigned to double conversion and the non VFP code 963 // >>> requires an unsigned to double conversion and the non VFP code
965 // does not support this conversion. 964 // does not support this conversion.
966 __ b(cond, entry_label()); 965 __ b(cond, entry_label());
967 } else { 966 } else {
968 __ b(cond, &answer_out_of_range_); 967 __ b(cond, &answer_out_of_range_);
969 } 968 }
970 } 969 }
971 970
972 971
973 // On entry the non-constant side of the binary operation is in tos_register_ 972 // On entry the non-constant side of the binary operation is in tos_register_
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (answer_out_of_range_.is_linked()) { 1056 if (answer_out_of_range_.is_linked()) {
1058 GenerateAnswerOutOfRange(); 1057 GenerateAnswerOutOfRange();
1059 } 1058 }
1060 } 1059 }
1061 1060
1062 1061
1063 // Convert and write the integer answer into heap_number. 1062 // Convert and write the integer answer into heap_number.
1064 void DeferredInlineSmiOperation::WriteNonSmiAnswer(Register answer, 1063 void DeferredInlineSmiOperation::WriteNonSmiAnswer(Register answer,
1065 Register heap_number, 1064 Register heap_number,
1066 Register scratch) { 1065 Register scratch) {
1067 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 1066 if (CpuFeatures::IsSupported(VFP3)) {
1068 CpuFeatures::Scope scope(VFP3); 1067 CpuFeatures::Scope scope(VFP3);
1069 __ vmov(s0, answer); 1068 __ vmov(s0, answer);
1070 if (op_ == Token::SHR) { 1069 if (op_ == Token::SHR) {
1071 __ vcvt_f64_u32(d0, s0); 1070 __ vcvt_f64_u32(d0, s0);
1072 } else { 1071 } else {
1073 __ vcvt_f64_s32(d0, s0); 1072 __ vcvt_f64_s32(d0, s0);
1074 } 1073 }
1075 __ sub(scratch, heap_number, Operand(kHeapObjectTag)); 1074 __ sub(scratch, heap_number, Operand(kHeapObjectTag));
1076 __ vstr(d0, scratch, HeapNumber::kValueOffset); 1075 __ vstr(d0, scratch, HeapNumber::kValueOffset);
1077 } else { 1076 } else {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1126 }
1128 break; 1127 break;
1129 case Token::SHR: 1128 case Token::SHR:
1130 ASSERT(!reversed_); 1129 ASSERT(!reversed_);
1131 if (shift_value != 0) { 1130 if (shift_value != 0) {
1132 __ mov(int32, Operand(int32, LSR, shift_value), SetCC); 1131 __ mov(int32, Operand(int32, LSR, shift_value), SetCC);
1133 } else { 1132 } else {
1134 // SHR is special because it is required to produce a positive answer. 1133 // SHR is special because it is required to produce a positive answer.
1135 __ cmp(int32, Operand(0, RelocInfo::NONE)); 1134 __ cmp(int32, Operand(0, RelocInfo::NONE));
1136 } 1135 }
1137 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 1136 if (CpuFeatures::IsSupported(VFP3)) {
1138 __ b(mi, &result_not_a_smi); 1137 __ b(mi, &result_not_a_smi);
1139 } else { 1138 } else {
1140 // Non VFP code cannot convert from unsigned to double, so fall back 1139 // Non VFP code cannot convert from unsigned to double, so fall back
1141 // to GenericBinaryOpStub. 1140 // to GenericBinaryOpStub.
1142 __ b(mi, entry_label()); 1141 __ b(mi, entry_label());
1143 } 1142 }
1144 break; 1143 break;
1145 case Token::SHL: 1144 case Token::SHL:
1146 ASSERT(!reversed_); 1145 ASSERT(!reversed_);
1147 if (shift_value != 0) { 1146 if (shift_value != 0) {
(...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 cc_reg_ = eq; 4590 cc_reg_ = eq;
4592 } 4591 }
4593 4592
4594 4593
4595 // Generates the Math.pow method. 4594 // Generates the Math.pow method.
4596 void CodeGenerator::GenerateMathPow(ZoneList<Expression*>* args) { 4595 void CodeGenerator::GenerateMathPow(ZoneList<Expression*>* args) {
4597 ASSERT(args->length() == 2); 4596 ASSERT(args->length() == 2);
4598 Load(args->at(0)); 4597 Load(args->at(0));
4599 Load(args->at(1)); 4598 Load(args->at(1));
4600 4599
4601 if (!Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 4600 if (!CpuFeatures::IsSupported(VFP3)) {
4602 frame_->CallRuntime(Runtime::kMath_pow, 2); 4601 frame_->CallRuntime(Runtime::kMath_pow, 2);
4603 frame_->EmitPush(r0); 4602 frame_->EmitPush(r0);
4604 } else { 4603 } else {
4605 CpuFeatures::Scope scope(VFP3); 4604 CpuFeatures::Scope scope(VFP3);
4606 JumpTarget runtime, done; 4605 JumpTarget runtime, done;
4607 Label exponent_nonsmi, base_nonsmi, powi, not_minus_half, allocate_return; 4606 Label exponent_nonsmi, base_nonsmi, powi, not_minus_half, allocate_return;
4608 4607
4609 Register scratch1 = VirtualFrame::scratch0(); 4608 Register scratch1 = VirtualFrame::scratch0();
4610 Register scratch2 = VirtualFrame::scratch1(); 4609 Register scratch2 = VirtualFrame::scratch1();
4611 4610
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
4745 frame_->EmitPush(base); 4744 frame_->EmitPush(base);
4746 } 4745 }
4747 } 4746 }
4748 4747
4749 4748
4750 // Generates the Math.sqrt method. 4749 // Generates the Math.sqrt method.
4751 void CodeGenerator::GenerateMathSqrt(ZoneList<Expression*>* args) { 4750 void CodeGenerator::GenerateMathSqrt(ZoneList<Expression*>* args) {
4752 ASSERT(args->length() == 1); 4751 ASSERT(args->length() == 1);
4753 Load(args->at(0)); 4752 Load(args->at(0));
4754 4753
4755 if (!Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 4754 if (!CpuFeatures::IsSupported(VFP3)) {
4756 frame_->CallRuntime(Runtime::kMath_sqrt, 1); 4755 frame_->CallRuntime(Runtime::kMath_sqrt, 1);
4757 frame_->EmitPush(r0); 4756 frame_->EmitPush(r0);
4758 } else { 4757 } else {
4759 CpuFeatures::Scope scope(VFP3); 4758 CpuFeatures::Scope scope(VFP3);
4760 JumpTarget runtime, done; 4759 JumpTarget runtime, done;
4761 4760
4762 Register scratch1 = VirtualFrame::scratch0(); 4761 Register scratch1 = VirtualFrame::scratch0();
4763 Register scratch2 = VirtualFrame::scratch1(); 4762 Register scratch2 = VirtualFrame::scratch1();
4764 4763
4765 // Get the value from the frame. 4764 // Get the value from the frame.
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
5334 __ bind(&slow_allocate_heapnumber); 5333 __ bind(&slow_allocate_heapnumber);
5335 // Allocate a heap number. 5334 // Allocate a heap number.
5336 __ CallRuntime(Runtime::kNumberAlloc, 0); 5335 __ CallRuntime(Runtime::kNumberAlloc, 0);
5337 __ mov(r4, Operand(r0)); 5336 __ mov(r4, Operand(r0));
5338 5337
5339 __ bind(&heapnumber_allocated); 5338 __ bind(&heapnumber_allocated);
5340 5339
5341 // Convert 32 random bits in r0 to 0.(32 random bits) in a double 5340 // Convert 32 random bits in r0 to 0.(32 random bits) in a double
5342 // by computing: 5341 // by computing:
5343 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 5342 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
5344 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 5343 if (CpuFeatures::IsSupported(VFP3)) {
5345 __ PrepareCallCFunction(0, r1); 5344 __ PrepareCallCFunction(1, r0);
5346 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 0); 5345 __ mov(r0, Operand(ExternalReference::isolate_address()));
5346 __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
5347 5347
5348 CpuFeatures::Scope scope(VFP3); 5348 CpuFeatures::Scope scope(VFP3);
5349 // 0x41300000 is the top half of 1.0 x 2^20 as a double. 5349 // 0x41300000 is the top half of 1.0 x 2^20 as a double.
5350 // Create this constant using mov/orr to avoid PC relative load. 5350 // Create this constant using mov/orr to avoid PC relative load.
5351 __ mov(r1, Operand(0x41000000)); 5351 __ mov(r1, Operand(0x41000000));
5352 __ orr(r1, r1, Operand(0x300000)); 5352 __ orr(r1, r1, Operand(0x300000));
5353 // Move 0x41300000xxxxxxxx (x = random bits) to VFP. 5353 // Move 0x41300000xxxxxxxx (x = random bits) to VFP.
5354 __ vmov(d7, r0, r1); 5354 __ vmov(d7, r0, r1);
5355 // Move 0x4130000000000000 to VFP. 5355 // Move 0x4130000000000000 to VFP.
5356 __ mov(r0, Operand(0, RelocInfo::NONE)); 5356 __ mov(r0, Operand(0, RelocInfo::NONE));
5357 __ vmov(d8, r0, r1); 5357 __ vmov(d8, r0, r1);
5358 // Subtract and store the result in the heap number. 5358 // Subtract and store the result in the heap number.
5359 __ vsub(d7, d7, d8); 5359 __ vsub(d7, d7, d8);
5360 __ sub(r0, r4, Operand(kHeapObjectTag)); 5360 __ sub(r0, r4, Operand(kHeapObjectTag));
5361 __ vstr(d7, r0, HeapNumber::kValueOffset); 5361 __ vstr(d7, r0, HeapNumber::kValueOffset);
5362 frame_->EmitPush(r4); 5362 frame_->EmitPush(r4);
5363 } else { 5363 } else {
5364 __ PrepareCallCFunction(2, r0);
5364 __ mov(r0, Operand(r4)); 5365 __ mov(r0, Operand(r4));
5365 __ PrepareCallCFunction(1, r1); 5366 __ mov(r1, Operand(ExternalReference::isolate_address()));
5366 __ CallCFunction( 5367 __ CallCFunction(
5367 ExternalReference::fill_heap_number_with_random_function(isolate()), 1); 5368 ExternalReference::fill_heap_number_with_random_function(isolate()), 2);
5368 frame_->EmitPush(r0); 5369 frame_->EmitPush(r0);
5369 } 5370 }
5370 } 5371 }
5371 5372
5372 5373
5373 void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) { 5374 void CodeGenerator::GenerateStringAdd(ZoneList<Expression*>* args) {
5374 ASSERT_EQ(2, args->length()); 5375 ASSERT_EQ(2, args->length());
5375 5376
5376 Load(args->at(0)); 5377 Load(args->at(0));
5377 Load(args->at(1)); 5378 Load(args->at(1));
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
5648 } 5649 }
5649 Load(args->at(n_args + 1)); // function 5650 Load(args->at(n_args + 1)); // function
5650 frame_->CallJSFunction(n_args); 5651 frame_->CallJSFunction(n_args);
5651 frame_->EmitPush(r0); 5652 frame_->EmitPush(r0);
5652 } 5653 }
5653 5654
5654 5655
5655 void CodeGenerator::GenerateMathSin(ZoneList<Expression*>* args) { 5656 void CodeGenerator::GenerateMathSin(ZoneList<Expression*>* args) {
5656 ASSERT_EQ(args->length(), 1); 5657 ASSERT_EQ(args->length(), 1);
5657 Load(args->at(0)); 5658 Load(args->at(0));
5658 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 5659 if (CpuFeatures::IsSupported(VFP3)) {
5659 TranscendentalCacheStub stub(TranscendentalCache::SIN, 5660 TranscendentalCacheStub stub(TranscendentalCache::SIN,
5660 TranscendentalCacheStub::TAGGED); 5661 TranscendentalCacheStub::TAGGED);
5661 frame_->SpillAllButCopyTOSToR0(); 5662 frame_->SpillAllButCopyTOSToR0();
5662 frame_->CallStub(&stub, 1); 5663 frame_->CallStub(&stub, 1);
5663 } else { 5664 } else {
5664 frame_->CallRuntime(Runtime::kMath_sin, 1); 5665 frame_->CallRuntime(Runtime::kMath_sin, 1);
5665 } 5666 }
5666 frame_->EmitPush(r0); 5667 frame_->EmitPush(r0);
5667 } 5668 }
5668 5669
5669 5670
5670 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) { 5671 void CodeGenerator::GenerateMathCos(ZoneList<Expression*>* args) {
5671 ASSERT_EQ(args->length(), 1); 5672 ASSERT_EQ(args->length(), 1);
5672 Load(args->at(0)); 5673 Load(args->at(0));
5673 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 5674 if (CpuFeatures::IsSupported(VFP3)) {
5674 TranscendentalCacheStub stub(TranscendentalCache::COS, 5675 TranscendentalCacheStub stub(TranscendentalCache::COS,
5675 TranscendentalCacheStub::TAGGED); 5676 TranscendentalCacheStub::TAGGED);
5676 frame_->SpillAllButCopyTOSToR0(); 5677 frame_->SpillAllButCopyTOSToR0();
5677 frame_->CallStub(&stub, 1); 5678 frame_->CallStub(&stub, 1);
5678 } else { 5679 } else {
5679 frame_->CallRuntime(Runtime::kMath_cos, 1); 5680 frame_->CallRuntime(Runtime::kMath_cos, 1);
5680 } 5681 }
5681 frame_->EmitPush(r0); 5682 frame_->EmitPush(r0);
5682 } 5683 }
5683 5684
5684 5685
5685 void CodeGenerator::GenerateMathLog(ZoneList<Expression*>* args) { 5686 void CodeGenerator::GenerateMathLog(ZoneList<Expression*>* args) {
5686 ASSERT_EQ(args->length(), 1); 5687 ASSERT_EQ(args->length(), 1);
5687 Load(args->at(0)); 5688 Load(args->at(0));
5688 if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) { 5689 if (CpuFeatures::IsSupported(VFP3)) {
5689 TranscendentalCacheStub stub(TranscendentalCache::LOG, 5690 TranscendentalCacheStub stub(TranscendentalCache::LOG,
5690 TranscendentalCacheStub::TAGGED); 5691 TranscendentalCacheStub::TAGGED);
5691 frame_->SpillAllButCopyTOSToR0(); 5692 frame_->SpillAllButCopyTOSToR0();
5692 frame_->CallStub(&stub, 1); 5693 frame_->CallStub(&stub, 1);
5693 } else { 5694 } else {
5694 frame_->CallRuntime(Runtime::kMath_log, 1); 5695 frame_->CallRuntime(Runtime::kMath_log, 1);
5695 } 5696 }
5696 frame_->EmitPush(r0); 5697 frame_->EmitPush(r0);
5697 } 5698 }
5698 5699
(...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after
7408 specialized_on_rhs_ ? "_ConstantRhs" : "", 7409 specialized_on_rhs_ ? "_ConstantRhs" : "",
7409 BinaryOpIC::GetName(runtime_operands_type_)); 7410 BinaryOpIC::GetName(runtime_operands_type_));
7410 return name_; 7411 return name_;
7411 } 7412 }
7412 7413
7413 #undef __ 7414 #undef __
7414 7415
7415 } } // namespace v8::internal 7416 } } // namespace v8::internal
7416 7417
7417 #endif // V8_TARGET_ARCH_ARM 7418 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/cpu-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698