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 3207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 __ bind(&skip_assignment); | 3218 __ bind(&skip_assignment); |
3219 } | 3219 } |
3220 | 3220 |
3221 | 3221 |
3222 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3222 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3223 HObjectAccess access = instr->hydrogen()->access(); | 3223 HObjectAccess access = instr->hydrogen()->access(); |
3224 int offset = access.offset(); | 3224 int offset = access.offset(); |
3225 | 3225 |
3226 if (access.IsExternalMemory()) { | 3226 if (access.IsExternalMemory()) { |
3227 Register result = ToRegister(instr->result()); | 3227 Register result = ToRegister(instr->result()); |
3228 MemOperand operand = instr->object()->IsConstantOperand() | 3228 if (instr->object()->IsConstantOperand()) { |
3229 ? MemOperand::StaticVariable(ToExternalReference( | 3229 ExternalReference external_reference = ToExternalReference( |
3230 LConstantOperand::cast(instr->object()))) | 3230 LConstantOperand::cast(instr->object())); |
3231 : MemOperand(ToRegister(instr->object()), offset); | 3231 __ mov(result, MemOperand::StaticVariable(external_reference)); |
3232 if (access.representation().IsByte()) { | |
3233 ASSERT(instr->hydrogen()->representation().IsInteger32()); | |
3234 __ movzx_b(result, operand); | |
3235 } else { | 3232 } else { |
3236 __ mov(result, operand); | 3233 __ mov(result, MemOperand(ToRegister(instr->object()), offset)); |
3237 } | 3234 } |
3238 return; | 3235 return; |
3239 } | 3236 } |
3240 | 3237 |
3241 Register object = ToRegister(instr->object()); | 3238 Register object = ToRegister(instr->object()); |
3242 if (FLAG_track_double_fields && | 3239 if (FLAG_track_double_fields && |
3243 instr->hydrogen()->representation().IsDouble()) { | 3240 instr->hydrogen()->representation().IsDouble()) { |
3244 if (CpuFeatures::IsSupported(SSE2)) { | 3241 if (CpuFeatures::IsSupported(SSE2)) { |
3245 CpuFeatureScope scope(masm(), SSE2); | 3242 CpuFeatureScope scope(masm(), SSE2); |
3246 XMMRegister result = ToDoubleRegister(instr->result()); | 3243 XMMRegister result = ToDoubleRegister(instr->result()); |
3247 __ movdbl(result, FieldOperand(object, offset)); | 3244 __ movdbl(result, FieldOperand(object, offset)); |
3248 } else { | 3245 } else { |
3249 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3246 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
3250 } | 3247 } |
3251 return; | 3248 return; |
3252 } | 3249 } |
3253 | 3250 |
3254 Register result = ToRegister(instr->result()); | 3251 Register result = ToRegister(instr->result()); |
3255 if (!access.IsInobject()) { | 3252 if (access.IsInobject()) { |
| 3253 __ mov(result, FieldOperand(object, offset)); |
| 3254 } else { |
3256 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 3255 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
3257 object = result; | 3256 __ mov(result, FieldOperand(result, offset)); |
3258 } | |
3259 if (access.representation().IsByte()) { | |
3260 ASSERT(instr->hydrogen()->representation().IsInteger32()); | |
3261 __ movzx_b(result, FieldOperand(object, offset)); | |
3262 } else { | |
3263 __ mov(result, FieldOperand(object, offset)); | |
3264 } | 3257 } |
3265 } | 3258 } |
3266 | 3259 |
3267 | 3260 |
3268 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { | 3261 void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { |
3269 ASSERT(!operand->IsDoubleRegister()); | 3262 ASSERT(!operand->IsDoubleRegister()); |
3270 if (operand->IsConstantOperand()) { | 3263 if (operand->IsConstantOperand()) { |
3271 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); | 3264 Handle<Object> object = ToHandle(LConstantOperand::cast(operand)); |
3272 AllowDeferredHandleDereference smi_check; | 3265 AllowDeferredHandleDereference smi_check; |
3273 if (object->IsSmi()) { | 3266 if (object->IsSmi()) { |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4429 int offset = access.offset(); | 4422 int offset = access.offset(); |
4430 | 4423 |
4431 if (access.IsExternalMemory()) { | 4424 if (access.IsExternalMemory()) { |
4432 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4425 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4433 MemOperand operand = instr->object()->IsConstantOperand() | 4426 MemOperand operand = instr->object()->IsConstantOperand() |
4434 ? MemOperand::StaticVariable( | 4427 ? MemOperand::StaticVariable( |
4435 ToExternalReference(LConstantOperand::cast(instr->object()))) | 4428 ToExternalReference(LConstantOperand::cast(instr->object()))) |
4436 : MemOperand(ToRegister(instr->object()), offset); | 4429 : MemOperand(ToRegister(instr->object()), offset); |
4437 if (instr->value()->IsConstantOperand()) { | 4430 if (instr->value()->IsConstantOperand()) { |
4438 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4431 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4439 if (representation.IsByte()) { | 4432 __ mov(operand, Immediate(ToInteger32(operand_value))); |
4440 __ mov_b(operand, ToInteger32(operand_value)); | |
4441 } else { | |
4442 __ mov(operand, Immediate(ToInteger32(operand_value))); | |
4443 } | |
4444 } else { | 4433 } else { |
4445 Register value = ToRegister(instr->value()); | 4434 Register value = ToRegister(instr->value()); |
4446 if (representation.IsByte()) { | 4435 __ mov(operand, value); |
4447 __ mov_b(operand, value); | |
4448 } else { | |
4449 __ mov(operand, value); | |
4450 } | |
4451 } | 4436 } |
4452 return; | 4437 return; |
4453 } | 4438 } |
4454 | 4439 |
4455 Register object = ToRegister(instr->object()); | 4440 Register object = ToRegister(instr->object()); |
4456 Handle<Map> transition = instr->transition(); | 4441 Handle<Map> transition = instr->transition(); |
4457 | 4442 |
4458 if (FLAG_track_fields && representation.IsSmi()) { | 4443 if (FLAG_track_fields && representation.IsSmi()) { |
4459 if (instr->value()->IsConstantOperand()) { | 4444 if (instr->value()->IsConstantOperand()) { |
4460 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4445 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4513 SmiCheck check_needed = | 4498 SmiCheck check_needed = |
4514 instr->hydrogen()->value()->IsHeapObject() | 4499 instr->hydrogen()->value()->IsHeapObject() |
4515 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4500 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4516 | 4501 |
4517 Register write_register = object; | 4502 Register write_register = object; |
4518 if (!access.IsInobject()) { | 4503 if (!access.IsInobject()) { |
4519 write_register = ToRegister(instr->temp()); | 4504 write_register = ToRegister(instr->temp()); |
4520 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); | 4505 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4521 } | 4506 } |
4522 | 4507 |
4523 MemOperand operand = FieldOperand(write_register, offset); | |
4524 if (instr->value()->IsConstantOperand()) { | 4508 if (instr->value()->IsConstantOperand()) { |
4525 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4509 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4526 if (operand_value->IsRegister()) { | 4510 if (operand_value->IsRegister()) { |
4527 Register value = ToRegister(operand_value); | 4511 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); |
4528 if (representation.IsByte()) { | |
4529 __ mov_b(operand, value); | |
4530 } else { | |
4531 __ mov(operand, value); | |
4532 } | |
4533 } else { | 4512 } else { |
4534 Handle<Object> handle_value = ToHandle(operand_value); | 4513 Handle<Object> handle_value = ToHandle(operand_value); |
4535 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4514 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4536 __ mov(operand, handle_value); | 4515 __ mov(FieldOperand(write_register, offset), handle_value); |
4537 } | 4516 } |
4538 } else { | 4517 } else { |
4539 Register value = ToRegister(instr->value()); | 4518 __ mov(FieldOperand(write_register, offset), ToRegister(instr->value())); |
4540 if (representation.IsByte()) { | |
4541 __ mov_b(operand, value); | |
4542 } else { | |
4543 __ mov(operand, value); | |
4544 } | |
4545 } | 4519 } |
4546 | 4520 |
4547 if (instr->hydrogen()->NeedsWriteBarrier()) { | 4521 if (instr->hydrogen()->NeedsWriteBarrier()) { |
4548 Register value = ToRegister(instr->value()); | 4522 Register value = ToRegister(instr->value()); |
4549 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; | 4523 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; |
4550 // Update the write barrier for the object for in-object properties. | 4524 // Update the write barrier for the object for in-object properties. |
4551 __ RecordWriteField(write_register, | 4525 __ RecordWriteField(write_register, |
4552 offset, | 4526 offset, |
4553 value, | 4527 value, |
4554 temp, | 4528 temp, |
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6380 FixedArray::kHeaderSize - kPointerSize)); | 6354 FixedArray::kHeaderSize - kPointerSize)); |
6381 __ bind(&done); | 6355 __ bind(&done); |
6382 } | 6356 } |
6383 | 6357 |
6384 | 6358 |
6385 #undef __ | 6359 #undef __ |
6386 | 6360 |
6387 } } // namespace v8::internal | 6361 } } // namespace v8::internal |
6388 | 6362 |
6389 #endif // V8_TARGET_ARCH_IA32 | 6363 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |