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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "ia32/lithium-codegen-ia32.h" | 9 #include "ia32/lithium-codegen-ia32.h" |
10 #include "ic.h" | 10 #include "ic.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 void LCodeGen::FinishCode(Handle<Code> code) { | 80 void LCodeGen::FinishCode(Handle<Code> code) { |
81 ASSERT(is_done()); | 81 ASSERT(is_done()); |
82 code->set_stack_slots(GetStackSlotCount()); | 82 code->set_stack_slots(GetStackSlotCount()); |
83 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 83 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
84 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); | 84 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); |
85 PopulateDeoptimizationData(code); | 85 PopulateDeoptimizationData(code); |
86 if (!info()->IsStub()) { | 86 if (!info()->IsStub()) { |
87 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); | 87 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(code); |
88 } | 88 } |
89 info()->CommitDependencies(code); | |
90 } | 89 } |
91 | 90 |
92 | 91 |
93 void LCodeGen::Abort(BailoutReason reason) { | 92 void LCodeGen::Abort(BailoutReason reason) { |
94 info()->set_bailout_reason(reason); | 93 info()->set_bailout_reason(reason); |
95 status_ = ABORTED; | 94 status_ = ABORTED; |
96 } | 95 } |
97 | 96 |
98 | 97 |
99 #ifdef _MSC_VER | 98 #ifdef _MSC_VER |
(...skipping 4237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 LConstantOperand* offset = LConstantOperand::cast(instr->offset()); | 4336 LConstantOperand* offset = LConstantOperand::cast(instr->offset()); |
4338 __ lea(result, Operand(base, ToInteger32(offset))); | 4337 __ lea(result, Operand(base, ToInteger32(offset))); |
4339 } else { | 4338 } else { |
4340 Register offset = ToRegister(instr->offset()); | 4339 Register offset = ToRegister(instr->offset()); |
4341 __ lea(result, Operand(base, offset, times_1, 0)); | 4340 __ lea(result, Operand(base, offset, times_1, 0)); |
4342 } | 4341 } |
4343 } | 4342 } |
4344 | 4343 |
4345 | 4344 |
4346 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4345 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
4347 Representation representation = instr->representation(); | 4346 Representation representation = instr->hydrogen()->field_representation(); |
4348 | 4347 |
4349 HObjectAccess access = instr->hydrogen()->access(); | 4348 HObjectAccess access = instr->hydrogen()->access(); |
4350 int offset = access.offset(); | 4349 int offset = access.offset(); |
4351 | 4350 |
4352 if (access.IsExternalMemory()) { | 4351 if (access.IsExternalMemory()) { |
4353 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4352 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4354 MemOperand operand = instr->object()->IsConstantOperand() | 4353 MemOperand operand = instr->object()->IsConstantOperand() |
4355 ? MemOperand::StaticVariable( | 4354 ? MemOperand::StaticVariable( |
4356 ToExternalReference(LConstantOperand::cast(instr->object()))) | 4355 ToExternalReference(LConstantOperand::cast(instr->object()))) |
4357 : MemOperand(ToRegister(instr->object()), offset); | 4356 : MemOperand(ToRegister(instr->object()), offset); |
4358 if (instr->value()->IsConstantOperand()) { | 4357 if (instr->value()->IsConstantOperand()) { |
4359 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4358 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4360 __ mov(operand, Immediate(ToInteger32(operand_value))); | 4359 __ mov(operand, Immediate(ToInteger32(operand_value))); |
4361 } else { | 4360 } else { |
4362 Register value = ToRegister(instr->value()); | 4361 Register value = ToRegister(instr->value()); |
4363 __ Store(value, operand, representation); | 4362 __ Store(value, operand, representation); |
4364 } | 4363 } |
4365 return; | 4364 return; |
4366 } | 4365 } |
4367 | 4366 |
4368 Register object = ToRegister(instr->object()); | 4367 Register object = ToRegister(instr->object()); |
4369 Handle<Map> transition = instr->transition(); | |
4370 SmiCheck check_needed = | 4368 SmiCheck check_needed = |
4371 instr->hydrogen()->value()->IsHeapObject() | 4369 instr->hydrogen()->value()->IsHeapObject() |
4372 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4370 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4373 | 4371 |
4374 ASSERT(!(representation.IsSmi() && | 4372 ASSERT(!(representation.IsSmi() && |
4375 instr->value()->IsConstantOperand() && | 4373 instr->value()->IsConstantOperand() && |
4376 !IsSmi(LConstantOperand::cast(instr->value())))); | 4374 !IsSmi(LConstantOperand::cast(instr->value())))); |
4377 if (representation.IsHeapObject()) { | 4375 if (representation.IsHeapObject()) { |
4378 if (instr->value()->IsConstantOperand()) { | 4376 if (instr->value()->IsConstantOperand()) { |
4379 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4377 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4380 if (chunk_->LookupConstant(operand_value)->HasSmiValue()) { | 4378 if (chunk_->LookupConstant(operand_value)->HasSmiValue()) { |
4381 DeoptimizeIf(no_condition, instr->environment()); | 4379 DeoptimizeIf(no_condition, instr->environment()); |
4382 } | 4380 } |
4383 } else { | 4381 } else { |
4384 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 4382 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
4385 Register value = ToRegister(instr->value()); | 4383 Register value = ToRegister(instr->value()); |
4386 __ test(value, Immediate(kSmiTagMask)); | 4384 __ test(value, Immediate(kSmiTagMask)); |
4387 DeoptimizeIf(zero, instr->environment()); | 4385 DeoptimizeIf(zero, instr->environment()); |
4388 | 4386 |
4389 // We know now that value is not a smi, so we can omit the check below. | 4387 // We know now that value is not a smi, so we can omit the check below. |
4390 check_needed = OMIT_SMI_CHECK; | 4388 check_needed = OMIT_SMI_CHECK; |
4391 } | 4389 } |
4392 } | 4390 } |
4393 } else if (representation.IsDouble()) { | 4391 } else if (representation.IsDouble()) { |
4394 ASSERT(transition.is_null()); | |
4395 ASSERT(access.IsInobject()); | 4392 ASSERT(access.IsInobject()); |
| 4393 ASSERT(!instr->hydrogen()->has_transition()); |
4396 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4394 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4397 if (CpuFeatures::IsSupported(SSE2)) { | 4395 if (CpuFeatures::IsSupported(SSE2)) { |
4398 CpuFeatureScope scope(masm(), SSE2); | 4396 CpuFeatureScope scope(masm(), SSE2); |
4399 XMMRegister value = ToDoubleRegister(instr->value()); | 4397 XMMRegister value = ToDoubleRegister(instr->value()); |
4400 __ movsd(FieldOperand(object, offset), value); | 4398 __ movsd(FieldOperand(object, offset), value); |
4401 } else { | 4399 } else { |
4402 X87Register value = ToX87Register(instr->value()); | 4400 X87Register value = ToX87Register(instr->value()); |
4403 X87Mov(FieldOperand(object, offset), value); | 4401 X87Mov(FieldOperand(object, offset), value); |
4404 } | 4402 } |
4405 return; | 4403 return; |
4406 } | 4404 } |
4407 | 4405 |
4408 if (!transition.is_null()) { | 4406 if (instr->hydrogen()->has_transition()) { |
| 4407 Handle<Map> transition = instr->hydrogen()->transition_map(); |
4409 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | 4408 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { |
4410 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); | 4409 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); |
4411 } else { | 4410 } else { |
4412 Register temp = ToRegister(instr->temp()); | 4411 Register temp = ToRegister(instr->temp()); |
4413 Register temp_map = ToRegister(instr->temp_map()); | 4412 Register temp_map = ToRegister(instr->temp_map()); |
4414 __ mov(temp_map, transition); | 4413 __ mov(temp_map, transition); |
4415 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); | 4414 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); |
4416 // Update the write barrier for the map field. | 4415 // Update the write barrier for the map field. |
4417 __ RecordWriteField(object, | 4416 __ RecordWriteField(object, |
4418 HeapObject::kMapOffset, | 4417 HeapObject::kMapOffset, |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6424 __ bind(deferred->exit()); | 6423 __ bind(deferred->exit()); |
6425 __ bind(&done); | 6424 __ bind(&done); |
6426 } | 6425 } |
6427 | 6426 |
6428 | 6427 |
6429 #undef __ | 6428 #undef __ |
6430 | 6429 |
6431 } } // namespace v8::internal | 6430 } } // namespace v8::internal |
6432 | 6431 |
6433 #endif // V8_TARGET_ARCH_IA32 | 6432 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |