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 3255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3266 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3266 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3267 HObjectAccess access = instr->hydrogen()->access(); | 3267 HObjectAccess access = instr->hydrogen()->access(); |
3268 int offset = access.offset(); | 3268 int offset = access.offset(); |
3269 | 3269 |
3270 if (access.IsExternalMemory()) { | 3270 if (access.IsExternalMemory()) { |
3271 Register result = ToRegister(instr->result()); | 3271 Register result = ToRegister(instr->result()); |
3272 MemOperand operand = instr->object()->IsConstantOperand() | 3272 MemOperand operand = instr->object()->IsConstantOperand() |
3273 ? MemOperand::StaticVariable(ToExternalReference( | 3273 ? MemOperand::StaticVariable(ToExternalReference( |
3274 LConstantOperand::cast(instr->object()))) | 3274 LConstantOperand::cast(instr->object()))) |
3275 : MemOperand(ToRegister(instr->object()), offset); | 3275 : MemOperand(ToRegister(instr->object()), offset); |
3276 if (access.representation().IsByte()) { | 3276 __ Load(result, operand, access.representation()); |
3277 ASSERT(instr->hydrogen()->representation().IsInteger32()); | |
3278 __ movzx_b(result, operand); | |
3279 } else { | |
3280 __ mov(result, operand); | |
3281 } | |
3282 return; | 3277 return; |
3283 } | 3278 } |
3284 | 3279 |
3285 Register object = ToRegister(instr->object()); | 3280 Register object = ToRegister(instr->object()); |
3286 if (FLAG_track_double_fields && | 3281 if (FLAG_track_double_fields && |
3287 instr->hydrogen()->representation().IsDouble()) { | 3282 instr->hydrogen()->representation().IsDouble()) { |
3288 if (CpuFeatures::IsSupported(SSE2)) { | 3283 if (CpuFeatures::IsSupported(SSE2)) { |
3289 CpuFeatureScope scope(masm(), SSE2); | 3284 CpuFeatureScope scope(masm(), SSE2); |
3290 XMMRegister result = ToDoubleRegister(instr->result()); | 3285 XMMRegister result = ToDoubleRegister(instr->result()); |
3291 __ movsd(result, FieldOperand(object, offset)); | 3286 __ movsd(result, FieldOperand(object, offset)); |
3292 } else { | 3287 } else { |
3293 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3288 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
3294 } | 3289 } |
3295 return; | 3290 return; |
3296 } | 3291 } |
3297 | 3292 |
3298 Register result = ToRegister(instr->result()); | 3293 Register result = ToRegister(instr->result()); |
3299 if (!access.IsInobject()) { | 3294 if (!access.IsInobject()) { |
3300 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 3295 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
3301 object = result; | 3296 object = result; |
3302 } | 3297 } |
3303 if (access.representation().IsByte()) { | 3298 __ Load(result, FieldOperand(object, offset), access.representation()); |
3304 ASSERT(instr->hydrogen()->representation().IsInteger32()); | |
3305 __ movzx_b(result, FieldOperand(object, offset)); | |
3306 } else { | |
3307 __ mov(result, FieldOperand(object, offset)); | |
3308 } | |
3309 } | 3299 } |
3310 | 3300 |
3311 | 3301 |
3312 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 3302 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
3313 ASSERT(!operand->IsDoubleRegister()); | 3303 ASSERT(!operand->IsDoubleRegister()); |
3314 if (operand->IsConstantOperand()) { | 3304 if (operand->IsConstantOperand()) { |
3315 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); | 3305 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); |
3316 AllowDeferredHandleDereference smi_check; | 3306 AllowDeferredHandleDereference smi_check; |
3317 if (object->IsSmi()) { | 3307 if (object->IsSmi()) { |
3318 __ Push(Handle<Smi>::cast(object)); | 3308 __ Push(Handle<Smi>::cast(object)); |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4471 HObjectAccess access = instr->hydrogen()->access(); | 4461 HObjectAccess access = instr->hydrogen()->access(); |
4472 int offset = access.offset(); | 4462 int offset = access.offset(); |
4473 | 4463 |
4474 if (access.IsExternalMemory()) { | 4464 if (access.IsExternalMemory()) { |
4475 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4465 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4476 MemOperand operand = instr->object()->IsConstantOperand() | 4466 MemOperand operand = instr->object()->IsConstantOperand() |
4477 ? MemOperand::StaticVariable( | 4467 ? MemOperand::StaticVariable( |
4478 ToExternalReference(LConstantOperand::cast(instr->object()))) | 4468 ToExternalReference(LConstantOperand::cast(instr->object()))) |
4479 : MemOperand(ToRegister(instr->object()), offset); | 4469 : MemOperand(ToRegister(instr->object()), offset); |
4480 if (instr->value()->IsConstantOperand()) { | 4470 if (instr->value()->IsConstantOperand()) { |
4481 ASSERT(!representation.IsByte()); | |
4482 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4471 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4483 __ mov(operand, Immediate(ToInteger32(operand_value))); | 4472 __ mov(operand, Immediate(ToInteger32(operand_value))); |
4484 } else { | 4473 } else { |
4485 Register value = ToRegister(instr->value()); | 4474 Register value = ToRegister(instr->value()); |
4486 if (representation.IsByte()) { | 4475 __ Store(value, operand, representation); |
4487 __ mov_b(operand, value); | |
4488 } else { | |
4489 __ mov(operand, value); | |
4490 } | |
4491 } | 4476 } |
4492 return; | 4477 return; |
4493 } | 4478 } |
4494 | 4479 |
4495 Register object = ToRegister(instr->object()); | 4480 Register object = ToRegister(instr->object()); |
4496 Handle<Map> transition = instr->transition(); | 4481 Handle<Map> transition = instr->transition(); |
4497 | 4482 |
4498 if (FLAG_track_fields && representation.IsSmi()) { | 4483 if (FLAG_track_fields && representation.IsSmi()) { |
4499 if (instr->value()->IsConstantOperand()) { | 4484 if (instr->value()->IsConstantOperand()) { |
4500 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4485 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4558 if (!access.IsInobject()) { | 4543 if (!access.IsInobject()) { |
4559 write_register = ToRegister(instr->temp()); | 4544 write_register = ToRegister(instr->temp()); |
4560 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4545 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4561 } | 4546 } |
4562 | 4547 |
4563 MemOperand operand = FieldOperand(write_register, offset); | 4548 MemOperand operand = FieldOperand(write_register, offset); |
4564 if (instr->value()->IsConstantOperand()) { | 4549 if (instr->value()->IsConstantOperand()) { |
4565 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4550 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4566 if (operand_value->IsRegister()) { | 4551 if (operand_value->IsRegister()) { |
4567 Register value = ToRegister(operand_value); | 4552 Register value = ToRegister(operand_value); |
4568 if (representation.IsByte()) { | 4553 __ Store(value, operand, representation); |
4569 __ mov_b(operand, value); | |
4570 } else { | |
4571 __ mov(operand, value); | |
4572 } | |
4573 } else { | 4554 } else { |
4574 Handle<Object> handle_value = ToHandle(operand_value); | 4555 Handle<Object> handle_value = ToHandle(operand_value); |
4575 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4556 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4576 __ mov(operand, handle_value); | 4557 __ mov(operand, handle_value); |
4577 } | 4558 } |
4578 } else { | 4559 } else { |
4579 Register value = ToRegister(instr->value()); | 4560 Register value = ToRegister(instr->value()); |
4580 if (representation.IsByte()) { | 4561 __ Store(value, operand, representation); |
4581 __ mov_b(operand, value); | |
4582 } else { | |
4583 __ mov(operand, value); | |
4584 } | |
4585 } | 4562 } |
4586 | 4563 |
4587 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4564 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4588 Register value = ToRegister(instr->value()); | 4565 Register value = ToRegister(instr->value()); |
4589 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4566 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
4590 // Update the write barrier for the object for in-object properties. | 4567 // Update the write barrier for the object for in-object properties. |
4591 __ RecordWriteField(write_register, | 4568 __ RecordWriteField(write_register, |
4592 offset, | 4569 offset, |
4593 value, | 4570 value, |
4594 temp, | 4571 temp, |
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6459 FixedArray::kHeaderSize - kPointerSize)); | 6436 FixedArray::kHeaderSize - kPointerSize)); |
6460 __ bind(&done); | 6437 __ bind(&done); |
6461 } | 6438 } |
6462 | 6439 |
6463 | 6440 |
6464 #undef __ | 6441 #undef __ |
6465 | 6442 |
6466 } } // namespace v8::internal | 6443 } } // namespace v8::internal |
6467 | 6444 |
6468 #endif // V8_TARGET_ARCH_IA32 | 6445 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |