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

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

Issue 504143003: Support Int32 representation for selected binary operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 const intptr_t kNumTemps = 1; 319 const intptr_t kNumTemps = 1;
320 LocationSummary* locs = new(isolate) LocationSummary( 320 LocationSummary* locs = new(isolate) LocationSummary(
321 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 321 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
322 locs->set_out(0, Location::RequiresFpuRegister()); 322 locs->set_out(0, Location::RequiresFpuRegister());
323 locs->set_temp(0, Location::RequiresRegister()); 323 locs->set_temp(0, Location::RequiresRegister());
324 return locs; 324 return locs;
325 } 325 }
326 326
327 327
328 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 328 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
329 ASSERT(representation_ == kUnboxedDouble);
329 // The register allocator drops constant definitions that have no uses. 330 // The register allocator drops constant definitions that have no uses.
330 if (!locs()->out(0).IsInvalid()) { 331 if (!locs()->out(0).IsInvalid()) {
331 ASSERT(value().IsDouble()); 332 ASSERT(value().IsDouble());
332 const Register const_value = locs()->temp(0).reg(); 333 const Register const_value = locs()->temp(0).reg();
333 const DRegister result = locs()->out(0).fpu_reg(); 334 const DRegister result = locs()->out(0).fpu_reg();
334 __ LoadObject(const_value, value()); 335 __ LoadObject(const_value, value());
335 __ LoadDFromOffset(result, const_value, 336 __ LoadDFromOffset(result, const_value,
336 Double::value_offset() - kHeapObjectTag); 337 Double::value_offset() - kHeapObjectTag);
337 } 338 }
338 } 339 }
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 1116
1116 1117
1117 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate, 1118 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Isolate* isolate,
1118 bool opt) const { 1119 bool opt) const {
1119 const intptr_t kNumInputs = 2; 1120 const intptr_t kNumInputs = 2;
1120 const intptr_t kNumTemps = 0; 1121 const intptr_t kNumTemps = 0;
1121 LocationSummary* locs = new(isolate) LocationSummary( 1122 LocationSummary* locs = new(isolate) LocationSummary(
1122 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1123 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1123 locs->set_in(0, Location::RequiresRegister()); 1124 locs->set_in(0, Location::RequiresRegister());
1124 if (CanBeImmediateIndex(index(), class_id(), IsExternal())) { 1125 if (CanBeImmediateIndex(index(), class_id(), IsExternal())) {
1125 locs->set_in(1, Location::Constant(index()->BoundConstant())); 1126 locs->set_in(1, Location::Constant(index()->definition()->AsConstant()));
1126 } else { 1127 } else {
1127 locs->set_in(1, Location::RequiresRegister()); 1128 locs->set_in(1, Location::RequiresRegister());
1128 } 1129 }
1129 if ((representation() == kUnboxedDouble) || 1130 if ((representation() == kUnboxedDouble) ||
1130 (representation() == kUnboxedFloat32x4) || 1131 (representation() == kUnboxedFloat32x4) ||
1131 (representation() == kUnboxedInt32x4)) { 1132 (representation() == kUnboxedInt32x4)) {
1132 locs->set_out(0, Location::RequiresFpuRegister()); 1133 locs->set_out(0, Location::RequiresFpuRegister());
1133 } else { 1134 } else {
1134 locs->set_out(0, Location::RequiresRegister()); 1135 locs->set_out(0, Location::RequiresRegister());
1135 } 1136 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 1269
1269 1270
1270 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate, 1271 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Isolate* isolate,
1271 bool opt) const { 1272 bool opt) const {
1272 const intptr_t kNumInputs = 3; 1273 const intptr_t kNumInputs = 3;
1273 const intptr_t kNumTemps = 0; 1274 const intptr_t kNumTemps = 0;
1274 LocationSummary* locs = new(isolate) LocationSummary( 1275 LocationSummary* locs = new(isolate) LocationSummary(
1275 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 1276 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1276 locs->set_in(0, Location::RequiresRegister()); 1277 locs->set_in(0, Location::RequiresRegister());
1277 if (CanBeImmediateIndex(index(), class_id(), IsExternal())) { 1278 if (CanBeImmediateIndex(index(), class_id(), IsExternal())) {
1278 locs->set_in(1, Location::Constant(index()->BoundConstant())); 1279 locs->set_in(1, Location::Constant(index()->definition()->AsConstant()));
1279 } else { 1280 } else {
1280 locs->set_in(1, Location::WritableRegister()); 1281 locs->set_in(1, Location::WritableRegister());
1281 } 1282 }
1282 switch (class_id()) { 1283 switch (class_id()) {
1283 case kArrayCid: 1284 case kArrayCid:
1284 locs->set_in(2, ShouldEmitStoreBarrier() 1285 locs->set_in(2, ShouldEmitStoreBarrier()
1285 ? Location::WritableRegister() 1286 ? Location::WritableRegister()
1286 : Location::RegisterOrConstant(value())); 1287 : Location::RegisterOrConstant(value()));
1287 break; 1288 break;
1288 case kExternalTypedDataUint8ArrayCid: 1289 case kExternalTypedDataUint8ArrayCid:
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 (op_kind() == Token::kMOD) || 2718 (op_kind() == Token::kMOD) ||
2718 (op_kind() == Token::kTRUNCDIV) || 2719 (op_kind() == Token::kTRUNCDIV) ||
2719 (((op_kind() == Token::kSHL) && !IsTruncating()) || 2720 (((op_kind() == Token::kSHL) && !IsTruncating()) ||
2720 (op_kind() == Token::kSHR))) ? 1 : 0; 2721 (op_kind() == Token::kSHR))) ? 1 : 0;
2721 LocationSummary* summary = new(isolate) LocationSummary( 2722 LocationSummary* summary = new(isolate) LocationSummary(
2722 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 2723 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
2723 if (op_kind() == Token::kTRUNCDIV) { 2724 if (op_kind() == Token::kTRUNCDIV) {
2724 summary->set_in(0, Location::RequiresRegister()); 2725 summary->set_in(0, Location::RequiresRegister());
2725 if (RightIsPowerOfTwoConstant()) { 2726 if (RightIsPowerOfTwoConstant()) {
2726 ConstantInstr* right_constant = right()->definition()->AsConstant(); 2727 ConstantInstr* right_constant = right()->definition()->AsConstant();
2727 summary->set_in(1, Location::Constant(right_constant->value())); 2728 summary->set_in(1, Location::Constant(right_constant));
2728 } else { 2729 } else {
2729 summary->set_in(1, Location::RequiresRegister()); 2730 summary->set_in(1, Location::RequiresRegister());
2730 } 2731 }
2731 summary->set_temp(0, Location::RequiresRegister()); 2732 summary->set_temp(0, Location::RequiresRegister());
2732 summary->set_out(0, Location::RequiresRegister()); 2733 summary->set_out(0, Location::RequiresRegister());
2733 return summary; 2734 return summary;
2734 } 2735 }
2735 if (op_kind() == Token::kMOD) { 2736 if (op_kind() == Token::kMOD) {
2736 summary->set_in(0, Location::RequiresRegister()); 2737 summary->set_in(0, Location::RequiresRegister());
2737 summary->set_in(1, Location::RequiresRegister()); 2738 summary->set_in(1, Location::RequiresRegister());
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
3828 const Double& minus_one = Double::ZoneHandle(Double::NewCanonical(-1)); 3829 const Double& minus_one = Double::ZoneHandle(Double::NewCanonical(-1));
3829 __ LoadObject(TMP, minus_one); 3830 __ LoadObject(TMP, minus_one);
3830 FpuRegister result = locs()->out(0).fpu_reg(); 3831 FpuRegister result = locs()->out(0).fpu_reg();
3831 FpuRegister value = locs()->in(0).fpu_reg(); 3832 FpuRegister value = locs()->in(0).fpu_reg();
3832 FpuRegister temp_fp = locs()->temp(0).fpu_reg(); 3833 FpuRegister temp_fp = locs()->temp(0).fpu_reg();
3833 __ LoadDFromOffset(temp_fp, TMP, Double::value_offset() - kHeapObjectTag); 3834 __ LoadDFromOffset(temp_fp, TMP, Double::value_offset() - kHeapObjectTag);
3834 __ muld(result, value, temp_fp); 3835 __ muld(result, value, temp_fp);
3835 } 3836 }
3836 3837
3837 3838
3839 DEFINE_UNIMPLEMENTED_INSTRUCTION(Int32ToDoubleInstr)
3840
3838 3841
3839 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate, 3842 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate,
3840 bool opt) const { 3843 bool opt) const {
3841 const intptr_t kNumInputs = 1; 3844 const intptr_t kNumInputs = 1;
3842 const intptr_t kNumTemps = 0; 3845 const intptr_t kNumTemps = 0;
3843 LocationSummary* result = new(isolate) LocationSummary( 3846 LocationSummary* result = new(isolate) LocationSummary(
3844 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3847 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3845 result->set_in(0, Location::RequiresRegister()); 3848 result->set_in(0, Location::RequiresRegister());
3846 result->set_out(0, Location::RequiresFpuRegister()); 3849 result->set_out(0, Location::RequiresFpuRegister());
3847 return result; 3850 return result;
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
4551 CompileType ShiftUint32OpInstr::ComputeType() const { 4554 CompileType ShiftUint32OpInstr::ComputeType() const {
4552 return CompileType::Int(); 4555 return CompileType::Int();
4553 } 4556 }
4554 4557
4555 4558
4556 CompileType UnaryUint32OpInstr::ComputeType() const { 4559 CompileType UnaryUint32OpInstr::ComputeType() const {
4557 return CompileType::Int(); 4560 return CompileType::Int();
4558 } 4561 }
4559 4562
4560 4563
4561 CompileType BoxUint32Instr::ComputeType() const { 4564 DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryUint32OpInstr)
4562 return CompileType::Int(); 4565 DEFINE_UNIMPLEMENTED_INSTRUCTION(ShiftUint32OpInstr)
4563 } 4566 DEFINE_UNIMPLEMENTED_INSTRUCTION(UnaryUint32OpInstr)
4564 4567 DEFINE_UNIMPLEMENTED_INSTRUCTION(BoxInt32Instr)
4565 4568 DEFINE_UNIMPLEMENTED_INSTRUCTION(UnboxInt32Instr)
4566 CompileType UnboxUint32Instr::ComputeType() const { 4569 DEFINE_UNIMPLEMENTED_INSTRUCTION(BinaryInt32OpInstr)
4567 return CompileType::Int(); 4570 DEFINE_UNIMPLEMENTED_INSTRUCTION(BoxUint32Instr)
4568 } 4571 DEFINE_UNIMPLEMENTED_INSTRUCTION(UnboxUint32Instr)
4569 4572 DEFINE_UNIMPLEMENTED_INSTRUCTION(UnboxedIntConverterInstr)
4570
4571 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Isolate* isolate,
4572 bool opt) const {
4573 UNIMPLEMENTED();
4574 return NULL;
4575 }
4576
4577
4578 void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4579 UNIMPLEMENTED();
4580 }
4581
4582
4583 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Isolate* isolate,
4584 bool opt) const {
4585 UNIMPLEMENTED();
4586 return NULL;
4587 }
4588
4589
4590 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4591 UNIMPLEMENTED();
4592 }
4593
4594
4595 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Isolate* isolate,
4596 bool opt) const {
4597 UNIMPLEMENTED();
4598 return NULL;
4599 }
4600
4601
4602 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4603 UNIMPLEMENTED();
4604 }
4605
4606
4607 LocationSummary* UnboxUint32Instr::MakeLocationSummary(Isolate* isolate,
4608 bool opt) const {
4609 UNIMPLEMENTED();
4610 return NULL;
4611 }
4612
4613
4614 void UnboxUint32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4615 UNIMPLEMENTED();
4616 }
4617
4618
4619 LocationSummary* BoxUint32Instr::MakeLocationSummary(Isolate* isolate,
4620 bool opt) const {
4621 UNIMPLEMENTED();
4622 return NULL;
4623 }
4624
4625
4626 void BoxUint32Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
4627 UNIMPLEMENTED();
4628 }
4629
4630
4631 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Isolate* isolate,
4632 bool opt) const {
4633 UNIMPLEMENTED();
4634 return NULL;
4635 }
4636
4637
4638 void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4639 UNIMPLEMENTED();
4640 }
4641 4573
4642 4574
4643 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate, 4575 LocationSummary* ThrowInstr::MakeLocationSummary(Isolate* isolate,
4644 bool opt) const { 4576 bool opt) const {
4645 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall); 4577 return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kCall);
4646 } 4578 }
4647 4579
4648 4580
4649 4581
4650 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4582 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4879 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4811 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4880 #if defined(DEBUG) 4812 #if defined(DEBUG)
4881 __ LoadImmediate(S4, kInvalidObjectPointer); 4813 __ LoadImmediate(S4, kInvalidObjectPointer);
4882 __ LoadImmediate(S5, kInvalidObjectPointer); 4814 __ LoadImmediate(S5, kInvalidObjectPointer);
4883 #endif 4815 #endif
4884 } 4816 }
4885 4817
4886 } // namespace dart 4818 } // namespace dart
4887 4819
4888 #endif // defined TARGET_ARCH_MIPS 4820 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698