| 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 3257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3268 __ bind(&skip_assignment); | 3268 __ bind(&skip_assignment); |
| 3269 } | 3269 } |
| 3270 | 3270 |
| 3271 | 3271 |
| 3272 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3272 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 3273 HObjectAccess access = instr->hydrogen()->access(); | 3273 HObjectAccess access = instr->hydrogen()->access(); |
| 3274 int offset = access.offset(); | 3274 int offset = access.offset(); |
| 3275 | 3275 |
| 3276 if (access.IsExternalMemory()) { | 3276 if (access.IsExternalMemory()) { |
| 3277 Register result = ToRegister(instr->result()); | 3277 Register result = ToRegister(instr->result()); |
| 3278 if (instr->object()->IsConstantOperand()) { | 3278 MemOperand operand = instr->object()->IsConstantOperand() |
| 3279 ExternalReference external_reference = ToExternalReference( | 3279 ? MemOperand::StaticVariable(ToExternalReference( |
| 3280 LConstantOperand::cast(instr->object())); | 3280 LConstantOperand::cast(instr->object()))) |
| 3281 __ mov(result, MemOperand::StaticVariable(external_reference)); | 3281 : MemOperand(ToRegister(instr->object()), offset); |
| 3282 if (access.representation().IsByte()) { |
| 3283 ASSERT(instr->hydrogen()->representation().IsInteger32()); |
| 3284 __ movzx_b(result, operand); |
| 3282 } else { | 3285 } else { |
| 3283 __ mov(result, MemOperand(ToRegister(instr->object()), offset)); | 3286 __ mov(result, operand); |
| 3284 } | 3287 } |
| 3285 return; | 3288 return; |
| 3286 } | 3289 } |
| 3287 | 3290 |
| 3288 Register object = ToRegister(instr->object()); | 3291 Register object = ToRegister(instr->object()); |
| 3289 if (FLAG_track_double_fields && | 3292 if (FLAG_track_double_fields && |
| 3290 instr->hydrogen()->representation().IsDouble()) { | 3293 instr->hydrogen()->representation().IsDouble()) { |
| 3291 if (CpuFeatures::IsSupported(SSE2)) { | 3294 if (CpuFeatures::IsSupported(SSE2)) { |
| 3292 CpuFeatureScope scope(masm(), SSE2); | 3295 CpuFeatureScope scope(masm(), SSE2); |
| 3293 XMMRegister result = ToDoubleRegister(instr->result()); | 3296 XMMRegister result = ToDoubleRegister(instr->result()); |
| 3294 __ movdbl(result, FieldOperand(object, offset)); | 3297 __ movdbl(result, FieldOperand(object, offset)); |
| 3295 } else { | 3298 } else { |
| 3296 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3299 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
| 3297 } | 3300 } |
| 3298 return; | 3301 return; |
| 3299 } | 3302 } |
| 3300 | 3303 |
| 3301 Register result = ToRegister(instr->result()); | 3304 Register result = ToRegister(instr->result()); |
| 3302 if (access.IsInobject()) { | 3305 if (!access.IsInobject()) { |
| 3306 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 3307 object = result; |
| 3308 } |
| 3309 if (access.representation().IsByte()) { |
| 3310 ASSERT(instr->hydrogen()->representation().IsInteger32()); |
| 3311 __ movzx_b(result, FieldOperand(object, offset)); |
| 3312 } else { |
| 3303 __ mov(result, FieldOperand(object, offset)); | 3313 __ mov(result, FieldOperand(object, offset)); |
| 3304 } else { | |
| 3305 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | |
| 3306 __ mov(result, FieldOperand(result, offset)); | |
| 3307 } | 3314 } |
| 3308 } | 3315 } |
| 3309 | 3316 |
| 3310 | 3317 |
| 3311 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 3318 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
| 3312 ASSERT(!operand->IsDoubleRegister()); | 3319 ASSERT(!operand->IsDoubleRegister()); |
| 3313 if (operand->IsConstantOperand()) { | 3320 if (operand->IsConstantOperand()) { |
| 3314 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); | 3321 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); |
| 3315 AllowDeferredHandleDereference smi_check; | 3322 AllowDeferredHandleDereference smi_check; |
| 3316 if (object->IsSmi()) { | 3323 if (object->IsSmi()) { |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4472 int offset = access.offset(); | 4479 int offset = access.offset(); |
| 4473 | 4480 |
| 4474 if (access.IsExternalMemory()) { | 4481 if (access.IsExternalMemory()) { |
| 4475 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4482 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4476 MemOperand operand = instr->object()->IsConstantOperand() | 4483 MemOperand operand = instr->object()->IsConstantOperand() |
| 4477 ? MemOperand::StaticVariable( | 4484 ? MemOperand::StaticVariable( |
| 4478 ToExternalReference(LConstantOperand::cast(instr->object()))) | 4485 ToExternalReference(LConstantOperand::cast(instr->object()))) |
| 4479 : MemOperand(ToRegister(instr->object()), offset); | 4486 : MemOperand(ToRegister(instr->object()), offset); |
| 4480 if (instr->value()->IsConstantOperand()) { | 4487 if (instr->value()->IsConstantOperand()) { |
| 4481 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4488 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4482 __ mov(operand, Immediate(ToInteger32(operand_value))); | 4489 if (representation.IsByte()) { |
| 4490 __ mov_b(operand, ToInteger32(operand_value)); |
| 4491 } else { |
| 4492 __ mov(operand, Immediate(ToInteger32(operand_value))); |
| 4493 } |
| 4483 } else { | 4494 } else { |
| 4484 Register value = ToRegister(instr->value()); | 4495 Register value = ToRegister(instr->value()); |
| 4485 __ mov(operand, value); | 4496 if (representation.IsByte()) { |
| 4497 __ mov_b(operand, value); |
| 4498 } else { |
| 4499 __ mov(operand, value); |
| 4500 } |
| 4486 } | 4501 } |
| 4487 return; | 4502 return; |
| 4488 } | 4503 } |
| 4489 | 4504 |
| 4490 Register object = ToRegister(instr->object()); | 4505 Register object = ToRegister(instr->object()); |
| 4491 Handle<Map> transition = instr->transition(); | 4506 Handle<Map> transition = instr->transition(); |
| 4492 | 4507 |
| 4493 if (FLAG_track_fields && representation.IsSmi()) { | 4508 if (FLAG_track_fields && representation.IsSmi()) { |
| 4494 if (instr->value()->IsConstantOperand()) { | 4509 if (instr->value()->IsConstantOperand()) { |
| 4495 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4510 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4548 SmiCheck check_needed = | 4563 SmiCheck check_needed = |
| 4549 instr->hydrogen()->value()->IsHeapObject() | 4564 instr->hydrogen()->value()->IsHeapObject() |
| 4550 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4565 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4551 | 4566 |
| 4552 Register write_register = object; | 4567 Register write_register = object; |
| 4553 if (!access.IsInobject()) { | 4568 if (!access.IsInobject()) { |
| 4554 write_register = ToRegister(instr->temp()); | 4569 write_register = ToRegister(instr->temp()); |
| 4555 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4570 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 4556 } | 4571 } |
| 4557 | 4572 |
| 4573 MemOperand operand = FieldOperand(write_register, offset); |
| 4558 if (instr->value()->IsConstantOperand()) { | 4574 if (instr->value()->IsConstantOperand()) { |
| 4559 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4575 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4560 if (operand_value->IsRegister()) { | 4576 if (operand_value->IsRegister()) { |
| 4561 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); | 4577 Register value = ToRegister(operand_value); |
| 4578 if (representation.IsByte()) { |
| 4579 __ mov_b(operand, value); |
| 4580 } else { |
| 4581 __ mov(operand, value); |
| 4582 } |
| 4562 } else { | 4583 } else { |
| 4563 Handle<Object> handle_value = ToHandle(operand_value); | 4584 Handle<Object> handle_value = ToHandle(operand_value); |
| 4564 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4585 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4565 __ mov(FieldOperand(write_register, offset), handle_value); | 4586 __ mov(operand, handle_value); |
| 4566 } | 4587 } |
| 4567 } else { | 4588 } else { |
| 4568 __ mov(FieldOperand(write_register, offset), ToRegister(instr->value())); | 4589 Register value = ToRegister(instr->value()); |
| 4590 if (representation.IsByte()) { |
| 4591 __ mov_b(operand, value); |
| 4592 } else { |
| 4593 __ mov(operand, value); |
| 4594 } |
| 4569 } | 4595 } |
| 4570 | 4596 |
| 4571 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4597 if (instr->hydrogen()->NeedsWriteBarrier()) { |
| 4572 Register value = ToRegister(instr->value()); | 4598 Register value = ToRegister(instr->value()); |
| 4573 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4599 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
| 4574 // Update the write barrier for the object for in-object properties. | 4600 // Update the write barrier for the object for in-object properties. |
| 4575 __ RecordWriteField(write_register, | 4601 __ RecordWriteField(write_register, |
| 4576 offset, | 4602 offset, |
| 4577 value, | 4603 value, |
| 4578 temp, | 4604 temp, |
| (...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6405 FixedArray::kHeaderSize - kPointerSize)); | 6431 FixedArray::kHeaderSize - kPointerSize)); |
| 6406 __ bind(&done); | 6432 __ bind(&done); |
| 6407 } | 6433 } |
| 6408 | 6434 |
| 6409 | 6435 |
| 6410 #undef __ | 6436 #undef __ |
| 6411 | 6437 |
| 6412 } } // namespace v8::internal | 6438 } } // namespace v8::internal |
| 6413 | 6439 |
| 6414 #endif // V8_TARGET_ARCH_IA32 | 6440 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |