Chromium Code Reviews| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 } | 678 } |
| 679 | 679 |
| 680 | 680 |
| 681 double LCodeGen::ToDouble(LConstantOperand* op) const { | 681 double LCodeGen::ToDouble(LConstantOperand* op) const { |
| 682 HConstant* constant = chunk_->LookupConstant(op); | 682 HConstant* constant = chunk_->LookupConstant(op); |
| 683 ASSERT(constant->HasDoubleValue()); | 683 ASSERT(constant->HasDoubleValue()); |
| 684 return constant->DoubleValue(); | 684 return constant->DoubleValue(); |
| 685 } | 685 } |
| 686 | 686 |
| 687 | 687 |
| 688 ExternalReference LCodeGen::ToExternalReference(LConstantOperand* op) const { | |
| 689 HConstant* constant = chunk_->LookupConstant(op); | |
| 690 ASSERT(constant->HasExternalReferenceValue()); | |
| 691 return constant->ExternalReferenceValue(); | |
| 692 } | |
| 693 | |
| 694 | |
| 688 bool LCodeGen::IsInteger32(LConstantOperand* op) const { | 695 bool LCodeGen::IsInteger32(LConstantOperand* op) const { |
| 689 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); | 696 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); |
| 690 } | 697 } |
| 691 | 698 |
| 692 | 699 |
| 693 bool LCodeGen::IsSmi(LConstantOperand* op) const { | 700 bool LCodeGen::IsSmi(LConstantOperand* op) const { |
| 694 return chunk_->LookupLiteralRepresentation(op).IsSmi(); | 701 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
| 695 } | 702 } |
| 696 | 703 |
| 697 | 704 |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1839 __ Set(temp, Immediate(lower)); | 1846 __ Set(temp, Immediate(lower)); |
| 1840 __ movd(xmm0, Operand(temp)); | 1847 __ movd(xmm0, Operand(temp)); |
| 1841 __ por(res, xmm0); | 1848 __ por(res, xmm0); |
| 1842 } | 1849 } |
| 1843 } | 1850 } |
| 1844 } | 1851 } |
| 1845 } | 1852 } |
| 1846 } | 1853 } |
| 1847 | 1854 |
| 1848 | 1855 |
| 1856 void LCodeGen::DoConstantE(LConstantE* instr) { | |
| 1857 __ lea(ToRegister(instr->result()), Operand::StaticVariable(instr->value())); | |
| 1858 } | |
| 1859 | |
| 1860 | |
| 1849 void LCodeGen::DoConstantT(LConstantT* instr) { | 1861 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 1850 Register reg = ToRegister(instr->result()); | 1862 Register reg = ToRegister(instr->result()); |
| 1851 Handle<Object> handle = instr->value(); | 1863 Handle<Object> handle = instr->value(); |
| 1852 AllowDeferredHandleDereference smi_check; | 1864 AllowDeferredHandleDereference smi_check; |
| 1853 __ LoadObject(reg, handle); | 1865 __ LoadObject(reg, handle); |
| 1854 } | 1866 } |
| 1855 | 1867 |
| 1856 | 1868 |
| 1857 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1869 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
| 1858 Register result = ToRegister(instr->result()); | 1870 Register result = ToRegister(instr->result()); |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3035 check_needed); | 3047 check_needed); |
| 3036 } | 3048 } |
| 3037 | 3049 |
| 3038 __ bind(&skip_assignment); | 3050 __ bind(&skip_assignment); |
| 3039 } | 3051 } |
| 3040 | 3052 |
| 3041 | 3053 |
| 3042 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3054 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 3043 HObjectAccess access = instr->hydrogen()->access(); | 3055 HObjectAccess access = instr->hydrogen()->access(); |
| 3044 int offset = access.offset(); | 3056 int offset = access.offset(); |
| 3057 | |
| 3058 if (access.IsExternalMemory()) { | |
| 3059 MemOperand operand = instr->object()->IsConstantOperand() | |
| 3060 ? MemOperand::StaticVariable(ToExternalReference( | |
| 3061 LConstantOperand::cast(instr->object()))) | |
|
danno
2013/07/29 10:40:14
nit: funky indentatoin
Benedikt Meurer
2013/07/29 13:57:51
Done.
| |
| 3062 : MemOperand(ToRegister(instr->object()), offset); | |
| 3063 Register result = ToRegister(instr->result()); | |
| 3064 __ mov(result, operand); | |
| 3065 return; | |
| 3066 } | |
| 3067 | |
| 3045 Register object = ToRegister(instr->object()); | 3068 Register object = ToRegister(instr->object()); |
| 3046 if (FLAG_track_double_fields && | 3069 if (FLAG_track_double_fields && |
| 3047 instr->hydrogen()->representation().IsDouble()) { | 3070 instr->hydrogen()->representation().IsDouble()) { |
| 3048 if (CpuFeatures::IsSupported(SSE2)) { | 3071 if (CpuFeatures::IsSupported(SSE2)) { |
| 3049 CpuFeatureScope scope(masm(), SSE2); | 3072 CpuFeatureScope scope(masm(), SSE2); |
| 3050 XMMRegister result = ToDoubleRegister(instr->result()); | 3073 XMMRegister result = ToDoubleRegister(instr->result()); |
| 3051 __ movdbl(result, FieldOperand(object, offset)); | 3074 __ movdbl(result, FieldOperand(object, offset)); |
| 3052 } else { | 3075 } else { |
| 3053 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3076 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
| 3054 } | 3077 } |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4314 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4337 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
| 4315 Register result = ToRegister(instr->result()); | 4338 Register result = ToRegister(instr->result()); |
| 4316 Register base = ToRegister(instr->base_object()); | 4339 Register base = ToRegister(instr->base_object()); |
| 4317 __ lea(result, Operand(base, instr->offset())); | 4340 __ lea(result, Operand(base, instr->offset())); |
| 4318 } | 4341 } |
| 4319 | 4342 |
| 4320 | 4343 |
| 4321 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4344 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
| 4322 Representation representation = instr->representation(); | 4345 Representation representation = instr->representation(); |
| 4323 | 4346 |
| 4324 Register object = ToRegister(instr->object()); | |
| 4325 HObjectAccess access = instr->hydrogen()->access(); | 4347 HObjectAccess access = instr->hydrogen()->access(); |
| 4326 int offset = access.offset(); | 4348 int offset = access.offset(); |
| 4327 | 4349 |
| 4350 if (access.IsExternalMemory()) { | |
| 4351 MemOperand operand = instr->object()->IsConstantOperand() | |
| 4352 ? MemOperand::StaticVariable(ToExternalReference( | |
| 4353 LConstantOperand::cast(instr->object()))) | |
|
danno
2013/07/29 10:40:14
nit: funky indentatoin
Benedikt Meurer
2013/07/29 13:57:51
Sven suggested to keep it this way.
| |
| 4354 : MemOperand(ToRegister(instr->object()), offset); | |
| 4355 if (instr->value()->IsConstantOperand()) { | |
| 4356 __ mov(operand, Immediate(ToInteger32( | |
| 4357 LConstantOperand::cast(instr->value())))); | |
|
danno
2013/07/29 10:40:14
nit: funky indentatoin
Benedikt Meurer
2013/07/29 13:57:51
Done.
| |
| 4358 } else { | |
| 4359 Register value = ToRegister(instr->value()); | |
| 4360 __ mov(operand, value); | |
| 4361 } | |
| 4362 return; | |
| 4363 } | |
| 4364 | |
| 4365 Register object = ToRegister(instr->object()); | |
| 4328 Handle<Map> transition = instr->transition(); | 4366 Handle<Map> transition = instr->transition(); |
| 4329 | 4367 |
| 4330 if (FLAG_track_fields && representation.IsSmi()) { | 4368 if (FLAG_track_fields && representation.IsSmi()) { |
| 4331 if (instr->value()->IsConstantOperand()) { | 4369 if (instr->value()->IsConstantOperand()) { |
| 4332 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4370 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4333 if (!IsSmi(operand_value)) { | 4371 if (!IsSmi(operand_value)) { |
| 4334 DeoptimizeIf(no_condition, instr->environment()); | 4372 DeoptimizeIf(no_condition, instr->environment()); |
| 4335 } | 4373 } |
| 4336 } | 4374 } |
| 4337 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4375 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4382 } | 4420 } |
| 4383 | 4421 |
| 4384 // Do the store. | 4422 // Do the store. |
| 4385 SmiCheck check_needed = | 4423 SmiCheck check_needed = |
| 4386 instr->hydrogen()->value()->IsHeapObject() | 4424 instr->hydrogen()->value()->IsHeapObject() |
| 4387 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4425 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
| 4388 | 4426 |
| 4389 Register write_register = object; | 4427 Register write_register = object; |
| 4390 if (!access.IsInobject()) { | 4428 if (!access.IsInobject()) { |
| 4391 write_register = ToRegister(instr->temp()); | 4429 write_register = ToRegister(instr->temp()); |
| 4392 __ mov(write_register, | 4430 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 4393 FieldOperand(object, JSObject::kPropertiesOffset)); | |
| 4394 } | 4431 } |
| 4395 | 4432 |
| 4396 if (instr->value()->IsConstantOperand()) { | 4433 if (instr->value()->IsConstantOperand()) { |
| 4397 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4434 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4398 if (operand_value->IsRegister()) { | 4435 if (operand_value->IsRegister()) { |
| 4399 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); | 4436 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); |
| 4400 } else { | 4437 } else { |
| 4401 Handle<Object> handle_value = ToHandle(operand_value); | 4438 Handle<Object> handle_value = ToHandle(operand_value); |
| 4402 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4439 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
| 4403 __ mov(FieldOperand(write_register, offset), handle_value); | 4440 __ mov(FieldOperand(write_register, offset), handle_value); |
| (...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6499 FixedArray::kHeaderSize - kPointerSize)); | 6536 FixedArray::kHeaderSize - kPointerSize)); |
| 6500 __ bind(&done); | 6537 __ bind(&done); |
| 6501 } | 6538 } |
| 6502 | 6539 |
| 6503 | 6540 |
| 6504 #undef __ | 6541 #undef __ |
| 6505 | 6542 |
| 6506 } } // namespace v8::internal | 6543 } } // namespace v8::internal |
| 6507 | 6544 |
| 6508 #endif // V8_TARGET_ARCH_IA32 | 6545 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |