OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4257 // Slow case: Call the runtime system to do the number allocation. | 4257 // Slow case: Call the runtime system to do the number allocation. |
4258 __ bind(&slow); | 4258 __ bind(&slow); |
4259 { | 4259 { |
4260 // TODO(3095996): Put a valid pointer value in the stack slot where the | 4260 // TODO(3095996): Put a valid pointer value in the stack slot where the |
4261 // result register is stored, as this register is in the pointer map, but | 4261 // result register is stored, as this register is in the pointer map, but |
4262 // contains an integer value. | 4262 // contains an integer value. |
4263 __ Move(reg, Immediate(0)); | 4263 __ Move(reg, Immediate(0)); |
4264 | 4264 |
4265 // Preserve the value of all registers. | 4265 // Preserve the value of all registers. |
4266 PushSafepointRegistersScope scope(this); | 4266 PushSafepointRegistersScope scope(this); |
4267 | 4267 // Reset the context register. |
4268 // NumberTagI and NumberTagD use the context from the frame, rather than | 4268 if (!reg.is(esi)) { |
4269 // the environment's HContext or HInlinedContext value. | 4269 __ Move(esi, Immediate(0)); |
4270 // They only call Runtime::kAllocateHeapNumber. | 4270 } |
4271 // The corresponding HChange instructions are added in a phase that does | |
4272 // not have easy access to the local context. | |
4273 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
4274 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4271 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
4275 RecordSafepointWithRegisters( | 4272 RecordSafepointWithRegisters( |
4276 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4273 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
4277 __ StoreToSafepointRegisterSlot(reg, eax); | 4274 __ StoreToSafepointRegisterSlot(reg, eax); |
4278 } | 4275 } |
4279 | 4276 |
4280 // Done. Put the value in xmm_scratch into the value of the allocated heap | 4277 // Done. Put the value in xmm_scratch into the value of the allocated heap |
4281 // number. | 4278 // number. |
4282 __ bind(&done); | 4279 __ bind(&done); |
4283 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); | 4280 __ movsd(FieldOperand(reg, HeapNumber::kValueOffset), xmm_scratch); |
(...skipping 29 matching lines...) Expand all Loading... | |
4313 | 4310 |
4314 | 4311 |
4315 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { | 4312 void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { |
4316 // 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 |
4317 // result register contain a valid pointer because it is already | 4314 // result register contain a valid pointer because it is already |
4318 // contained in the register pointer map. | 4315 // contained in the register pointer map. |
4319 Register reg = ToRegister(instr->result()); | 4316 Register reg = ToRegister(instr->result()); |
4320 __ Move(reg, Immediate(0)); | 4317 __ Move(reg, Immediate(0)); |
4321 | 4318 |
4322 PushSafepointRegistersScope scope(this); | 4319 PushSafepointRegistersScope scope(this); |
4323 // NumberTagI and NumberTagD use the context from the frame, rather than | 4320 // Reset the context register. |
4324 // the environment's HContext or HInlinedContext value. | 4321 if (!reg.is(esi)) { |
4325 // They only call Runtime::kAllocateHeapNumber. | 4322 __ Move(esi, Immediate(0)); |
4326 // The corresponding HChange instructions are added in a phase that does | 4323 } |
4327 // not have easy access to the local context. | |
4328 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
4329 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 4324 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
4330 RecordSafepointWithRegisters( | 4325 RecordSafepointWithRegisters( |
4331 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); | 4326 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt); |
4332 __ StoreToSafepointRegisterSlot(reg, eax); | 4327 __ StoreToSafepointRegisterSlot(reg, eax); |
4333 } | 4328 } |
4334 | 4329 |
4335 | 4330 |
4336 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4331 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
4337 HChange* hchange = instr->hydrogen(); | 4332 HChange* hchange = instr->hydrogen(); |
4338 Register input = ToRegister(instr->value()); | 4333 Register input = ToRegister(instr->value()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4407 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumberUndefined); | 4402 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumberUndefined); |
4408 | 4403 |
4409 __ pcmpeqd(result_reg, result_reg); | 4404 __ pcmpeqd(result_reg, result_reg); |
4410 __ jmp(&done, Label::kNear); | 4405 __ jmp(&done, Label::kNear); |
4411 } | 4406 } |
4412 } else { | 4407 } else { |
4413 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); | 4408 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); |
4414 } | 4409 } |
4415 | 4410 |
4416 __ bind(&load_smi); | 4411 __ bind(&load_smi); |
4417 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the | 4412 // Smi to XMM conversion. Clobbering a temp is faster than -tagging the |
Jakob Kummerow
2016/07/13 15:56:56
accidental edit?
| |
4418 // input register since we avoid dependencies. | 4413 // input register since we avoid dependencies. |
4419 __ mov(temp_reg, input_reg); | 4414 __ mov(temp_reg, input_reg); |
4420 __ SmiUntag(temp_reg); // Untag smi before converting to float. | 4415 __ SmiUntag(temp_reg); // Untag smi before converting to float. |
4421 __ Cvtsi2sd(result_reg, Operand(temp_reg)); | 4416 __ Cvtsi2sd(result_reg, Operand(temp_reg)); |
4422 __ bind(&done); | 4417 __ bind(&done); |
4423 } | 4418 } |
4424 | 4419 |
4425 | 4420 |
4426 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 4421 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
4427 Register input_reg = ToRegister(instr->value()); | 4422 Register input_reg = ToRegister(instr->value()); |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5289 __ bind(deferred->exit()); | 5284 __ bind(deferred->exit()); |
5290 __ bind(&done); | 5285 __ bind(&done); |
5291 } | 5286 } |
5292 | 5287 |
5293 #undef __ | 5288 #undef __ |
5294 | 5289 |
5295 } // namespace internal | 5290 } // namespace internal |
5296 } // namespace v8 | 5291 } // namespace v8 |
5297 | 5292 |
5298 #endif // V8_TARGET_ARCH_IA32 | 5293 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |