Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1294)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6708085: Enable GVN for polymorphic loads by not expanding them at the HIR level. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: x64 and arm code Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 Register result = ToRegister(instr->result()); 2168 Register result = ToRegister(instr->result());
2169 if (instr->hydrogen()->is_in_object()) { 2169 if (instr->hydrogen()->is_in_object()) {
2170 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset())); 2170 __ ldr(result, FieldMemOperand(object, instr->hydrogen()->offset()));
2171 } else { 2171 } else {
2172 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 2172 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2173 __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset())); 2173 __ ldr(result, FieldMemOperand(result, instr->hydrogen()->offset()));
2174 } 2174 }
2175 } 2175 }
2176 2176
2177 2177
2178 void LCodeGen::EmitLoadField(Register result,
2179 Register object,
2180 Handle<Map> type,
2181 LookupResult* lookup) {
2182 ASSERT(lookup->IsProperty() && lookup->type() == FIELD);
2183 int index = lookup->GetLocalFieldIndexFromMap(*type);
2184 int offset = index * kPointerSize;
2185 if (index < 0) {
2186 // Negative property indices are in-object properties, indexed
2187 // from the end of the fixed part of the object.
2188 __ ldr(result, FieldMemOperand(object, offset + type->instance_size()));
2189 } else {
2190 // Non-negative property indices are in the properties array.
2191 __ ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
2192 __ ldr(result, FieldMemOperand(result, offset + FixedArray::kHeaderSize));
2193 }
2194 }
2195
2196
2197 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2198 Register object = ToRegister(instr->object());
2199 Register result = ToRegister(instr->result());
2200 Register scratch = scratch0();
2201 Label done;
2202 int map_count = instr->hydrogen()->types()->length();
Kevin Millikin (Chromium) 2011/03/23 15:37:29 This function still feels too complicated. Isn't
fschneider 2011/03/24 08:43:30 Done.
2203 __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
2204 for (int i = 0; i < map_count - 1; ++i) {
2205 Handle<Map> map = instr->hydrogen()->types()->at(i);
2206 LookupResult lookup;
2207 map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup);
Kevin Millikin (Chromium) 2011/03/23 15:37:29 I think you can move the call to LookupInDescripto
fschneider 2011/03/24 08:43:30 Done.
2208 Label next;
2209 __ cmp(scratch, Operand(map));
2210 __ b(ne, &next);
2211 EmitLoadField(result, object, map, &lookup);
2212 __ b(&done);
2213 __ bind(&next);
2214 }
2215 if (map_count > 0) {
2216 Handle<Map> map = instr->hydrogen()->types()->at(map_count - 1);
Kevin Millikin (Chromium) 2011/03/23 15:37:29 This could be instr->hydrogen()->types()->last();
fschneider 2011/03/24 08:43:30 Done.
2217 LookupResult lookup;
2218 map->LookupInDescriptors(NULL, *instr->hydrogen()->name(), &lookup);
2219 __ cmp(scratch, Operand(map));
2220 if (instr->hydrogen()->need_generic()) {
2221 Label generic;
2222 __ b(ne, &generic);
2223 EmitLoadField(result, object, map, &lookup);
2224 __ b(&done);
2225 __ bind(&generic);
2226 } else {
2227 DeoptimizeIf(ne, instr->environment());
2228 EmitLoadField(result, object, map, &lookup);
2229 }
2230 }
2231 if (instr->hydrogen()->need_generic()) {
2232 __ mov(r2, Operand(instr->hydrogen()->name()));
2233 Handle<Code> ic(
2234 isolate()->builtins()->builtin(Builtins::LoadIC_Initialize));
2235 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2236 }
2237 __ bind(&done);
2238 }
2239
2240
2178 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2241 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2179 ASSERT(ToRegister(instr->object()).is(r0)); 2242 ASSERT(ToRegister(instr->object()).is(r0));
2180 ASSERT(ToRegister(instr->result()).is(r0)); 2243 ASSERT(ToRegister(instr->result()).is(r0));
2181 2244
2182 // Name is always in r2. 2245 // Name is always in r2.
2183 __ mov(r2, Operand(instr->name())); 2246 __ mov(r2, Operand(instr->name()));
2184 Handle<Code> ic( 2247 Handle<Code> ic(
2185 isolate()->builtins()->builtin(Builtins::LoadIC_Initialize)); 2248 isolate()->builtins()->builtin(Builtins::LoadIC_Initialize));
2186 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2249 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2187 } 2250 }
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
3972 ASSERT(!environment->HasBeenRegistered()); 4035 ASSERT(!environment->HasBeenRegistered());
3973 RegisterEnvironmentForDeoptimization(environment); 4036 RegisterEnvironmentForDeoptimization(environment);
3974 ASSERT(osr_pc_offset_ == -1); 4037 ASSERT(osr_pc_offset_ == -1);
3975 osr_pc_offset_ = masm()->pc_offset(); 4038 osr_pc_offset_ = masm()->pc_offset();
3976 } 4039 }
3977 4040
3978 4041
3979 #undef __ 4042 #undef __
3980 4043
3981 } } // namespace v8::internal 4044 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.h » ('j') | src/hydrogen-instructions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698