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 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Handle<String> name = instr->hydrogen()->name(); | 2277 Handle<String> name = instr->hydrogen()->name(); |
| 2278 if (map_count == 0) { | 2278 if (map_count == 0 && instr->hydrogen()->need_generic()) { |
| 2279 ASSERT(instr->hydrogen()->need_generic()); | |
| 2280 __ mov(ecx, name); | 2279 __ mov(ecx, name); |
| 2281 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2280 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2282 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2281 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2283 } else { | 2282 } else { |
| 2284 Label done; | 2283 Label done; |
| 2285 for (int i = 0; i < map_count - 1; ++i) { | 2284 for (int i = 0; i < map_count - 1; ++i) { |
| 2286 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2285 Handle<Map> map = instr->hydrogen()->types()->at(i); |
| 2287 Label next; | 2286 Label next; |
| 2288 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map); | 2287 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map); |
| 2289 __ j(not_equal, &next, Label::kNear); | 2288 __ j(not_equal, &next, Label::kNear); |
| 2290 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2289 EmitLoadFieldOrConstantFunction(result, object, map, name); |
| 2291 __ jmp(&done, Label::kNear); | 2290 __ jmp(&done, Label::kNear); |
| 2292 __ bind(&next); | 2291 __ bind(&next); |
| 2293 } | 2292 } |
| 2294 Handle<Map> map = instr->hydrogen()->types()->last(); | |
| 2295 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map); | |
| 2296 if (instr->hydrogen()->need_generic()) { | 2293 if (instr->hydrogen()->need_generic()) { |
| 2297 Label generic; | 2294 if (map_count != 0) { |
|
Michael Starzinger
2012/05/10 13:06:01
It seems as if this condition always holds, otherw
Erik Corry
2012/05/10 20:28:36
No, there are two conditions to get into the IC ca
| |
| 2298 __ j(not_equal, &generic, Label::kNear); | 2295 Handle<Map> map = instr->hydrogen()->types()->last(); |
| 2299 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2296 __ cmp(FieldOperand(object, HeapObject::kMapOffset), map); |
| 2300 __ jmp(&done, Label::kNear); | 2297 Label generic; |
| 2301 __ bind(&generic); | 2298 __ j(not_equal, &generic, Label::kNear); |
| 2299 EmitLoadFieldOrConstantFunction(result, object, map, name); | |
| 2300 __ jmp(&done, Label::kNear); | |
| 2301 __ bind(&generic); | |
| 2302 } | |
| 2302 __ mov(ecx, name); | 2303 __ mov(ecx, name); |
| 2303 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2304 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2304 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2305 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2305 } else { | 2306 } else { |
| 2306 DeoptimizeIf(not_equal, instr->environment()); | 2307 if (map_count != 0) { |
|
Michael Starzinger
2012/05/10 13:06:01
Then it makes sense to turn this into an "else if"
Erik Corry
2012/05/10 20:28:36
Same objection.
| |
| 2307 EmitLoadFieldOrConstantFunction(result, object, map, name); | 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 } | |
| 2308 } | 2315 } |
| 2309 __ bind(&done); | 2316 __ bind(&done); |
| 2310 } | 2317 } |
| 2311 } | 2318 } |
| 2312 | 2319 |
| 2313 | 2320 |
| 2314 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2321 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
| 2315 ASSERT(ToRegister(instr->context()).is(esi)); | 2322 ASSERT(ToRegister(instr->context()).is(esi)); |
| 2316 ASSERT(ToRegister(instr->object()).is(edx)); | 2323 ASSERT(ToRegister(instr->object()).is(edx)); |
| 2317 ASSERT(ToRegister(instr->result()).is(eax)); | 2324 ASSERT(ToRegister(instr->result()).is(eax)); |
| (...skipping 2744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5062 FixedArray::kHeaderSize - kPointerSize)); | 5069 FixedArray::kHeaderSize - kPointerSize)); |
| 5063 __ bind(&done); | 5070 __ bind(&done); |
| 5064 } | 5071 } |
| 5065 | 5072 |
| 5066 | 5073 |
| 5067 #undef __ | 5074 #undef __ |
| 5068 | 5075 |
| 5069 } } // namespace v8::internal | 5076 } } // namespace v8::internal |
| 5070 | 5077 |
| 5071 #endif // V8_TARGET_ARCH_IA32 | 5078 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |