| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 } | 2097 } |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 | 2100 |
| 2101 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { | 2101 void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { |
| 2102 Register value = ToRegister(instr->input()); | 2102 Register value = ToRegister(instr->input()); |
| 2103 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); | 2103 __ mov(Operand::Cell(instr->hydrogen()->cell()), value); |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 | 2106 |
| 2107 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2108 // TODO(antonm): load a context with a separate instruction. |
| 2109 Register result = ToRegister(instr->result()); |
| 2110 __ LoadContext(result, instr->context_chain_length()); |
| 2111 __ mov(result, ContextOperand(result, instr->slot_index())); |
| 2112 } |
| 2113 |
| 2114 |
| 2107 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2115 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
| 2108 Register object = ToRegister(instr->input()); | 2116 Register object = ToRegister(instr->input()); |
| 2109 Register result = ToRegister(instr->result()); | 2117 Register result = ToRegister(instr->result()); |
| 2110 if (instr->hydrogen()->is_in_object()) { | 2118 if (instr->hydrogen()->is_in_object()) { |
| 2111 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); | 2119 __ mov(result, FieldOperand(object, instr->hydrogen()->offset())); |
| 2112 } else { | 2120 } else { |
| 2113 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2121 __ mov(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
| 2114 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); | 2122 __ mov(result, FieldOperand(result, instr->hydrogen()->offset())); |
| 2115 } | 2123 } |
| 2116 } | 2124 } |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3288 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 3296 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
| 3289 LOperand* input = instr->input(); | 3297 LOperand* input = instr->input(); |
| 3290 ASSERT(input->IsRegister()); | 3298 ASSERT(input->IsRegister()); |
| 3291 Register reg = ToRegister(input); | 3299 Register reg = ToRegister(input); |
| 3292 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3300 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 3293 instr->hydrogen()->map()); | 3301 instr->hydrogen()->map()); |
| 3294 DeoptimizeIf(not_equal, instr->environment()); | 3302 DeoptimizeIf(not_equal, instr->environment()); |
| 3295 } | 3303 } |
| 3296 | 3304 |
| 3297 | 3305 |
| 3298 void LCodeGen::LoadPrototype(Register result, Handle<JSObject> prototype) { | 3306 void LCodeGen::LoadHeapObject(Register result, Handle<HeapObject> object) { |
| 3299 if (Heap::InNewSpace(*prototype)) { | 3307 if (Heap::InNewSpace(*object)) { |
| 3300 Handle<JSGlobalPropertyCell> cell = | 3308 Handle<JSGlobalPropertyCell> cell = |
| 3301 Factory::NewJSGlobalPropertyCell(prototype); | 3309 Factory::NewJSGlobalPropertyCell(object); |
| 3302 __ mov(result, Operand::Cell(cell)); | 3310 __ mov(result, Operand::Cell(cell)); |
| 3303 } else { | 3311 } else { |
| 3304 __ mov(result, prototype); | 3312 __ mov(result, object); |
| 3305 } | 3313 } |
| 3306 } | 3314 } |
| 3307 | 3315 |
| 3308 | 3316 |
| 3309 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { | 3317 void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| 3310 Register reg = ToRegister(instr->temp()); | 3318 Register reg = ToRegister(instr->temp()); |
| 3311 | 3319 |
| 3312 Handle<JSObject> holder = instr->holder(); | 3320 Handle<JSObject> holder = instr->holder(); |
| 3313 Handle<JSObject> current_prototype = instr->prototype(); | 3321 Handle<JSObject> current_prototype = instr->prototype(); |
| 3314 | 3322 |
| 3315 // Load prototype object. | 3323 // Load prototype object. |
| 3316 LoadPrototype(reg, current_prototype); | 3324 LoadHeapObject(reg, current_prototype); |
| 3317 | 3325 |
| 3318 // Check prototype maps up to the holder. | 3326 // Check prototype maps up to the holder. |
| 3319 while (!current_prototype.is_identical_to(holder)) { | 3327 while (!current_prototype.is_identical_to(holder)) { |
| 3320 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3328 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 3321 Handle<Map>(current_prototype->map())); | 3329 Handle<Map>(current_prototype->map())); |
| 3322 DeoptimizeIf(not_equal, instr->environment()); | 3330 DeoptimizeIf(not_equal, instr->environment()); |
| 3323 current_prototype = | 3331 current_prototype = |
| 3324 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 3332 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
| 3325 // Load next prototype object. | 3333 // Load next prototype object. |
| 3326 LoadPrototype(reg, current_prototype); | 3334 LoadHeapObject(reg, current_prototype); |
| 3327 } | 3335 } |
| 3328 | 3336 |
| 3329 // Check the holder map. | 3337 // Check the holder map. |
| 3330 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3338 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 3331 Handle<Map>(current_prototype->map())); | 3339 Handle<Map>(current_prototype->map())); |
| 3332 DeoptimizeIf(not_equal, instr->environment()); | 3340 DeoptimizeIf(not_equal, instr->environment()); |
| 3333 } | 3341 } |
| 3334 | 3342 |
| 3335 | 3343 |
| 3336 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 3344 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3632 ASSERT(osr_pc_offset_ == -1); | 3640 ASSERT(osr_pc_offset_ == -1); |
| 3633 osr_pc_offset_ = masm()->pc_offset(); | 3641 osr_pc_offset_ = masm()->pc_offset(); |
| 3634 } | 3642 } |
| 3635 | 3643 |
| 3636 | 3644 |
| 3637 #undef __ | 3645 #undef __ |
| 3638 | 3646 |
| 3639 } } // namespace v8::internal | 3647 } } // namespace v8::internal |
| 3640 | 3648 |
| 3641 #endif // V8_TARGET_ARCH_IA32 | 3649 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |