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 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2062 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2063 } | 2063 } |
2064 | 2064 |
2065 | 2065 |
2066 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2066 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2067 Register context = ToRegister(instr->context()); | 2067 Register context = ToRegister(instr->context()); |
2068 Register result = ToRegister(instr->result()); | 2068 Register result = ToRegister(instr->result()); |
2069 __ movq(result, ContextOperand(context, instr->slot_index())); | 2069 __ movq(result, ContextOperand(context, instr->slot_index())); |
2070 if (instr->hydrogen()->RequiresHoleCheck()) { | 2070 if (instr->hydrogen()->RequiresHoleCheck()) { |
2071 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2071 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
2072 DeoptimizeIf(equal, instr->environment()); | 2072 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2073 DeoptimizeIf(equal, instr->environment()); |
| 2074 } else { |
| 2075 Label is_not_hole; |
| 2076 __ j(not_equal, &is_not_hole, Label::kNear); |
| 2077 |
| 2078 __ movq(result, factory()->undefined_value(), RelocInfo::NONE); |
| 2079 |
| 2080 __ bind(&is_not_hole); |
| 2081 } |
2073 } | 2082 } |
2074 } | 2083 } |
2075 | 2084 |
2076 | 2085 |
2077 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2086 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2078 Register context = ToRegister(instr->context()); | 2087 Register context = ToRegister(instr->context()); |
2079 Register value = ToRegister(instr->value()); | 2088 Register value = ToRegister(instr->value()); |
| 2089 |
2080 Operand target = ContextOperand(context, instr->slot_index()); | 2090 Operand target = ContextOperand(context, instr->slot_index()); |
| 2091 |
| 2092 Label skip_assignment; |
2081 if (instr->hydrogen()->RequiresHoleCheck()) { | 2093 if (instr->hydrogen()->RequiresHoleCheck()) { |
2082 __ CompareRoot(target, Heap::kTheHoleValueRootIndex); | 2094 __ CompareRoot(target, Heap::kTheHoleValueRootIndex); |
2083 DeoptimizeIf(equal, instr->environment()); | 2095 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2096 DeoptimizeIf(equal, instr->environment()); |
| 2097 } else { |
| 2098 __ j(not_equal, &skip_assignment, Label::kNear); |
| 2099 } |
2084 } | 2100 } |
2085 __ movq(target, value); | 2101 __ movq(target, value); |
| 2102 |
2086 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2103 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2087 HType type = instr->hydrogen()->value()->type(); | 2104 HType type = instr->hydrogen()->value()->type(); |
2088 SmiCheck check_needed = | 2105 SmiCheck check_needed = |
2089 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2106 type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2090 int offset = Context::SlotOffset(instr->slot_index()); | 2107 int offset = Context::SlotOffset(instr->slot_index()); |
2091 Register scratch = ToRegister(instr->TempAt(0)); | 2108 Register scratch = ToRegister(instr->TempAt(0)); |
2092 __ RecordWriteContextSlot(context, | 2109 __ RecordWriteContextSlot(context, |
2093 offset, | 2110 offset, |
2094 value, | 2111 value, |
2095 scratch, | 2112 scratch, |
2096 kSaveFPRegs, | 2113 kSaveFPRegs, |
2097 EMIT_REMEMBERED_SET, | 2114 EMIT_REMEMBERED_SET, |
2098 check_needed); | 2115 check_needed); |
2099 } | 2116 } |
| 2117 |
| 2118 __ bind(&skip_assignment); |
2100 } | 2119 } |
2101 | 2120 |
2102 | 2121 |
2103 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2122 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2104 Register object = ToRegister(instr->InputAt(0)); | 2123 Register object = ToRegister(instr->InputAt(0)); |
2105 Register result = ToRegister(instr->result()); | 2124 Register result = ToRegister(instr->result()); |
2106 if (instr->hydrogen()->is_in_object()) { | 2125 if (instr->hydrogen()->is_in_object()) { |
2107 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); | 2126 __ movq(result, FieldOperand(object, instr->hydrogen()->offset())); |
2108 } else { | 2127 } else { |
2109 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); | 2128 __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); |
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4336 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
4318 ASSERT(osr_pc_offset_ == -1); | 4337 ASSERT(osr_pc_offset_ == -1); |
4319 osr_pc_offset_ = masm()->pc_offset(); | 4338 osr_pc_offset_ = masm()->pc_offset(); |
4320 } | 4339 } |
4321 | 4340 |
4322 #undef __ | 4341 #undef __ |
4323 | 4342 |
4324 } } // namespace v8::internal | 4343 } } // namespace v8::internal |
4325 | 4344 |
4326 #endif // V8_TARGET_ARCH_X64 | 4345 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |