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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 } | 1903 } |
1904 } | 1904 } |
1905 | 1905 |
1906 | 1906 |
1907 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 1907 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { |
1908 Register value = ToRegister(instr->input()); | 1908 Register value = ToRegister(instr->input()); |
1909 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); | 1909 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); |
1910 } | 1910 } |
1911 | 1911 |
1912 | 1912 |
| 1913 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 1914 // TODO(antonm): load a context with a separate instruction. |
| 1915 Register result = ToRegister(instr->result()); |
| 1916 __ LoadContext(result, instr->context_chain_length()); |
| 1917 __ mov(result, ContextOperand(result, instr->slot_index())); |
| 1918 } |
| 1919 |
| 1920 |
1913 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 1921 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
1914 Register object = ToRegister(instr->input()); | 1922 Register object = ToRegister(instr->input()); |
1915 Register result = ToRegister(instr->result()); | 1923 Register result = ToRegister(instr->result()); |
1916 if (instr->hydrogen()->is_in_object()) { | 1924 if (instr->hydrogen()->is_in_object()) { |
1917 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); | 1925 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); |
1918 } else { | 1926 } else { |
1919 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 1927 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
1920 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); | 1928 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); |
1921 } | 1929 } |
1922 } | 1930 } |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3060 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 3068 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
3061 LOperand* input = instr->input(); | 3069 LOperand* input = instr->input(); |
3062 ASSERT(input->IsRegister()); | 3070 ASSERT(input->IsRegister()); |
3063 Register reg = ToRegister(input); | 3071 Register reg = ToRegister(input); |
3064 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3072 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
3065 instr->hydrogen()->map()); | 3073 instr->hydrogen()->map()); |
3066 DeoptimizeIf(not_equal, instr->environment()); | 3074 DeoptimizeIf(not_equal, instr->environment()); |
3067 } | 3075 } |
3068 | 3076 |
3069 | 3077 |
3070 void LCodeGen::LoadPrototype(Register result, Handle<JSObject> prototype) { | 3078 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { |
3071 if (Heap::InNewSpace(*prototype)) { | 3079 if (Heap::InNewSpace(*object)) { |
3072 Handle<JSGlobalPropertyCell> cell = | 3080 Handle<JSGlobalPropertyCell> cell = |
3073 Factory::NewJSGlobalPropertyCell(prototype); | 3081 Factory::NewJSGlobalPropertyCell(object); |
3074 __ mov(result, Operand::Cell(cell)); | 3082 __ mov(result, Operand::Cell(cell)); |
3075 } else { | 3083 } else { |
3076 __ mov(result, prototype); | 3084 __ mov(result, object); |
3077 } | 3085 } |
3078 } | 3086 } |
3079 | 3087 |
3080 | 3088 |
3081 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 3089 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
3082 Register reg = ToRegister(instr->temp()); | 3090 Register reg = ToRegister(instr->temp()); |
3083 | 3091 |
3084 Handle<JSObject> holder = instr->holder(); | 3092 Handle<JSObject> holder = instr->holder(); |
3085 Handle<Map> receiver_map = instr->receiver_map(); | 3093 Handle<Map> receiver_map = instr->receiver_map(); |
3086 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); | 3094 Handle<JSObject> current_prototype(JSObject::cast(receiver_map->prototype())); |
3087 | 3095 |
3088 // Load prototype object. | 3096 // Load prototype object. |
3089 LoadPrototype(reg, current_prototype); | 3097 LoadHeapObject(reg, current_prototype); |
3090 | 3098 |
3091 // Check prototype maps up to the holder. | 3099 // Check prototype maps up to the holder. |
3092 while (!current_prototype.is_identical_to(holder)) { | 3100 while (!current_prototype.is_identical_to(holder)) { |
3093 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3101 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
3094 Handle<Map>(current_prototype->map())); | 3102 Handle<Map>(current_prototype->map())); |
3095 DeoptimizeIf(not_equal, instr->environment()); | 3103 DeoptimizeIf(not_equal, instr->environment()); |
3096 current_prototype = | 3104 current_prototype = |
3097 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 3105 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
3098 // Load next prototype object. | 3106 // Load next prototype object. |
3099 LoadPrototype(reg, current_prototype); | 3107 LoadHeapObject(reg, current_prototype); |
3100 } | 3108 } |
3101 | 3109 |
3102 // Check the holder map. | 3110 // Check the holder map. |
3103 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3111 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
3104 Handle<Map>(current_prototype->map())); | 3112 Handle<Map>(current_prototype->map())); |
3105 DeoptimizeIf(not_equal, instr->environment()); | 3113 DeoptimizeIf(not_equal, instr->environment()); |
3106 } | 3114 } |
3107 | 3115 |
3108 | 3116 |
3109 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 3117 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 ASSERT(!environment->HasBeenRegistered()); | 3411 ASSERT(!environment->HasBeenRegistered()); |
3404 RegisterEnvironmentForDeoptimization(environment); | 3412 RegisterEnvironmentForDeoptimization(environment); |
3405 ASSERT(osr_pc_offset_ == -1); | 3413 ASSERT(osr_pc_offset_ == -1); |
3406 osr_pc_offset_ = masm()->pc_offset(); | 3414 osr_pc_offset_ = masm()->pc_offset(); |
3407 } | 3415 } |
3408 | 3416 |
3409 | 3417 |
3410 #undef __ | 3418 #undef __ |
3411 | 3419 |
3412 } } // namespace v8::internal | 3420 } } // namespace v8::internal |
OLD | NEW |