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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 } | 2582 } |
2583 } | 2583 } |
2584 | 2584 |
2585 | 2585 |
2586 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { | 2586 void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { |
2587 Register object = ToRegister(instr->object()); | 2587 Register object = ToRegister(instr->object()); |
2588 Register result = ToRegister(instr->result()); | 2588 Register result = ToRegister(instr->result()); |
2589 Register scratch = scratch0(); | 2589 Register scratch = scratch0(); |
2590 int map_count = instr->hydrogen()->types()->length(); | 2590 int map_count = instr->hydrogen()->types()->length(); |
2591 Handle<String> name = instr->hydrogen()->name(); | 2591 Handle<String> name = instr->hydrogen()->name(); |
2592 if (map_count == 0) { | 2592 if (map_count == 0 && instr->hydrogen()->need_generic()) { |
2593 ASSERT(instr->hydrogen()->need_generic()); | |
2594 __ mov(r2, Operand(name)); | 2593 __ mov(r2, Operand(name)); |
2595 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2594 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2596 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2595 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2597 } else { | 2596 } else { |
2598 Label done; | 2597 Label done; |
2599 __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2598 __ ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2600 for (int i = 0; i < map_count - 1; ++i) { | 2599 for (int i = 0; i < map_count - 1; ++i) { |
2601 Handle<Map> map = instr->hydrogen()->types()->at(i); | 2600 Handle<Map> map = instr->hydrogen()->types()->at(i); |
2602 Label next; | 2601 Label next; |
2603 __ cmp(scratch, Operand(map)); | 2602 __ cmp(scratch, Operand(map)); |
2604 __ b(ne, &next); | 2603 __ b(ne, &next); |
2605 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2604 EmitLoadFieldOrConstantFunction(result, object, map, name); |
2606 __ b(&done); | 2605 __ b(&done); |
2607 __ bind(&next); | 2606 __ bind(&next); |
2608 } | 2607 } |
2609 Handle<Map> map = instr->hydrogen()->types()->last(); | |
2610 __ cmp(scratch, Operand(map)); | |
2611 if (instr->hydrogen()->need_generic()) { | 2608 if (instr->hydrogen()->need_generic()) { |
2612 Label generic; | 2609 if (map_count != 0) { |
2613 __ b(ne, &generic); | 2610 Handle<Map> map = instr->hydrogen()->types()->last(); |
2614 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2611 __ cmp(scratch, Operand(map)); |
2615 __ b(&done); | 2612 Label generic; |
2616 __ bind(&generic); | 2613 __ b(ne, &generic); |
| 2614 EmitLoadFieldOrConstantFunction(result, object, map, name); |
| 2615 __ b(&done); |
| 2616 __ bind(&generic); |
| 2617 } |
2617 __ mov(r2, Operand(name)); | 2618 __ mov(r2, Operand(name)); |
2618 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 2619 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
2619 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2620 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2620 } else { | 2621 } else { |
2621 DeoptimizeIf(ne, instr->environment()); | 2622 if (map_count != 0) { |
2622 EmitLoadFieldOrConstantFunction(result, object, map, name); | 2623 Handle<Map> map = instr->hydrogen()->types()->last(); |
| 2624 __ cmp(scratch, Operand(map)); |
| 2625 DeoptimizeIf(ne, instr->environment()); |
| 2626 EmitLoadFieldOrConstantFunction(result, object, map, name); |
| 2627 } else { |
| 2628 DeoptimizeIf(al, instr->environment()); |
| 2629 } |
2623 } | 2630 } |
2624 __ bind(&done); | 2631 __ bind(&done); |
2625 } | 2632 } |
2626 } | 2633 } |
2627 | 2634 |
2628 | 2635 |
2629 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2636 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2630 ASSERT(ToRegister(instr->object()).is(r0)); | 2637 ASSERT(ToRegister(instr->object()).is(r0)); |
2631 ASSERT(ToRegister(instr->result()).is(r0)); | 2638 ASSERT(ToRegister(instr->result()).is(r0)); |
2632 | 2639 |
(...skipping 2678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5311 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5318 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5312 __ ldr(result, FieldMemOperand(scratch, | 5319 __ ldr(result, FieldMemOperand(scratch, |
5313 FixedArray::kHeaderSize - kPointerSize)); | 5320 FixedArray::kHeaderSize - kPointerSize)); |
5314 __ bind(&done); | 5321 __ bind(&done); |
5315 } | 5322 } |
5316 | 5323 |
5317 | 5324 |
5318 #undef __ | 5325 #undef __ |
5319 | 5326 |
5320 } } // namespace v8::internal | 5327 } } // namespace v8::internal |
OLD | NEW |