| Index: src/ia32/lithium-codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-codegen-ia32.cc (revision 7299)
|
| +++ src/ia32/lithium-codegen-ia32.cc (working copy)
|
| @@ -2111,7 +2111,7 @@
|
|
|
|
|
| void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
|
| - Register object = ToRegister(instr->InputAt(0));
|
| + Register object = ToRegister(instr->object());
|
| Register result = ToRegister(instr->result());
|
| if (instr->hydrogen()->is_in_object()) {
|
| __ mov(result, FieldOperand(object, instr->hydrogen()->offset()));
|
| @@ -2122,6 +2122,67 @@
|
| }
|
|
|
|
|
| +void LCodeGen::EmitLoadField(Register result,
|
| + Register object,
|
| + Handle<Map> type,
|
| + LookupResult* lookup) {
|
| + ASSERT(lookup->IsProperty() && lookup->type() == FIELD);
|
| + int index = lookup->GetLocalFieldIndexFromMap(*type);
|
| + int offset = index * kPointerSize;
|
| + if (index < 0) {
|
| + // Negative property indices are in-object properties, indexed
|
| + // from the end of the fixed part of the object.
|
| + __ mov(result, FieldOperand(object, offset + type->instance_size()));
|
| + } else {
|
| + // Non-negative property indices are in the properties array.
|
| + __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset));
|
| + __ mov(result, FieldOperand(result, offset + FixedArray::kHeaderSize));
|
| + }
|
| +}
|
| +
|
| +
|
| +void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
|
| + Register object = ToRegister(instr->object());
|
| + Register result = ToRegister(instr->result());
|
| + NearLabel done;
|
| + int map_count = instr->hydrogen()->types()->length();
|
| + for (int i = 0; i < map_count - 1; ++i) {
|
| + Handle<Map> map = instr->hydrogen()->types()->at(i);
|
| + LookupResult lookup;
|
| + map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup);
|
| + NearLabel next;
|
| + __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
|
| + __ j(not_equal, &next);
|
| + EmitLoadField(result, object, map, &lookup);
|
| + __ jmp(&done);
|
| + __ bind(&next);
|
| + }
|
| + if (map_count > 0) {
|
| + Handle<Map> map = instr->hydrogen()->types()->at(map_count - 1);
|
| + LookupResult lookup;
|
| + map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup);
|
| + __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
|
| + if (instr->hydrogen()->need_generic()) {
|
| + NearLabel generic;
|
| + __ j(not_equal, &generic);
|
| + EmitLoadField(result, object, map, &lookup);
|
| + __ jmp(&done);
|
| + __ bind(&generic);
|
| + } else {
|
| + DeoptimizeIf(not_equal, instr->environment());
|
| + EmitLoadField(result, object, map, &lookup);
|
| + }
|
| + }
|
| + if (instr->hydrogen()->need_generic()) {
|
| + __ mov(ecx, instr->hydrogen()->name());
|
| + Handle<Code> ic(
|
| + isolate()->builtins()->builtin(Builtins::LoadIC_Initialize));
|
| + CallCode(ic, RelocInfo::CODE_TARGET, instr, false);
|
| + }
|
| + __ bind(&done);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
|
| ASSERT(ToRegister(instr->context()).is(esi));
|
| ASSERT(ToRegister(instr->object()).is(eax));
|
|
|