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 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 __ LoadHeapObject(result, function); | 2216 __ LoadHeapObject(result, function); |
2217 } | 2217 } |
2218 } | 2218 } |
2219 | 2219 |
2220 | 2220 |
2221 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { | 2221 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
2222 Register object = ToRegister(instr->object()); | 2222 Register object = ToRegister(instr->object()); |
2223 Register result = ToRegister(instr->result()); | 2223 Register result = ToRegister(instr->result()); |
2224 | 2224 |
2225 int map_count = instr->hydrogen()->types()->length(); | 2225 int map_count = instr->hydrogen()->types()->length(); |
| 2226 bool need_generic = instr->hydrogen()->need_generic(); |
| 2227 |
| 2228 if (map_count == 0 && !need_generic) { |
| 2229 DeoptimizeIf(no_condition, instr->environment()); |
| 2230 return; |
| 2231 } |
2226 Handle<String> name = instr->hydrogen()->name(); | 2232 Handle<String> name = instr->hydrogen()->name(); |
2227 | 2233 Label done; |
2228 if (map_count == 0 && instr->hydrogen()->need_generic()) { | 2234 for (int i = 0; i < map_count; ++i) { |
2229 __ Move(rcx, instr->hydrogen()->name()); | 2235 bool last = (i == map_count - 1); |
2230 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2236 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2231 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2237 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); |
2232 } else { | 2238 if (last && !need_generic) { |
2233 Label done; | 2239 DeoptimizeIf(not_equal, instr->environment()); |
2234 for (int i = 0; i < map_count - 1; ++i) { | 2240 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2235 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2241 } else { |
2236 Label next; | 2242 Label next; |
2237 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); | |
2238 __ j(not_equal, &next, Label::kNear); | 2243 __ j(not_equal, &next, Label::kNear); |
2239 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2244 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2240 __ jmp(&done, Label::kNear); | 2245 __ jmp(&done, Label::kNear); |
2241 __ bind(&next); | 2246 __ bind(&next); |
2242 } | 2247 } |
2243 if (instr->hydrogen()->need_generic()) { | |
2244 if (map_count != 0) { | |
2245 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2246 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); | |
2247 Label generic; | |
2248 __ j(not_equal, &generic, Label::kNear); | |
2249 EmitLoadFieldOrConstantFunction(result, object, map, name); | |
2250 __ jmp(&done, Label::kNear); | |
2251 __ bind(&generic); | |
2252 } | |
2253 __ Move(rcx, instr->hydrogen()->name()); | |
2254 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | |
2255 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
2256 } else { | |
2257 if (map_count != 0) { | |
2258 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2259 __ Cmp(FieldOperand(object, HeapObject::kMapOffset), map); | |
2260 DeoptimizeIf(not_equal, instr->environment()); | |
2261 EmitLoadFieldOrConstantFunction(result, object, map, name); | |
2262 } else { | |
2263 DeoptimizeIf(no_condition, instr->environment()); | |
2264 } | |
2265 } | |
2266 __ bind(&done); | |
2267 } | 2248 } |
| 2249 if (need_generic) { |
| 2250 __ Move(rcx, name); |
| 2251 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2252 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2253 } |
| 2254 __ bind(&done); |
2268 } | 2255 } |
2269 | 2256 |
2270 | 2257 |
2271 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2258 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2272 ASSERT(ToRegister(instr->object()).is(rax)); | 2259 ASSERT(ToRegister(instr->object()).is(rax)); |
2273 ASSERT(ToRegister(instr->result()).is(rax)); | 2260 ASSERT(ToRegister(instr->result()).is(rax)); |
2274 | 2261 |
2275 __ Move(rcx, instr->name()); | 2262 __ Move(rcx, instr->name()); |
2276 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2263 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2277 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2264 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 FixedArray::kHeaderSize - kPointerSize)); | 4811 FixedArray::kHeaderSize - kPointerSize)); |
4825 __ bind(&done); | 4812 __ bind(&done); |
4826 } | 4813 } |
4827 | 4814 |
4828 | 4815 |
4829 #undef __ | 4816 #undef __ |
4830 | 4817 |
4831 } } // namespace v8::internal | 4818 } } // namespace v8::internal |
4832 | 4819 |
4833 #endif // V8_TARGET_ARCH_X64 | 4820 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |