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

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 215363004: Support for multiple register values (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_arm64.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 5006 matching lines...) Expand 10 before | Expand all | Expand 10 after
5017 __ vmovrrd(R0, R1, D0); 5017 __ vmovrrd(R0, R1, D0);
5018 __ vmovrrd(R2, R3, D1); 5018 __ vmovrrd(R2, R3, D1);
5019 __ CallRuntime(TargetFunction(), InputCount()); 5019 __ CallRuntime(TargetFunction(), InputCount());
5020 __ vmovdrr(D0, R0, R1); 5020 __ vmovdrr(D0, R0, R1);
5021 __ vmovdrr(D1, R2, R3); 5021 __ vmovdrr(D1, R2, R3);
5022 #endif 5022 #endif
5023 __ Bind(&skip_call); 5023 __ Bind(&skip_call);
5024 } 5024 }
5025 5025
5026 5026
5027 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(bool opt) const {
5028 // Only use this instruction in optimized code.
5029 ASSERT(opt);
5030 const intptr_t kNumInputs = 1;
5031 LocationSummary* summary =
5032 new LocationSummary(kNumInputs, 0, LocationSummary::kNoCall);
5033 if (representation() == kUnboxedDouble) {
5034 if (index() == 0) {
5035 summary->set_in(0, Location::Pair(Location::RequiresFpuRegister(),
5036 Location::Any()));
5037 } else {
5038 ASSERT(index() == 1);
5039 summary->set_in(0, Location::Pair(Location::Any(),
5040 Location::RequiresFpuRegister()));
5041 }
5042 summary->set_out(0, Location::RequiresFpuRegister());
5043 } else {
5044 ASSERT(representation() == kTagged);
5045 if (index() == 0) {
5046 summary->set_in(0, Location::Pair(Location::RequiresRegister(),
5047 Location::Any()));
5048 } else {
5049 ASSERT(index() == 1);
5050 summary->set_in(0, Location::Pair(Location::Any(),
5051 Location::RequiresRegister()));
5052 }
5053 summary->set_out(0, Location::RequiresRegister());
5054 }
5055 return summary;
5056 }
5057
5058
5059 void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5060 ASSERT(locs()->in(0).IsPairLocation());
5061 PairLocation* pair = locs()->in(0).AsPairLocation();
5062 Location in_loc = pair->At(index());
5063 if (representation() == kUnboxedDouble) {
5064 QRegister out = locs()->out(0).fpu_reg();
5065 QRegister in = in_loc.fpu_reg();
5066 __ vmovq(out, in);
5067 } else {
5068 ASSERT(representation() == kTagged);
5069 Register out = locs()->out(0).reg();
5070 Register in = in_loc.reg();
5071 __ mov(out, ShifterOperand(in));
5072 }
5073 }
5074
5075
5027 LocationSummary* MergedMathInstr::MakeLocationSummary(bool opt) const { 5076 LocationSummary* MergedMathInstr::MakeLocationSummary(bool opt) const {
5028 if (kind() == MergedMathInstr::kTruncDivMod) { 5077 if (kind() == MergedMathInstr::kTruncDivMod) {
5029 const intptr_t kNumInputs = 2; 5078 const intptr_t kNumInputs = 2;
5030 const intptr_t kNumTemps = 4; 5079 const intptr_t kNumTemps = 2;
5031 LocationSummary* summary = 5080 LocationSummary* summary =
5032 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 5081 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
5033 summary->set_in(0, Location::RequiresRegister()); 5082 summary->set_in(0, Location::RequiresRegister());
5034 summary->set_in(1, Location::RequiresRegister()); 5083 summary->set_in(1, Location::RequiresRegister());
5035 summary->set_temp(0, Location::RequiresRegister()); 5084 summary->set_temp(0, Location::RequiresRegister());
5036 summary->set_temp(1, Location::RequiresFpuRegister()); 5085 summary->set_temp(1, Location::RequiresFpuRegister());
5037 summary->set_temp(2, Location::RequiresRegister()); // result_div. 5086 // Output is a pair of registers.
5038 summary->set_temp(3, Location::RequiresRegister()); // result_mod. 5087 summary->set_out(0, Location::Pair(Location::RequiresRegister(),
5039 summary->set_out(0, Location::RequiresRegister()); 5088 Location::RequiresRegister()));
5040 return summary; 5089 return summary;
5041 } 5090 }
5042 UNIMPLEMENTED(); 5091 UNIMPLEMENTED();
5043 return NULL; 5092 return NULL;
5044 } 5093 }
5045 5094
5046 5095
5047 void MergedMathInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 5096 void MergedMathInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5048 Label* deopt = NULL; 5097 Label* deopt = NULL;
5049 if (CanDeoptimize()) { 5098 if (CanDeoptimize()) {
5050 deopt = compiler->AddDeoptStub(deopt_id(), kDeoptBinarySmiOp); 5099 deopt = compiler->AddDeoptStub(deopt_id(), kDeoptBinarySmiOp);
5051 } 5100 }
5052 if (kind() == MergedMathInstr::kTruncDivMod) { 5101 if (kind() == MergedMathInstr::kTruncDivMod) {
5053 Register left = locs()->in(0).reg(); 5102 Register left = locs()->in(0).reg();
5054 Register right = locs()->in(1).reg(); 5103 Register right = locs()->in(1).reg();
5055 Register result = locs()->out(0).reg(); 5104 ASSERT(locs()->out(0).IsPairLocation());
5105 PairLocation* pair = locs()->out(0).AsPairLocation();
5106 Register result_div = pair->At(0).reg();
5107 Register result_mod = pair->At(1).reg();
5056 Range* right_range = InputAt(1)->definition()->range(); 5108 Range* right_range = InputAt(1)->definition()->range();
5057 if ((right_range == NULL) || right_range->Overlaps(0, 0)) { 5109 if ((right_range == NULL) || right_range->Overlaps(0, 0)) {
5058 // Handle divide by zero in runtime. 5110 // Handle divide by zero in runtime.
5059 __ cmp(right, ShifterOperand(0)); 5111 __ cmp(right, ShifterOperand(0));
5060 __ b(deopt, EQ); 5112 __ b(deopt, EQ);
5061 } 5113 }
5062 Register temp = locs()->temp(0).reg(); 5114 Register temp = locs()->temp(0).reg();
5063 DRegister dtemp = EvenDRegisterOf(locs()->temp(1).fpu_reg()); 5115 DRegister dtemp = EvenDRegisterOf(locs()->temp(1).fpu_reg());
5064 Register result_div = locs()->temp(2).reg(); 5116
5065 Register result_mod = locs()->temp(3).reg();
5066 __ Asr(temp, left, kSmiTagSize); // SmiUntag left into temp. 5117 __ Asr(temp, left, kSmiTagSize); // SmiUntag left into temp.
5067 __ Asr(IP, right, kSmiTagSize); // SmiUntag right into IP. 5118 __ Asr(IP, right, kSmiTagSize); // SmiUntag right into IP.
5068 5119
5069 __ IntegerDivide(result_div, temp, IP, dtemp, DTMP); 5120 __ IntegerDivide(result_div, temp, IP, dtemp, DTMP);
5070 5121
5071 // Check the corner case of dividing the 'MIN_SMI' with -1, in which 5122 // Check the corner case of dividing the 'MIN_SMI' with -1, in which
5072 // case we cannot tag the result. 5123 // case we cannot tag the result.
5073 __ CompareImmediate(result_div, 0x40000000); 5124 __ CompareImmediate(result_div, 0x40000000);
5074 __ b(deopt, EQ); 5125 __ b(deopt, EQ);
5075 __ Asr(IP, right, kSmiTagSize); // SmiUntag right into IP. 5126 __ Asr(IP, right, kSmiTagSize); // SmiUntag right into IP.
(...skipping 12 matching lines...) Expand all
5088 // } 5139 // }
5089 Label done; 5140 Label done;
5090 __ cmp(result_mod, ShifterOperand(0)); 5141 __ cmp(result_mod, ShifterOperand(0));
5091 __ b(&done, GE); 5142 __ b(&done, GE);
5092 // Result is negative, adjust it. 5143 // Result is negative, adjust it.
5093 __ cmp(right, ShifterOperand(0)); 5144 __ cmp(right, ShifterOperand(0));
5094 __ sub(result_mod, result_mod, ShifterOperand(right), LT); 5145 __ sub(result_mod, result_mod, ShifterOperand(right), LT);
5095 __ add(result_mod, result_mod, ShifterOperand(right), GE); 5146 __ add(result_mod, result_mod, ShifterOperand(right), GE);
5096 __ Bind(&done); 5147 __ Bind(&done);
5097 5148
5098 __ LoadObject(result, Array::ZoneHandle(Array::New(2, Heap::kOld)));
5099 // Note that index is expected smi-tagged, (i.e, times 2) for all arrays.
5100 // [0]: divide resut, [1]: mod result.
5101 __ mov(temp, ShifterOperand(0 +
5102 FlowGraphCompiler::DataOffsetFor(kArrayCid) - kHeapObjectTag));
5103 Address store_address(result, temp, LSL, 0);
5104 __ StoreIntoObjectNoBarrier(result, store_address, result_div);
5105 __ add(temp, temp, ShifterOperand(kWordSize));
5106 __ StoreIntoObjectNoBarrier(result, store_address, result_mod);
5107 return; 5149 return;
5108 } 5150 }
5109 if (kind() == MergedMathInstr::kSinCos) { 5151 if (kind() == MergedMathInstr::kSinCos) {
5110 UNIMPLEMENTED(); 5152 UNIMPLEMENTED();
5111 } 5153 }
5112 UNIMPLEMENTED(); 5154 UNIMPLEMENTED();
5113 } 5155 }
5114 5156
5115 5157
5116 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( 5158 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary(
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
5862 compiler->GenerateCall(token_pos(), 5904 compiler->GenerateCall(token_pos(),
5863 &label, 5905 &label,
5864 PcDescriptors::kOther, 5906 PcDescriptors::kOther,
5865 locs()); 5907 locs());
5866 __ Drop(ArgumentCount()); // Discard arguments. 5908 __ Drop(ArgumentCount()); // Discard arguments.
5867 } 5909 }
5868 5910
5869 } // namespace dart 5911 } // namespace dart
5870 5912
5871 #endif // defined TARGET_ARCH_ARM 5913 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698