| 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 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 CpuFeatureScope scope(masm(), SSE2); | 3285 CpuFeatureScope scope(masm(), SSE2); |
| 3286 XMMRegister result = ToDoubleRegister(instr->result()); | 3286 XMMRegister result = ToDoubleRegister(instr->result()); |
| 3287 __ movsd(result, FieldOperand(object, offset)); | 3287 __ movsd(result, FieldOperand(object, offset)); |
| 3288 } else { | 3288 } else { |
| 3289 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3289 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
| 3290 } | 3290 } |
| 3291 return; | 3291 return; |
| 3292 } | 3292 } |
| 3293 | 3293 |
| 3294 Register result = ToRegister(instr->result()); | 3294 Register result = ToRegister(instr->result()); |
| 3295 if (!access.IsInobject()) { | |
| 3296 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | |
| 3297 object = result; | |
| 3298 } | |
| 3299 __ Load(result, FieldOperand(object, offset), access.representation()); | 3295 __ Load(result, FieldOperand(object, offset), access.representation()); |
| 3300 } | 3296 } |
| 3301 | 3297 |
| 3302 | 3298 |
| 3303 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 3299 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
| 3304 ASSERT(!operand->IsDoubleRegister()); | 3300 ASSERT(!operand->IsDoubleRegister()); |
| 3305 if (operand->IsConstantOperand()) { | 3301 if (operand->IsConstantOperand()) { |
| 3306 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); | 3302 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); |
| 3307 AllowDeferredHandleDereference smi_check; | 3303 AllowDeferredHandleDereference smi_check; |
| 3308 if (object->IsSmi()) { | 3304 if (object->IsSmi()) { |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4383 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4388 __ mov(operand, Immediate(ToInteger32(operand_value))); | 4384 __ mov(operand, Immediate(ToInteger32(operand_value))); |
| 4389 } else { | 4385 } else { |
| 4390 Register value = ToRegister(instr->value()); | 4386 Register value = ToRegister(instr->value()); |
| 4391 __ Store(value, operand, representation); | 4387 __ Store(value, operand, representation); |
| 4392 } | 4388 } |
| 4393 return; | 4389 return; |
| 4394 } | 4390 } |
| 4395 | 4391 |
| 4396 Register object = ToRegister(instr->object()); | 4392 Register object = ToRegister(instr->object()); |
| 4397 Handle<Map> transition = instr->transition(); | |
| 4398 | 4393 |
| 4399 if (FLAG_track_fields && representation.IsSmi()) { | 4394 if (FLAG_track_fields && representation.IsSmi()) { |
| 4400 if (instr->value()->IsConstantOperand()) { | 4395 if (instr->value()->IsConstantOperand()) { |
| 4401 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4396 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4402 if (!IsSmi(operand_value)) { | 4397 if (!IsSmi(operand_value)) { |
| 4403 DeoptimizeIf(no_condition, instr->environment()); | 4398 DeoptimizeIf(no_condition, instr->environment()); |
| 4404 } | 4399 } |
| 4405 } | 4400 } |
| 4406 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4401 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 4407 if (instr->value()->IsConstantOperand()) { | 4402 if (instr->value()->IsConstantOperand()) { |
| 4408 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4403 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4409 if (IsInteger32(operand_value)) { | 4404 if (IsInteger32(operand_value)) { |
| 4410 DeoptimizeIf(no_condition, instr->environment()); | 4405 DeoptimizeIf(no_condition, instr->environment()); |
| 4411 } | 4406 } |
| 4412 } else { | 4407 } else { |
| 4413 if (!instr->hydrogen()->value()->type().IsHeapObject()) { | 4408 if (!instr->hydrogen()->value()->type().IsHeapObject()) { |
| 4414 Register value = ToRegister(instr->value()); | 4409 Register value = ToRegister(instr->value()); |
| 4415 __ test(value, Immediate(kSmiTagMask)); | 4410 __ test(value, Immediate(kSmiTagMask)); |
| 4416 DeoptimizeIf(zero, instr->environment()); | 4411 DeoptimizeIf(zero, instr->environment()); |
| 4417 } | 4412 } |
| 4418 } | 4413 } |
| 4419 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 4414 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
| 4420 ASSERT(transition.is_null()); | |
| 4421 ASSERT(access.IsInobject()); | 4415 ASSERT(access.IsInobject()); |
| 4422 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4416 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4423 if (CpuFeatures::IsSupported(SSE2)) { | 4417 if (CpuFeatures::IsSupported(SSE2)) { |
| 4424 CpuFeatureScope scope(masm(), SSE2); | 4418 CpuFeatureScope scope(masm(), SSE2); |
| 4425 XMMRegister value = ToDoubleRegister(instr->value()); | 4419 XMMRegister value = ToDoubleRegister(instr->value()); |
| 4426 __ movsd(FieldOperand(object, offset), value); | 4420 __ movsd(FieldOperand(object, offset), value); |
| 4427 } else { | 4421 } else { |
| 4428 X87Register value = ToX87Register(instr->value()); | 4422 X87Register value = ToX87Register(instr->value()); |
| 4429 X87Mov(FieldOperand(object, offset), value); | 4423 X87Mov(FieldOperand(object, offset), value); |
| 4430 } | 4424 } |
| 4431 return; | 4425 return; |
| 4432 } | 4426 } |
| 4433 | 4427 |
| 4434 if (!transition.is_null()) { | |
| 4435 if (!instr->hydrogen()->NeedsWriteBarrierForMap()) { | |
| 4436 __ mov(FieldOperand(object, HeapObject::kMapOffset), transition); | |
| 4437 } else { | |
| 4438 Register temp = ToRegister(instr->temp()); | |
| 4439 Register temp_map = ToRegister(instr->temp_map()); | |
| 4440 __ mov(temp_map, transition); | |
| 4441 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); | |
| 4442 // Update the write barrier for the map field. | |
| 4443 __ RecordWriteField(object, | |
| 4444 HeapObject::kMapOffset, | |
| 4445 temp_map, | |
| 4446 temp, | |
| 4447 GetSaveFPRegsMode(), | |
| 4448 OMIT_REMEMBERED_SET, | |
| 4449 OMIT_SMI_CHECK); | |
| 4450 } | |
| 4451 } | |
| 4452 | |
| 4453 // Do the store. | 4428 // Do the store. |
| 4454 SmiCheck check_needed = | 4429 SmiCheck check_needed = |
| 4455 instr->hydrogen()->value()->IsHeapObject() | 4430 instr->hydrogen()->value()->IsHeapObject() |
| 4456 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4431 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4457 | 4432 |
| 4458 Register write_register = object; | 4433 MemOperand operand = FieldOperand(object, offset); |
| 4459 if (!access.IsInobject()) { | |
| 4460 write_register = ToRegister(instr->temp()); | |
| 4461 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | |
| 4462 } | |
| 4463 | |
| 4464 MemOperand operand = FieldOperand(write_register, offset); | |
| 4465 if (instr->value()->IsConstantOperand()) { | 4434 if (instr->value()->IsConstantOperand()) { |
| 4466 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4435 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4467 if (operand_value->IsRegister()) { | 4436 if (operand_value->IsRegister()) { |
| 4468 Register value = ToRegister(operand_value); | 4437 Register value = ToRegister(operand_value); |
| 4469 __ Store(value, operand, representation); | 4438 __ Store(value, operand, representation); |
| 4470 } else if (representation.IsInteger32()) { | 4439 } else if (representation.IsInteger32()) { |
| 4471 Immediate immediate = ToImmediate(operand_value, representation); | 4440 Immediate immediate = ToImmediate(operand_value, representation); |
| 4472 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4441 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4473 __ mov(operand, immediate); | 4442 __ mov(operand, immediate); |
| 4474 } else { | 4443 } else { |
| 4475 Handle<Object> handle_value = ToHandle(operand_value); | 4444 Handle<Object> handle_value = ToHandle(operand_value); |
| 4476 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4445 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4477 __ mov(operand, handle_value); | 4446 __ mov(operand, handle_value); |
| 4478 } | 4447 } |
| 4479 } else { | 4448 } else { |
| 4480 Register value = ToRegister(instr->value()); | 4449 Register value = ToRegister(instr->value()); |
| 4481 __ Store(value, operand, representation); | 4450 __ Store(value, operand, representation); |
| 4482 } | 4451 } |
| 4483 | 4452 |
| 4484 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4453 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 4485 Register value = ToRegister(instr->value()); | 4454 Register value = ToRegister(instr->value()); |
| 4486 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4455 Register temp = ToRegister(instr->temp()); |
| 4487 // Update the write barrier for the object for in-object properties. | 4456 // Update the write barrier for the object for in-object properties. |
| 4488 __ RecordWriteField(write_register, | 4457 __ RecordWriteField(object, |
| 4489 offset, | 4458 offset, |
| 4490 value, | 4459 value, |
| 4491 temp, | 4460 temp, |
| 4492 GetSaveFPRegsMode(), | 4461 GetSaveFPRegsMode(), |
| 4493 EMIT_REMEMBERED_SET, | 4462 EMIT_REMEMBERED_SET, |
| 4494 check_needed); | 4463 check_needed); |
| 4495 } | 4464 } |
| 4496 } | 4465 } |
| 4497 | 4466 |
| 4498 | 4467 |
| (...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6369 FixedArray::kHeaderSize - kPointerSize)); | 6338 FixedArray::kHeaderSize - kPointerSize)); |
| 6370 __ bind(&done); | 6339 __ bind(&done); |
| 6371 } | 6340 } |
| 6372 | 6341 |
| 6373 | 6342 |
| 6374 #undef __ | 6343 #undef __ |
| 6375 | 6344 |
| 6376 } } // namespace v8::internal | 6345 } } // namespace v8::internal |
| 6377 | 6346 |
| 6378 #endif // V8_TARGET_ARCH_IA32 | 6347 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |