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

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

Issue 10386089: Simplify DoLoadNamedFieldPolymorphic (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
2267 __ push(ToOperand(operand)); 2267 __ push(ToOperand(operand));
2268 } 2268 }
2269 } 2269 }
2270 2270
2271 2271
2272 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { 2272 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
2273 Register object = ToRegister(instr->object()); 2273 Register object = ToRegister(instr->object());
2274 Register result = ToRegister(instr->result()); 2274 Register result = ToRegister(instr->result());
2275 2275
2276 int map_count = instr->hydrogen()->types()->length(); 2276 int map_count = instr->hydrogen()->types()->length();
2277 bool need_generic = instr->hydrogen()->need_generic();
2278
2279 if (map_count == 0 && !need_generic) {
2280 DeoptimizeIf(no_condition, instr->environment());
2281 return;
2282 }
2277 Handle<String> name = instr->hydrogen()->name(); 2283 Handle<String> name = instr->hydrogen()->name();
2278 if (map_count == 0 && instr->hydrogen()->need_generic()) { 2284 Label done;
2279 __ mov(ecx, name); 2285 for (int i = 0; i < map_count; ++i) {
2280 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2286 bool last = (i == map_count - 1);
2281 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2287 Handle<Map> map = instr->hydrogen()->types()->at(i);
2282 } else { 2288 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
2283 Label done; 2289 if (last && !need_generic) {
2284 for (int i = 0; i < map_count - 1; ++i) { 2290 DeoptimizeIf(not_equal, instr->environment());
2285 Handle<Map> map = instr->hydrogen()->types()->at(i); 2291 EmitLoadFieldOrConstantFunction(result, object, map, name);
2292 } else {
2286 Label next; 2293 Label next;
2287 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
2288 __ j(not_equal, &next, Label::kNear); 2294 __ j(not_equal, &next, Label::kNear);
2289 EmitLoadFieldOrConstantFunction(result, object, map, name); 2295 EmitLoadFieldOrConstantFunction(result, object, map, name);
2290 __ jmp(&done, Label::kNear); 2296 __ jmp(&done, Label::kNear);
2291 __ bind(&next); 2297 __ bind(&next);
2292 } 2298 }
2293 if (instr->hydrogen()->need_generic()) {
2294 if (map_count != 0) {
2295 Handle<Map> map = instr->hydrogen()->types()->last();
2296 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
2297 Label generic;
2298 __ j(not_equal, &generic, Label::kNear);
2299 EmitLoadFieldOrConstantFunction(result, object, map, name);
2300 __ jmp(&done, Label::kNear);
2301 __ bind(&generic);
2302 }
2303 __ mov(ecx, name);
2304 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2305 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2306 } else {
2307 if (map_count != 0) {
2308 Handle<Map> map = instr->hydrogen()->types()->last();
2309 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map);
2310 DeoptimizeIf(not_equal, instr->environment());
2311 EmitLoadFieldOrConstantFunction(result, object, map, name);
2312 } else {
2313 DeoptimizeIf(no_condition, instr->environment());
2314 }
2315 }
2316 __ bind(&done);
2317 } 2299 }
2300 if (need_generic) {
2301 __ mov(ecx, name);
2302 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
2303 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2304 }
2305 __ bind(&done);
2318 } 2306 }
2319 2307
2320 2308
2321 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { 2309 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) {
2322 ASSERT(ToRegister(instr->context()).is(esi)); 2310 ASSERT(ToRegister(instr->context()).is(esi));
2323 ASSERT(ToRegister(instr->object()).is(edx)); 2311 ASSERT(ToRegister(instr->object()).is(edx));
2324 ASSERT(ToRegister(instr->result()).is(eax)); 2312 ASSERT(ToRegister(instr->result()).is(eax));
2325 2313
2326 __ mov(ecx, instr->name()); 2314 __ mov(ecx, instr->name());
2327 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); 2315 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize();
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
5069 FixedArray::kHeaderSize - kPointerSize)); 5057 FixedArray::kHeaderSize - kPointerSize));
5070 __ bind(&done); 5058 __ bind(&done);
5071 } 5059 }
5072 5060
5073 5061
5074 #undef __ 5062 #undef __
5075 5063
5076 } } // namespace v8::internal 5064 } } // namespace v8::internal
5077 5065
5078 #endif // V8_TARGET_ARCH_IA32 5066 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698