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