| OLD | NEW |
| 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 4428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4439 } | 4439 } |
| 4440 __ vmov(flt_scratch, src); | 4440 __ vmov(flt_scratch, src); |
| 4441 __ vcvt_f64_s32(dbl_scratch, flt_scratch); | 4441 __ vcvt_f64_s32(dbl_scratch, flt_scratch); |
| 4442 } else { | 4442 } else { |
| 4443 __ vmov(flt_scratch, src); | 4443 __ vmov(flt_scratch, src); |
| 4444 __ vcvt_f64_u32(dbl_scratch, flt_scratch); | 4444 __ vcvt_f64_u32(dbl_scratch, flt_scratch); |
| 4445 } | 4445 } |
| 4446 | 4446 |
| 4447 if (FLAG_inline_new) { | 4447 if (FLAG_inline_new) { |
| 4448 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); | 4448 __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex); |
| 4449 __ AllocateHeapNumber(r5, r3, r4, r6, &slow); | 4449 __ AllocateHeapNumber(r5, r3, r4, r6, &slow, DONT_TAG_RESULT); |
| 4450 __ Move(dst, r5); | 4450 __ Move(dst, r5); |
| 4451 __ b(&done); | 4451 __ b(&done); |
| 4452 } | 4452 } |
| 4453 | 4453 |
| 4454 // Slow case: Call the runtime system to do the number allocation. | 4454 // Slow case: Call the runtime system to do the number allocation. |
| 4455 __ bind(&slow); | 4455 __ bind(&slow); |
| 4456 | 4456 |
| 4457 // TODO(3095996): Put a valid pointer value in the stack slot where the result | 4457 // TODO(3095996): Put a valid pointer value in the stack slot where the result |
| 4458 // register is stored, as this register is in the pointer map, but contains an | 4458 // register is stored, as this register is in the pointer map, but contains an |
| 4459 // integer value. | 4459 // integer value. |
| 4460 __ mov(ip, Operand(0)); | 4460 __ mov(ip, Operand(0)); |
| 4461 __ StoreToSafepointRegisterSlot(ip, dst); | 4461 __ StoreToSafepointRegisterSlot(ip, dst); |
| 4462 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); | 4462 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
| 4463 __ Move(dst, r0); | 4463 __ Move(dst, r0); |
| 4464 __ sub(dst, dst, Operand(kHeapObjectTag)); |
| 4464 | 4465 |
| 4465 // Done. Put the value in dbl_scratch into the value of the allocated heap | 4466 // Done. Put the value in dbl_scratch into the value of the allocated heap |
| 4466 // number. | 4467 // number. |
| 4467 __ bind(&done); | 4468 __ bind(&done); |
| 4468 __ sub(ip, dst, Operand(kHeapObjectTag)); | 4469 __ vstr(dbl_scratch, dst, HeapNumber::kValueOffset); |
| 4469 __ vstr(dbl_scratch, ip, HeapNumber::kValueOffset); | 4470 __ add(dst, dst, Operand(kHeapObjectTag)); |
| 4470 __ StoreToSafepointRegisterSlot(dst, dst); | 4471 __ StoreToSafepointRegisterSlot(dst, dst); |
| 4471 } | 4472 } |
| 4472 | 4473 |
| 4473 | 4474 |
| 4474 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4475 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4475 class DeferredNumberTagD: public LDeferredCode { | 4476 class DeferredNumberTagD: public LDeferredCode { |
| 4476 public: | 4477 public: |
| 4477 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4478 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 4478 : LDeferredCode(codegen), instr_(instr) { } | 4479 : LDeferredCode(codegen), instr_(instr) { } |
| 4479 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } | 4480 virtual void Generate() { codegen()->DoDeferredNumberTagD(instr_); } |
| 4480 virtual LInstruction* instr() { return instr_; } | 4481 virtual LInstruction* instr() { return instr_; } |
| 4481 private: | 4482 private: |
| 4482 LNumberTagD* instr_; | 4483 LNumberTagD* instr_; |
| 4483 }; | 4484 }; |
| 4484 | 4485 |
| 4485 DoubleRegister input_reg = ToDoubleRegister(instr->value()); | 4486 DoubleRegister input_reg = ToDoubleRegister(instr->value()); |
| 4486 Register scratch = scratch0(); | 4487 Register scratch = scratch0(); |
| 4487 Register reg = ToRegister(instr->result()); | 4488 Register reg = ToRegister(instr->result()); |
| 4488 Register temp1 = ToRegister(instr->temp()); | 4489 Register temp1 = ToRegister(instr->temp()); |
| 4489 Register temp2 = ToRegister(instr->temp2()); | 4490 Register temp2 = ToRegister(instr->temp2()); |
| 4490 | 4491 |
| 4491 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); | 4492 DeferredNumberTagD* deferred = new(zone()) DeferredNumberTagD(this, instr); |
| 4492 if (FLAG_inline_new) { | 4493 if (FLAG_inline_new) { |
| 4493 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); | 4494 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); |
| 4494 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry()); | 4495 // We want the untagged address first for performance |
| 4496 __ AllocateHeapNumber(reg, temp1, temp2, scratch, deferred->entry(), |
| 4497 DONT_TAG_RESULT); |
| 4495 } else { | 4498 } else { |
| 4496 __ jmp(deferred->entry()); | 4499 __ jmp(deferred->entry()); |
| 4497 } | 4500 } |
| 4498 __ bind(deferred->exit()); | 4501 __ bind(deferred->exit()); |
| 4499 __ sub(ip, reg, Operand(kHeapObjectTag)); | 4502 __ vstr(input_reg, reg, HeapNumber::kValueOffset); |
| 4500 __ vstr(input_reg, ip, HeapNumber::kValueOffset); | 4503 // Now that we have finished with the object's real address tag it |
| 4504 __ add(reg, reg, Operand(kHeapObjectTag)); |
| 4501 } | 4505 } |
| 4502 | 4506 |
| 4503 | 4507 |
| 4504 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { | 4508 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
| 4505 // TODO(3095996): Get rid of this. For now, we need to make the | 4509 // TODO(3095996): Get rid of this. For now, we need to make the |
| 4506 // result register contain a valid pointer because it is already | 4510 // result register contain a valid pointer because it is already |
| 4507 // contained in the register pointer map. | 4511 // contained in the register pointer map. |
| 4508 Register reg = ToRegister(instr->result()); | 4512 Register reg = ToRegister(instr->result()); |
| 4509 __ mov(reg, Operand(0)); | 4513 __ mov(reg, Operand(0)); |
| 4510 | 4514 |
| 4511 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); | 4515 PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
| 4512 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); | 4516 CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr); |
| 4517 __ sub(r0, r0, Operand(kHeapObjectTag)); |
| 4513 __ StoreToSafepointRegisterSlot(r0, reg); | 4518 __ StoreToSafepointRegisterSlot(r0, reg); |
| 4514 } | 4519 } |
| 4515 | 4520 |
| 4516 | 4521 |
| 4517 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4522 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| 4518 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 4523 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
| 4519 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value())); | 4524 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value())); |
| 4520 } | 4525 } |
| 4521 | 4526 |
| 4522 | 4527 |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5675 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5680 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 5676 __ ldr(result, FieldMemOperand(scratch, | 5681 __ ldr(result, FieldMemOperand(scratch, |
| 5677 FixedArray::kHeaderSize - kPointerSize)); | 5682 FixedArray::kHeaderSize - kPointerSize)); |
| 5678 __ bind(&done); | 5683 __ bind(&done); |
| 5679 } | 5684 } |
| 5680 | 5685 |
| 5681 | 5686 |
| 5682 #undef __ | 5687 #undef __ |
| 5683 | 5688 |
| 5684 } } // namespace v8::internal | 5689 } } // namespace v8::internal |
| OLD | NEW |