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 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 __ LoadHeapObject(result, function); | 2337 __ LoadHeapObject(result, function); |
2338 } | 2338 } |
2339 } | 2339 } |
2340 | 2340 |
2341 | 2341 |
2342 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { | 2342 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
2343 Register object = ToRegister(instr->object()); | 2343 Register object = ToRegister(instr->object()); |
2344 Register result = ToRegister(instr->result()); | 2344 Register result = ToRegister(instr->result()); |
2345 Register scratch = scratch0(); | 2345 Register scratch = scratch0(); |
2346 int map_count = instr->hydrogen()->types()->length(); | 2346 int map_count = instr->hydrogen()->types()->length(); |
| 2347 bool need_generic = instr->hydrogen()->need_generic(); |
| 2348 |
| 2349 if (map_count == 0 && !need_generic) { |
| 2350 DeoptimizeIf(no_condition, instr->environment()); |
| 2351 return; |
| 2352 } |
2347 Handle<String> name = instr->hydrogen()->name(); | 2353 Handle<String> name = instr->hydrogen()->name(); |
2348 if (map_count == 0 && instr->hydrogen()->need_generic()) { | 2354 Label done; |
2349 __ li(a2, Operand(name)); | 2355 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2350 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2356 for (int i = 0; i < map_count; ++i) { |
2351 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2357 bool last = (i == map_count - 1); |
2352 } else { | 2358 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2353 Label done; | 2359 if (last && !need_generic) { |
2354 __ lw(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2360 Handle<Map> map = instr->hydrogen()->types()->last(); |
2355 for (int i = 0; i < map_count - 1; ++i) { | 2361 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); |
2356 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2362 } else { |
2357 Label next; | 2363 Label next; |
2358 __ Branch(&next, ne, scratch, Operand(map)); | 2364 __ Branch(&next, ne, scratch, Operand(map)); |
2359 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2365 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2360 __ Branch(&done); | 2366 __ Branch(&done); |
2361 __ bind(&next); | 2367 __ bind(&next); |
2362 } | 2368 } |
2363 if (instr->hydrogen()->need_generic()) { | |
2364 if (map_count != 0) { | |
2365 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2366 Label generic; | |
2367 __ Branch(&generic, ne, scratch, Operand(map)); | |
2368 EmitLoadFieldOrConstantFunction(result, object, map, name); | |
2369 __ Branch(&done); | |
2370 __ bind(&generic); | |
2371 } | |
2372 __ li(a2, Operand(name)); | |
2373 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | |
2374 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
2375 } else { | |
2376 if (map_count != 0) { | |
2377 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2378 DeoptimizeIf(ne, instr->environment(), scratch, Operand(map)); | |
2379 EmitLoadFieldOrConstantFunction(result, object, map, name); | |
2380 } else { | |
2381 DeoptimizeIf(al, instr->environment(), zero_reg, Operand(zero_reg)); | |
2382 } | |
2383 } | |
2384 __ bind(&done); | |
2385 } | 2369 } |
| 2370 if (need_generic) { |
| 2371 __ li(a2, Operand(name)); |
| 2372 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
| 2373 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2374 } |
| 2375 __ bind(&done); |
2386 } | 2376 } |
2387 | 2377 |
2388 | 2378 |
2389 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2379 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2390 ASSERT(ToRegister(instr->object()).is(a0)); | 2380 ASSERT(ToRegister(instr->object()).is(a0)); |
2391 ASSERT(ToRegister(instr->result()).is(v0)); | 2381 ASSERT(ToRegister(instr->result()).is(v0)); |
2392 | 2382 |
2393 // Name is always in a2. | 2383 // Name is always in a2. |
2394 __ li(a2, Operand(instr->name())); | 2384 __ li(a2, Operand(instr->name())); |
2395 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2385 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5131 __ Subu(scratch, result, scratch); | 5121 __ Subu(scratch, result, scratch); |
5132 __ lw(result, FieldMemOperand(scratch, | 5122 __ lw(result, FieldMemOperand(scratch, |
5133 FixedArray::kHeaderSize - kPointerSize)); | 5123 FixedArray::kHeaderSize - kPointerSize)); |
5134 __ bind(&done); | 5124 __ bind(&done); |
5135 } | 5125 } |
5136 | 5126 |
5137 | 5127 |
5138 #undef __ | 5128 #undef __ |
5139 | 5129 |
5140 } } // namespace v8::internal | 5130 } } // namespace v8::internal |
OLD | NEW |