| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 | 4531 |
| 4532 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); | 4532 DeferredNumberTagU* deferred = new(zone()) DeferredNumberTagU(this, instr); |
| 4533 __ cmpl(reg, Immediate(Smi::kMaxValue)); | 4533 __ cmpl(reg, Immediate(Smi::kMaxValue)); |
| 4534 __ j(above, deferred->entry()); | 4534 __ j(above, deferred->entry()); |
| 4535 __ Integer32ToSmi(reg, reg); | 4535 __ Integer32ToSmi(reg, reg); |
| 4536 __ bind(deferred->exit()); | 4536 __ bind(deferred->exit()); |
| 4537 } | 4537 } |
| 4538 | 4538 |
| 4539 | 4539 |
| 4540 void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) { | 4540 void LCodeGen::DoDeferredNumberTagU(LNumberTagU* instr) { |
| 4541 Label slow; | 4541 Label done, slow; |
| 4542 Register reg = ToRegister(instr->value()); | 4542 Register reg = ToRegister(instr->value()); |
| 4543 Register tmp = reg.is(rax) ? rcx : rax; | 4543 Register tmp = ToRegister(instr->temp1()); |
| 4544 XMMRegister temp_xmm = ToDoubleRegister(instr->temp()); | 4544 XMMRegister temp_xmm = ToDoubleRegister(instr->temp2()); |
| 4545 | 4545 |
| 4546 // Preserve the value of all registers. | |
| 4547 PushSafepointRegistersScope scope(this); | |
| 4548 | |
| 4549 Label done; | |
| 4550 // Load value into temp_xmm which will be preserved across potential call to | 4546 // Load value into temp_xmm which will be preserved across potential call to |
| 4551 // runtime (MacroAssembler::EnterExitFrameEpilogue preserves only allocatable | 4547 // runtime (MacroAssembler::EnterExitFrameEpilogue preserves only allocatable |
| 4552 // XMM registers on x64). | 4548 // XMM registers on x64). |
| 4553 XMMRegister xmm_scratch = double_scratch0(); | 4549 XMMRegister xmm_scratch = double_scratch0(); |
| 4554 __ LoadUint32(temp_xmm, reg, xmm_scratch); | 4550 __ LoadUint32(temp_xmm, reg, xmm_scratch); |
| 4555 | 4551 |
| 4556 if (FLAG_inline_new) { | 4552 if (FLAG_inline_new) { |
| 4557 __ AllocateHeapNumber(reg, tmp, &slow); | 4553 __ AllocateHeapNumber(reg, tmp, &slow); |
| 4558 __ jmp(&done, Label::kNear); | 4554 __ jmp(&done, Label::kNear); |
| 4559 } | 4555 } |
| 4560 | 4556 |
| 4561 // Slow case: Call the runtime system to do the number allocation. | 4557 // Slow case: Call the runtime system to do the number allocation. |
| 4562 __ bind(&slow); | 4558 __ bind(&slow); |
| 4559 { |
| 4560 // Put a valid pointer value in the stack slot where the result |
| 4561 // register is stored, as this register is in the pointer map, but contains |
| 4562 // an integer value. |
| 4563 __ Set(reg, 0); |
| 4563 | 4564 |
| 4564 // Put a valid pointer value in the stack slot where the result | 4565 // Preserve the value of all registers. |
| 4565 // register is stored, as this register is in the pointer map, but contains an | 4566 PushSafepointRegistersScope scope(this); |
| 4566 // integer value. | |
| 4567 __ StoreToSafepointRegisterSlot(reg, Immediate(0)); | |
| 4568 | 4567 |
| 4569 // NumberTagU uses the context from the frame, rather than | 4568 // NumberTagU uses the context from the frame, rather than |
| 4570 // the environment's HContext or HInlinedContext value. | 4569 // the environment's HContext or HInlinedContext value. |
| 4571 // They only call Runtime::kAllocateHeapNumber. | 4570 // They only call Runtime::kAllocateHeapNumber. |
| 4572 // The corresponding HChange instructions are added in a phase that does | 4571 // The corresponding HChange instructions are added in a phase that does |
| 4573 // not have easy access to the local context. | 4572 // not have easy access to the local context. |
| 4574 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 4573 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 4575 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4574 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
| 4576 RecordSafepointWithRegisters( | 4575 RecordSafepointWithRegisters( |
| 4577 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4576 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
| 4578 | 4577 __ StoreToSafepointRegisterSlot(reg, rax); |
| 4579 if (!reg.is(rax)) __ movp(reg, rax); | 4578 } |
| 4580 | 4579 |
| 4581 // Done. Put the value in temp_xmm into the value of the allocated heap | 4580 // Done. Put the value in temp_xmm into the value of the allocated heap |
| 4582 // number. | 4581 // number. |
| 4583 __ bind(&done); | 4582 __ bind(&done); |
| 4584 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); | 4583 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), temp_xmm); |
| 4585 __ StoreToSafepointRegisterSlot(reg, reg); | |
| 4586 } | 4584 } |
| 4587 | 4585 |
| 4588 | 4586 |
| 4589 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { | 4587 void LCodeGen::DoNumberTagD(LNumberTagD* instr) { |
| 4590 class DeferredNumberTagD V8_FINAL : public LDeferredCode { | 4588 class DeferredNumberTagD V8_FINAL : public LDeferredCode { |
| 4591 public: | 4589 public: |
| 4592 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) | 4590 DeferredNumberTagD(LCodeGen* codegen, LNumberTagD* instr) |
| 4593 : LDeferredCode(codegen), instr_(instr) { } | 4591 : LDeferredCode(codegen), instr_(instr) { } |
| 4594 virtual void Generate() V8_OVERRIDE { | 4592 virtual void Generate() V8_OVERRIDE { |
| 4595 codegen()->DoDeferredNumberTagD(instr_); | 4593 codegen()->DoDeferredNumberTagD(instr_); |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5578 FixedArray::kHeaderSize - kPointerSize)); | 5576 FixedArray::kHeaderSize - kPointerSize)); |
| 5579 __ bind(&done); | 5577 __ bind(&done); |
| 5580 } | 5578 } |
| 5581 | 5579 |
| 5582 | 5580 |
| 5583 #undef __ | 5581 #undef __ |
| 5584 | 5582 |
| 5585 } } // namespace v8::internal | 5583 } } // namespace v8::internal |
| 5586 | 5584 |
| 5587 #endif // V8_TARGET_ARCH_X64 | 5585 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |