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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 11280106: MIPS: DoNumberTagD performance improvement (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on r13080 Created 8 years 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 | « no previous file | src/mips/macro-assembler-mips.h » ('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 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 4233 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 } 4244 }
4245 __ mtc1(src, dbl_scratch); 4245 __ mtc1(src, dbl_scratch);
4246 __ cvt_d_w(dbl_scratch, dbl_scratch); 4246 __ cvt_d_w(dbl_scratch, dbl_scratch);
4247 } else { 4247 } else {
4248 __ mtc1(src, dbl_scratch); 4248 __ mtc1(src, dbl_scratch);
4249 __ Cvt_d_uw(dbl_scratch, dbl_scratch, f22); 4249 __ Cvt_d_uw(dbl_scratch, dbl_scratch, f22);
4250 } 4250 }
4251 4251
4252 if (FLAG_inline_new) { 4252 if (FLAG_inline_new) {
4253 __ LoadRoot(t2, Heap::kHeapNumberMapRootIndex); 4253 __ LoadRoot(t2, Heap::kHeapNumberMapRootIndex);
4254 __ AllocateHeapNumber(t1, a3, t0, t2, &slow); 4254 __ AllocateHeapNumber(t1, a3, t0, t2, &slow, DONT_TAG_RESULT);
4255 __ Move(dst, t1); 4255 __ Move(dst, t1);
4256 __ Branch(&done); 4256 __ Branch(&done);
4257 } 4257 }
4258 4258
4259 // Slow case: Call the runtime system to do the number allocation. 4259 // Slow case: Call the runtime system to do the number allocation.
4260 __ bind(&slow); 4260 __ bind(&slow);
4261 4261
4262 // TODO(3095996): Put a valid pointer value in the stack slot where the result 4262 // TODO(3095996): Put a valid pointer value in the stack slot where the result
4263 // register is stored, as this register is in the pointer map, but contains an 4263 // register is stored, as this register is in the pointer map, but contains an
4264 // integer value. 4264 // integer value.
4265 __ StoreToSafepointRegisterSlot(zero_reg, dst); 4265 __ StoreToSafepointRegisterSlot(zero_reg, dst);
4266 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); 4266 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
4267 __ Move(dst, v0); 4267 __ Move(dst, v0);
4268 __ Subu(dst, dst, kHeapObjectTag);
4268 4269
4269 // Done. Put the value in dbl_scratch into the value of the allocated heap 4270 // Done. Put the value in dbl_scratch into the value of the allocated heap
4270 // number. 4271 // number.
4271 __ bind(&done); 4272 __ bind(&done);
4272 __ sdc1(dbl_scratch, FieldMemOperand(dst, HeapNumber::kValueOffset)); 4273 __ sdc1(dbl_scratch, MemOperand(dst, HeapNumber::kValueOffset));
4274 __ Addu(dst, dst, kHeapObjectTag);
4273 __ StoreToSafepointRegisterSlot(dst, dst); 4275 __ StoreToSafepointRegisterSlot(dst, dst);
4274 } 4276 }
4275 4277
4276 4278
4277 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { 4279 void LCodeGen::DoNumberTagD(LNumberTagD* instr) {
4278 class DeferredNumberTagD: public LDeferredCode { 4280 class DeferredNumberTagD: public LDeferredCode {
4279 public: 4281 public:
4280 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) 4282 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr)
4281 : LDeferredCode(codegen), instr_(instr) { } 4283 : LDeferredCode(codegen), instr_(instr) { }
4282 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } 4284 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); }
4283 virtual LInstruction* instr() { return instr_; } 4285 virtual LInstruction* instr() { return instr_; }
4284 private: 4286 private:
4285 LNumberTagD* instr_; 4287 LNumberTagD* instr_;
4286 }; 4288 };
4287 4289
4288 DoubleRegister input_reg = ToDoubleRegister(instr->value()); 4290 DoubleRegister input_reg = ToDoubleRegister(instr->value());
4289 Register scratch = scratch0(); 4291 Register scratch = scratch0();
4290 Register reg = ToRegister(instr->result()); 4292 Register reg = ToRegister(instr->result());
4291 Register temp1 = ToRegister(instr->temp()); 4293 Register temp1 = ToRegister(instr->temp());
4292 Register temp2 = ToRegister(instr->temp2()); 4294 Register temp2 = ToRegister(instr->temp2());
4293 4295
4294 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); 4296 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr);
4295 if (FLAG_inline_new) { 4297 if (FLAG_inline_new) {
4296 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); 4298 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex);
4297 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); 4299 // We want the untagged address first for performance
4300 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(),
4301 DONT_TAG_RESULT);
4298 } else { 4302 } else {
4299 __ Branch(deferred->entry()); 4303 __ Branch(deferred->entry());
4300 } 4304 }
4301 __ bind(deferred->exit()); 4305 __ bind(deferred->exit());
4302 __ sdc1(input_reg, FieldMemOperand(reg, HeapNumber::kValueOffset)); 4306 __ sdc1(input_reg, MemOperand(reg, HeapNumber::kValueOffset));
4307 // Now that we have finished with the object's real address tag it
4308 __ Addu(reg, reg, kHeapObjectTag);
4303 } 4309 }
4304 4310
4305 4311
4306 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { 4312 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) {
4307 // TODO(3095996): Get rid of this. For now, we need to make the 4313 // TODO(3095996): Get rid of this. For now, we need to make the
4308 // result register contain a valid pointer because it is already 4314 // result register contain a valid pointer because it is already
4309 // contained in the register pointer map. 4315 // contained in the register pointer map.
4310 Register reg = ToRegister(instr->result()); 4316 Register reg = ToRegister(instr->result());
4311 __ mov(reg, zero_reg); 4317 __ mov(reg, zero_reg);
4312 4318
4313 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); 4319 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
4314 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); 4320 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr);
4321 __ Subu(v0, v0, kHeapObjectTag);
4315 __ StoreToSafepointRegisterSlot(v0, reg); 4322 __ StoreToSafepointRegisterSlot(v0, reg);
4316 } 4323 }
4317 4324
4318 4325
4319 void LCodeGen::DoSmiTag(LSmiTag* instr) { 4326 void LCodeGen::DoSmiTag(LSmiTag* instr) {
4320 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); 4327 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow));
4321 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value())); 4328 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value()));
4322 } 4329 }
4323 4330
4324 4331
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
5501 __ Subu(scratch, result, scratch); 5508 __ Subu(scratch, result, scratch);
5502 __ lw(result, FieldMemOperand(scratch, 5509 __ lw(result, FieldMemOperand(scratch,
5503 FixedArray::kHeaderSize - kPointerSize)); 5510 FixedArray::kHeaderSize - kPointerSize));
5504 __ bind(&done); 5511 __ bind(&done);
5505 } 5512 }
5506 5513
5507 5514
5508 #undef __ 5515 #undef __
5509 5516
5510 } } // namespace v8::internal 5517 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698