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