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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 __ Set(temp, Immediate(lower)); | 1853 __ Set(temp, Immediate(lower)); |
1847 __ movd(xmm0, Operand(temp)); | 1854 __ movd(xmm0, Operand(temp)); |
1848 __ por(res, xmm0); | 1855 __ por(res, xmm0); |
1849 } | 1856 } |
1850 } | 1857 } |
1851 } | 1858 } |
1852 } | 1859 } |
1853 } | 1860 } |
1854 | 1861 |
1855 | 1862 |
| 1863 void LCodeGen::DoConstantE(LConstantE* instr) { |
| 1864 __ lea(ToRegister(instr->result()), Operand::StaticVariable(instr->value())); |
| 1865 } |
| 1866 |
| 1867 |
1856 void LCodeGen::DoConstantT(LConstantT* instr) { | 1868 void LCodeGen::DoConstantT(LConstantT* instr) { |
1857 Register reg = ToRegister(instr->result()); | 1869 Register reg = ToRegister(instr->result()); |
1858 Handle<Object> handle = instr->value(); | 1870 Handle<Object> handle = instr->value(); |
1859 AllowDeferredHandleDereference smi_check; | 1871 AllowDeferredHandleDereference smi_check; |
1860 __ LoadObject(reg, handle); | 1872 __ LoadObject(reg, handle); |
1861 } | 1873 } |
1862 | 1874 |
1863 | 1875 |
1864 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1876 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1865 Register result = ToRegister(instr->result()); | 1877 Register result = ToRegister(instr->result()); |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 check_needed); | 3054 check_needed); |
3043 } | 3055 } |
3044 | 3056 |
3045 __ bind(&skip_assignment); | 3057 __ bind(&skip_assignment); |
3046 } | 3058 } |
3047 | 3059 |
3048 | 3060 |
3049 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 3061 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
3050 HObjectAccess access = instr->hydrogen()->access(); | 3062 HObjectAccess access = instr->hydrogen()->access(); |
3051 int offset = access.offset(); | 3063 int offset = access.offset(); |
| 3064 |
| 3065 if (access.IsExternalMemory()) { |
| 3066 Register result = ToRegister(instr->result()); |
| 3067 if (instr->object()->IsConstantOperand()) { |
| 3068 ExternalReference external_reference = ToExternalReference( |
| 3069 LConstantOperand::cast(instr->object())); |
| 3070 __ mov(result, MemOperand::StaticVariable(external_reference)); |
| 3071 } else { |
| 3072 __ mov(result, MemOperand(ToRegister(instr->object()), offset)); |
| 3073 } |
| 3074 return; |
| 3075 } |
| 3076 |
3052 Register object = ToRegister(instr->object()); | 3077 Register object = ToRegister(instr->object()); |
3053 if (FLAG_track_double_fields && | 3078 if (FLAG_track_double_fields && |
3054 instr->hydrogen()->representation().IsDouble()) { | 3079 instr->hydrogen()->representation().IsDouble()) { |
3055 if (CpuFeatures::IsSupported(SSE2)) { | 3080 if (CpuFeatures::IsSupported(SSE2)) { |
3056 CpuFeatureScope scope(masm(), SSE2); | 3081 CpuFeatureScope scope(masm(), SSE2); |
3057 XMMRegister result = ToDoubleRegister(instr->result()); | 3082 XMMRegister result = ToDoubleRegister(instr->result()); |
3058 __ movdbl(result, FieldOperand(object, offset)); | 3083 __ movdbl(result, FieldOperand(object, offset)); |
3059 } else { | 3084 } else { |
3060 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); | 3085 X87Mov(ToX87Register(instr->result()), FieldOperand(object, offset)); |
3061 } | 3086 } |
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4321 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { | 4346 void LCodeGen::DoInnerAllocatedObject(LInnerAllocatedObject* instr) { |
4322 Register result = ToRegister(instr->result()); | 4347 Register result = ToRegister(instr->result()); |
4323 Register base = ToRegister(instr->base_object()); | 4348 Register base = ToRegister(instr->base_object()); |
4324 __ lea(result, Operand(base, instr->offset())); | 4349 __ lea(result, Operand(base, instr->offset())); |
4325 } | 4350 } |
4326 | 4351 |
4327 | 4352 |
4328 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { | 4353 void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { |
4329 Representation representation = instr->representation(); | 4354 Representation representation = instr->representation(); |
4330 | 4355 |
4331 Register object = ToRegister(instr->object()); | |
4332 HObjectAccess access = instr->hydrogen()->access(); | 4356 HObjectAccess access = instr->hydrogen()->access(); |
4333 int offset = access.offset(); | 4357 int offset = access.offset(); |
4334 | 4358 |
| 4359 if (access.IsExternalMemory()) { |
| 4360 MemOperand operand = instr->object()->IsConstantOperand() |
| 4361 ? MemOperand::StaticVariable( |
| 4362 ToExternalReference(LConstantOperand::cast(instr->object()))) |
| 4363 : MemOperand(ToRegister(instr->object()), offset); |
| 4364 if (instr->value()->IsConstantOperand()) { |
| 4365 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
| 4366 __ mov(operand, Immediate(ToInteger32(operand_value))); |
| 4367 } else { |
| 4368 Register value = ToRegister(instr->value()); |
| 4369 __ mov(operand, value); |
| 4370 } |
| 4371 return; |
| 4372 } |
| 4373 |
| 4374 Register object = ToRegister(instr->object()); |
4335 Handle<Map> transition = instr->transition(); | 4375 Handle<Map> transition = instr->transition(); |
4336 | 4376 |
4337 if (FLAG_track_fields && representation.IsSmi()) { | 4377 if (FLAG_track_fields && representation.IsSmi()) { |
4338 if (instr->value()->IsConstantOperand()) { | 4378 if (instr->value()->IsConstantOperand()) { |
4339 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4379 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4340 if (!IsSmi(operand_value)) { | 4380 if (!IsSmi(operand_value)) { |
4341 DeoptimizeIf(no_condition, instr->environment()); | 4381 DeoptimizeIf(no_condition, instr->environment()); |
4342 } | 4382 } |
4343 } | 4383 } |
4344 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 4384 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4389 } | 4429 } |
4390 | 4430 |
4391 // Do the store. | 4431 // Do the store. |
4392 SmiCheck check_needed = | 4432 SmiCheck check_needed = |
4393 instr->hydrogen()->value()->IsHeapObject() | 4433 instr->hydrogen()->value()->IsHeapObject() |
4394 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 4434 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
4395 | 4435 |
4396 Register write_register = object; | 4436 Register write_register = object; |
4397 if (!access.IsInobject()) { | 4437 if (!access.IsInobject()) { |
4398 write_register = ToRegister(instr->temp()); | 4438 write_register = ToRegister(instr->temp()); |
4399 __ mov(write_register, | 4439 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); |
4400 FieldOperand(object, JSObject::kPropertiesOffset)); | |
4401 } | 4440 } |
4402 | 4441 |
4403 if (instr->value()->IsConstantOperand()) { | 4442 if (instr->value()->IsConstantOperand()) { |
4404 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 4443 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
4405 if (operand_value->IsRegister()) { | 4444 if (operand_value->IsRegister()) { |
4406 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); | 4445 __ mov(FieldOperand(write_register, offset), ToRegister(operand_value)); |
4407 } else { | 4446 } else { |
4408 Handle<Object> handle_value = ToHandle(operand_value); | 4447 Handle<Object> handle_value = ToHandle(operand_value); |
4409 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); | 4448 ASSERT(!instr->hydrogen()->NeedsWriteBarrier()); |
4410 __ mov(FieldOperand(write_register, offset), handle_value); | 4449 __ mov(FieldOperand(write_register, offset), handle_value); |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6484 FixedArray::kHeaderSize - kPointerSize)); | 6523 FixedArray::kHeaderSize - kPointerSize)); |
6485 __ bind(&done); | 6524 __ bind(&done); |
6486 } | 6525 } |
6487 | 6526 |
6488 | 6527 |
6489 #undef __ | 6528 #undef __ |
6490 | 6529 |
6491 } } // namespace v8::internal | 6530 } } // namespace v8::internal |
6492 | 6531 |
6493 #endif // V8_TARGET_ARCH_IA32 | 6532 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |