OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 } | 1738 } |
1739 } | 1739 } |
1740 | 1740 |
1741 | 1741 |
1742 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 1742 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { |
1743 Register value = ToRegister(instr->input()); | 1743 Register value = ToRegister(instr->input()); |
1744 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); | 1744 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); |
1745 } | 1745 } |
1746 | 1746 |
1747 | 1747 |
| 1748 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 1749 // TODO(antonm): load a context with a separate instruction. |
| 1750 Register result = ToRegister(instr->result()); |
| 1751 HLoadContextSlot* hinstr = instr->hydrogen(); |
| 1752 Handle<Context> context = hinstr->context(); |
| 1753 Comment(";;; Load context slot %d out of %p", hinstr->index(), *context); |
| 1754 LoadHeapObject(result, context); |
| 1755 __ mov(result, Operand(result, Context::SlotOffset(hinstr->index()))); |
| 1756 } |
| 1757 |
| 1758 |
1748 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 1759 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
1749 Register object = ToRegister(instr->input()); | 1760 Register object = ToRegister(instr->input()); |
1750 Register result = ToRegister(instr->result()); | 1761 Register result = ToRegister(instr->result()); |
1751 if (instr->hydrogen()->is_in_object()) { | 1762 if (instr->hydrogen()->is_in_object()) { |
1752 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); | 1763 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); |
1753 } else { | 1764 } else { |
1754 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 1765 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
1755 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); | 1766 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); |
1756 } | 1767 } |
1757 } | 1768 } |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 2823 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
2813 LOperand* input = instr->input(); | 2824 LOperand* input = instr->input(); |
2814 ASSERT(input->IsRegister()); | 2825 ASSERT(input->IsRegister()); |
2815 Register reg = ToRegister(input); | 2826 Register reg = ToRegister(input); |
2816 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2827 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2817 instr->hydrogen()->map()); | 2828 instr->hydrogen()->map()); |
2818 DeoptimizeIf(not_equal, instr->environment()); | 2829 DeoptimizeIf(not_equal, instr->environment()); |
2819 } | 2830 } |
2820 | 2831 |
2821 | 2832 |
2822 void LCodeGen::LoadPrototype(Register result, Handle<JSObject> prototype) { | 2833 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { |
2823 if (Heap::InNewSpace(*prototype)) { | 2834 if (Heap::InNewSpace(*object)) { |
2824 Handle<JSGlobalPropertyCell> cell = | 2835 Handle<JSGlobalPropertyCell> cell = |
2825 Factory::NewJSGlobalPropertyCell(prototype); | 2836 Factory::NewJSGlobalPropertyCell(object); |
2826 __ mov(result, Operand::Cell(cell)); | 2837 __ mov(result, Operand::Cell(cell)); |
2827 } else { | 2838 } else { |
2828 __ mov(result, prototype); | 2839 __ mov(result, object); |
2829 } | 2840 } |
2830 } | 2841 } |
2831 | 2842 |
2832 | 2843 |
2833 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 2844 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
2834 Register reg = ToRegister(instr->temp()); | 2845 Register reg = ToRegister(instr->temp()); |
2835 | 2846 |
2836 Handle<JSObject> holder = instr->holder(); | 2847 Handle<JSObject> holder = instr->holder(); |
2837 Handle<Map> receiver_map = instr->receiver_map(); | 2848 Handle<Map> receiver_map = instr->receiver_map(); |
2838 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); | 2849 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); |
2839 | 2850 |
2840 // Load prototype object. | 2851 // Load prototype object. |
2841 LoadPrototype(reg, current_prototype); | 2852 LoadHeapObject(reg, current_prototype); |
2842 | 2853 |
2843 // Check prototype maps up to the holder. | 2854 // Check prototype maps up to the holder. |
2844 while (!current_prototype.is_identical_to(holder)) { | 2855 while (!current_prototype.is_identical_to(holder)) { |
2845 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2856 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2846 Handle<Map>(current_prototype->map())); | 2857 Handle<Map>(current_prototype->map())); |
2847 DeoptimizeIf(not_equal, instr->environment()); | 2858 DeoptimizeIf(not_equal, instr->environment()); |
2848 current_prototype = | 2859 current_prototype = |
2849 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 2860 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
2850 // Load next prototype object. | 2861 // Load next prototype object. |
2851 LoadPrototype(reg, current_prototype); | 2862 LoadHeapObject(reg, current_prototype); |
2852 } | 2863 } |
2853 | 2864 |
2854 // Check the holder map. | 2865 // Check the holder map. |
2855 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2866 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
2856 Handle<Map>(current_prototype->map())); | 2867 Handle<Map>(current_prototype->map())); |
2857 DeoptimizeIf(not_equal, instr->environment()); | 2868 DeoptimizeIf(not_equal, instr->environment()); |
2858 } | 2869 } |
2859 | 2870 |
2860 | 2871 |
2861 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 2872 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 ASSERT(!environment->HasBeenRegistered()); | 3166 ASSERT(!environment->HasBeenRegistered()); |
3156 RegisterEnvironmentForDeoptimization(environment); | 3167 RegisterEnvironmentForDeoptimization(environment); |
3157 ASSERT(osr_pc_offset_ == -1); | 3168 ASSERT(osr_pc_offset_ == -1); |
3158 osr_pc_offset_ = masm()->pc_offset(); | 3169 osr_pc_offset_ = masm()->pc_offset(); |
3159 } | 3170 } |
3160 | 3171 |
3161 | 3172 |
3162 #undef __ | 3173 #undef __ |
3163 | 3174 |
3164 } } // namespace v8::internal | 3175 } } // namespace v8::internal |
OLD | NEW |