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

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

Issue 23219002: Add double unary operation (negate). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 case Token::kBIT_NOT: 3223 case Token::kBIT_NOT:
3224 __ nor(result, value, ZR); 3224 __ nor(result, value, ZR);
3225 __ addiu(result, result, Immediate(-1)); // Remove inverted smi-tag. 3225 __ addiu(result, result, Immediate(-1)); // Remove inverted smi-tag.
3226 break; 3226 break;
3227 default: 3227 default:
3228 UNREACHABLE(); 3228 UNREACHABLE();
3229 } 3229 }
3230 } 3230 }
3231 3231
3232 3232
3233 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary() const {
3234 const intptr_t kNumInputs = 1;
3235 const intptr_t kNumTemps = 2;
3236 LocationSummary* summary =
3237 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3238 summary->set_in(0, Location::RequiresFpuRegister());
3239 summary->set_out(Location::RequiresFpuRegister());
3240 summary->set_temp(0, Location::RequiresRegister());
3241 summary->set_in(2, Location::RequiresFpuRegister());
3242 return summary;
3243 }
3244
3245
3246 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3247 Register temp = locs()->temp(0).reg();
3248 const Double& minus_one = Double::ZoneHandle(Double::NewCanonical(-1));
3249 __ LoadObject(temp, minus_one);
3250 FpuRegister result = locs()->out().fpu_reg();
3251 FpuRegister value = locs()->in(0).fpu_reg();
3252 FpuRegister temp_fp = locs()->temp(1).fpu_reg();
3253 __ LoadDFromOffset(temp_fp, temp, Double::value_offset() - kHeapObjectTag);
3254 __ muld(result, value, temp_fp);
regis 2013/08/14 22:07:47 Please add a TODO(zra) to support negd.
srdjan 2013/08/14 23:04:30 Done.
3255 }
3256
3257
3258
3233 LocationSummary* SmiToDoubleInstr::MakeLocationSummary() const { 3259 LocationSummary* SmiToDoubleInstr::MakeLocationSummary() const {
3234 const intptr_t kNumInputs = 1; 3260 const intptr_t kNumInputs = 1;
3235 const intptr_t kNumTemps = 0; 3261 const intptr_t kNumTemps = 0;
3236 LocationSummary* result = 3262 LocationSummary* result =
3237 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 3263 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
3238 result->set_in(0, Location::WritableRegister()); 3264 result->set_in(0, Location::WritableRegister());
3239 result->set_out(Location::RequiresFpuRegister()); 3265 result->set_out(Location::RequiresFpuRegister());
3240 return result; 3266 return result;
3241 } 3267 }
3242 3268
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
3883 compiler->GenerateCall(token_pos(), 3909 compiler->GenerateCall(token_pos(),
3884 &label, 3910 &label,
3885 PcDescriptors::kOther, 3911 PcDescriptors::kOther,
3886 locs()); 3912 locs());
3887 __ Drop(2); // Discard type arguments and receiver. 3913 __ Drop(2); // Discard type arguments and receiver.
3888 } 3914 }
3889 3915
3890 } // namespace dart 3916 } // namespace dart
3891 3917
3892 #endif // defined TARGET_ARCH_MIPS 3918 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698