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 2162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 2173 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
2174 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2174 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2175 : isolate()->builtins()->StoreIC_Initialize(); | 2175 : isolate()->builtins()->StoreIC_Initialize(); |
2176 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2176 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2177 } | 2177 } |
2178 | 2178 |
2179 | 2179 |
2180 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2180 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2181 Register context = ToRegister(instr->context()); | 2181 Register context = ToRegister(instr->context()); |
2182 Register result = ToRegister(instr->result()); | 2182 Register result = ToRegister(instr->result()); |
| 2183 Register scratch = scratch0(); |
| 2184 |
2183 __ lw(result, ContextOperand(context, instr->slot_index())); | 2185 __ lw(result, ContextOperand(context, instr->slot_index())); |
2184 if (instr->hydrogen()->RequiresHoleCheck()) { | 2186 if (instr->hydrogen()->RequiresHoleCheck()) { |
2185 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2187 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2186 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); | 2188 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2189 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); |
| 2190 } else { |
| 2191 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 2192 __ movz(result, scratch, at); |
| 2193 } |
2187 } | 2194 } |
2188 } | 2195 } |
2189 | 2196 |
2190 | 2197 |
2191 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2198 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2192 Register context = ToRegister(instr->context()); | 2199 Register context = ToRegister(instr->context()); |
2193 Register value = ToRegister(instr->value()); | 2200 Register value = ToRegister(instr->value()); |
| 2201 Register scratch = scratch0(); |
2194 MemOperand target = ContextOperand(context, instr->slot_index()); | 2202 MemOperand target = ContextOperand(context, instr->slot_index()); |
| 2203 |
| 2204 Label skip_assignment; |
| 2205 |
2195 if (instr->hydrogen()->RequiresHoleCheck()) { | 2206 if (instr->hydrogen()->RequiresHoleCheck()) { |
2196 Register scratch = scratch0(); | |
2197 __ lw(scratch, target); | 2207 __ lw(scratch, target); |
2198 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2208 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2199 DeoptimizeIf(eq, instr->environment(), scratch, Operand(at)); | 2209 |
| 2210 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2211 DeoptimizeIf(eq, instr->environment(), scratch, Operand(at)); |
| 2212 } else { |
| 2213 __ Branch(&skip_assignment, ne, scratch, Operand(at)); |
| 2214 } |
2200 } | 2215 } |
| 2216 |
2201 __ sw(value, target); | 2217 __ sw(value, target); |
2202 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2218 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2203 HType type = instr->hydrogen()->value()->type(); | 2219 HType type = instr->hydrogen()->value()->type(); |
2204 SmiCheck check_needed = | 2220 SmiCheck check_needed = |
2205 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2221 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2206 __ RecordWriteContextSlot(context, | 2222 __ RecordWriteContextSlot(context, |
2207 target.offset(), | 2223 target.offset(), |
2208 value, | 2224 value, |
2209 scratch0(), | 2225 scratch0(), |
2210 kRAHasBeenSaved, | 2226 kRAHasBeenSaved, |
2211 kSaveFPRegs, | 2227 kSaveFPRegs, |
2212 EMIT_REMEMBERED_SET, | 2228 EMIT_REMEMBERED_SET, |
2213 check_needed); | 2229 check_needed); |
2214 } | 2230 } |
| 2231 |
| 2232 __ bind(&skip_assignment); |
2215 } | 2233 } |
2216 | 2234 |
2217 | 2235 |
2218 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2236 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2219 Register object = ToRegister(instr->InputAt(0)); | 2237 Register object = ToRegister(instr->InputAt(0)); |
2220 Register result = ToRegister(instr->result()); | 2238 Register result = ToRegister(instr->result()); |
2221 if (instr->hydrogen()->is_in_object()) { | 2239 if (instr->hydrogen()->is_in_object()) { |
2222 __ lw(result, FieldMemOperand(object, instr->hydrogen()->offset())); | 2240 __ lw(result, FieldMemOperand(object, instr->hydrogen()->offset())); |
2223 } else { | 2241 } else { |
2224 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 2242 __ lw(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
(...skipping 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4660 ASSERT(!environment->HasBeenRegistered()); | 4678 ASSERT(!environment->HasBeenRegistered()); |
4661 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4679 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4662 ASSERT(osr_pc_offset_ == -1); | 4680 ASSERT(osr_pc_offset_ == -1); |
4663 osr_pc_offset_ = masm()->pc_offset(); | 4681 osr_pc_offset_ = masm()->pc_offset(); |
4664 } | 4682 } |
4665 | 4683 |
4666 | 4684 |
4667 #undef __ | 4685 #undef __ |
4668 | 4686 |
4669 } } // namespace v8::internal | 4687 } } // namespace v8::internal |
OLD | NEW |