Chromium Code Reviews| 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 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1810 } | 1810 } |
| 1811 } | 1811 } |
| 1812 | 1812 |
| 1813 | 1813 |
| 1814 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 1814 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { |
| 1815 Register value = ToRegister(instr->input()); | 1815 Register value = ToRegister(instr->input()); |
| 1816 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); | 1816 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); |
| 1817 } | 1817 } |
| 1818 | 1818 |
| 1819 | 1819 |
| 1820 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | |
| 1821 // TODO(antonm): load a context with a separate instruction. | |
| 1822 Register result = ToRegister(instr->result()); | |
| 1823 HLoadContextSlot* hinstr = instr->hydrogen(); | |
|
Kevin Millikin (Chromium)
2010/12/20 12:05:44
It's typical for the Lithium instructions to have
antonm
2010/12/20 20:39:24
Done.
| |
| 1824 Comment(";;; Load context slot %d at %d", | |
|
Kevin Millikin (Chromium)
2010/12/20 12:05:44
There will automatically be a comment with the pri
antonm
2010/12/20 20:39:24
Done.
| |
| 1825 hinstr->slot_index(), hinstr->context_chain_length()); | |
| 1826 __ LoadContext(result, hinstr->context_chain_length()); | |
| 1827 __ mov(result, ContextOperand(result, hinstr->slot_index())); | |
| 1828 } | |
| 1829 | |
| 1830 | |
| 1820 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 1831 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 1821 Register object = ToRegister(instr->input()); | 1832 Register object = ToRegister(instr->input()); |
| 1822 Register result = ToRegister(instr->result()); | 1833 Register result = ToRegister(instr->result()); |
| 1823 if (instr->hydrogen()->is_in_object()) { | 1834 if (instr->hydrogen()->is_in_object()) { |
| 1824 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); | 1835 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); |
| 1825 } else { | 1836 } else { |
| 1826 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 1837 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 1827 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); | 1838 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); |
| 1828 } | 1839 } |
| 1829 } | 1840 } |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2903 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 2914 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
| 2904 LOperand* input = instr->input(); | 2915 LOperand* input = instr->input(); |
| 2905 ASSERT(input->IsRegister()); | 2916 ASSERT(input->IsRegister()); |
| 2906 Register reg = ToRegister(input); | 2917 Register reg = ToRegister(input); |
| 2907 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2918 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 2908 instr->hydrogen()->map()); | 2919 instr->hydrogen()->map()); |
| 2909 DeoptimizeIf(not_equal, instr->environment()); | 2920 DeoptimizeIf(not_equal, instr->environment()); |
| 2910 } | 2921 } |
| 2911 | 2922 |
| 2912 | 2923 |
| 2913 void LCodeGen::LoadPrototype(Register result, Handle<JSObject> prototype) { | 2924 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { |
| 2914 if (Heap::InNewSpace(*prototype)) { | 2925 if (Heap::InNewSpace(*object)) { |
| 2915 Handle<JSGlobalPropertyCell> cell = | 2926 Handle<JSGlobalPropertyCell> cell = |
| 2916 Factory::NewJSGlobalPropertyCell(prototype); | 2927 Factory::NewJSGlobalPropertyCell(object); |
| 2917 __ mov(result, Operand::Cell(cell)); | 2928 __ mov(result, Operand::Cell(cell)); |
| 2918 } else { | 2929 } else { |
| 2919 __ mov(result, prototype); | 2930 __ mov(result, object); |
| 2920 } | 2931 } |
| 2921 } | 2932 } |
| 2922 | 2933 |
| 2923 | 2934 |
| 2924 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 2935 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 2925 Register reg = ToRegister(instr->temp()); | 2936 Register reg = ToRegister(instr->temp()); |
| 2926 | 2937 |
| 2927 Handle<JSObject> holder = instr->holder(); | 2938 Handle<JSObject> holder = instr->holder(); |
| 2928 Handle<Map> receiver_map = instr->receiver_map(); | 2939 Handle<Map> receiver_map = instr->receiver_map(); |
| 2929 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); | 2940 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); |
| 2930 | 2941 |
| 2931 // Load prototype object. | 2942 // Load prototype object. |
| 2932 LoadPrototype(reg, current_prototype); | 2943 LoadHeapObject(reg, current_prototype); |
| 2933 | 2944 |
| 2934 // Check prototype maps up to the holder. | 2945 // Check prototype maps up to the holder. |
| 2935 while (!current_prototype.is_identical_to(holder)) { | 2946 while (!current_prototype.is_identical_to(holder)) { |
| 2936 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2947 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 2937 Handle<Map>(current_prototype->map())); | 2948 Handle<Map>(current_prototype->map())); |
| 2938 DeoptimizeIf(not_equal, instr->environment()); | 2949 DeoptimizeIf(not_equal, instr->environment()); |
| 2939 current_prototype = | 2950 current_prototype = |
| 2940 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 2951 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
| 2941 // Load next prototype object. | 2952 // Load next prototype object. |
| 2942 LoadPrototype(reg, current_prototype); | 2953 LoadHeapObject(reg, current_prototype); |
| 2943 } | 2954 } |
| 2944 | 2955 |
| 2945 // Check the holder map. | 2956 // Check the holder map. |
| 2946 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 2957 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 2947 Handle<Map>(current_prototype->map())); | 2958 Handle<Map>(current_prototype->map())); |
| 2948 DeoptimizeIf(not_equal, instr->environment()); | 2959 DeoptimizeIf(not_equal, instr->environment()); |
| 2949 } | 2960 } |
| 2950 | 2961 |
| 2951 | 2962 |
| 2952 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 2963 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3246 ASSERT(!environment->HasBeenRegistered()); | 3257 ASSERT(!environment->HasBeenRegistered()); |
| 3247 RegisterEnvironmentForDeoptimization(environment); | 3258 RegisterEnvironmentForDeoptimization(environment); |
| 3248 ASSERT(osr_pc_offset_ == -1); | 3259 ASSERT(osr_pc_offset_ == -1); |
| 3249 osr_pc_offset_ = masm()->pc_offset(); | 3260 osr_pc_offset_ = masm()->pc_offset(); |
| 3250 } | 3261 } |
| 3251 | 3262 |
| 3252 | 3263 |
| 3253 #undef __ | 3264 #undef __ |
| 3254 | 3265 |
| 3255 } } // namespace v8::internal | 3266 } } // namespace v8::internal |
| OLD | NEW |