OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 5073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5084 | 5084 |
5085 // Go up context chain to the script context. | 5085 // Go up context chain to the script context. |
5086 for (int i = 0; i < depth(); ++i) { | 5086 for (int i = 0; i < depth(); ++i) { |
5087 __ movp(rdi, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | 5087 __ movp(rdi, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); |
5088 context_reg = rdi; | 5088 context_reg = rdi; |
5089 } | 5089 } |
5090 | 5090 |
5091 // Load the PropertyCell at the specified slot. | 5091 // Load the PropertyCell at the specified slot. |
5092 __ movp(cell_reg, ContextOperand(context_reg, slot_reg)); | 5092 __ movp(cell_reg, ContextOperand(context_reg, slot_reg)); |
5093 | 5093 |
| 5094 // Check that value is not the_hole. |
| 5095 __ movp(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); |
| 5096 __ CompareRoot(cell_value_reg, Heap::kTheHoleValueRootIndex); |
| 5097 __ j(equal, &slow_case, FLAG_debug_code ? Label::kFar : Label::kNear); |
| 5098 |
5094 // Load PropertyDetails for the cell (actually only the cell_type and kind). | 5099 // Load PropertyDetails for the cell (actually only the cell_type and kind). |
5095 __ SmiToInteger32(cell_details_reg, | 5100 __ SmiToInteger32(cell_details_reg, |
5096 FieldOperand(cell_reg, PropertyCell::kDetailsOffset)); | 5101 FieldOperand(cell_reg, PropertyCell::kDetailsOffset)); |
5097 __ andl(cell_details_reg, | 5102 __ andl(cell_details_reg, |
5098 Immediate(PropertyDetails::PropertyCellTypeField::kMask | | 5103 Immediate(PropertyDetails::PropertyCellTypeField::kMask | |
5099 PropertyDetails::KindField::kMask)); | 5104 PropertyDetails::KindField::kMask)); |
5100 | 5105 |
5101 | 5106 |
5102 // Check if PropertyCell holds mutable data. | 5107 // Check if PropertyCell holds mutable data. |
5103 Label not_mutable_data; | 5108 Label not_mutable_data; |
5104 __ cmpl(cell_details_reg, | 5109 __ cmpl(cell_details_reg, |
5105 Immediate(PropertyDetails::PropertyCellTypeField::encode( | 5110 Immediate(PropertyDetails::PropertyCellTypeField::encode( |
5106 PropertyCellType::kMutable) | | 5111 PropertyCellType::kMutable) | |
5107 PropertyDetails::KindField::encode(kData))); | 5112 PropertyDetails::KindField::encode(kData))); |
5108 __ j(not_equal, ¬_mutable_data); | 5113 __ j(not_equal, ¬_mutable_data); |
5109 __ JumpIfSmi(value_reg, &fast_smi_case); | 5114 __ JumpIfSmi(value_reg, &fast_smi_case); |
5110 __ bind(&fast_heapobject_case); | 5115 __ bind(&fast_heapobject_case); |
5111 __ movp(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg); | 5116 __ movp(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg); |
5112 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, | 5117 __ RecordWriteField(cell_reg, PropertyCell::kValueOffset, value_reg, |
5113 cell_value_reg, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 5118 cell_value_reg, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
5114 OMIT_SMI_CHECK); | 5119 OMIT_SMI_CHECK); |
5115 // RecordWriteField clobbers the value register, so we need to reload. | 5120 // RecordWriteField clobbers the value register, so we need to reload. |
5116 __ movp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); | 5121 __ movp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); |
5117 __ Ret(); | 5122 __ Ret(); |
5118 __ bind(¬_mutable_data); | 5123 __ bind(¬_mutable_data); |
5119 | 5124 |
5120 // Check if PropertyCell value matches the new value (relevant for Constant, | 5125 // Check if PropertyCell value matches the new value (relevant for Constant, |
5121 // ConstantType and Undefined cells). | 5126 // ConstantType and Undefined cells). |
5122 Label not_same_value; | 5127 Label not_same_value; |
5123 __ movp(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); | |
5124 __ cmpp(cell_value_reg, value_reg); | 5128 __ cmpp(cell_value_reg, value_reg); |
5125 __ j(not_equal, ¬_same_value, | 5129 __ j(not_equal, ¬_same_value, |
5126 FLAG_debug_code ? Label::kFar : Label::kNear); | 5130 FLAG_debug_code ? Label::kFar : Label::kNear); |
5127 if (FLAG_debug_code) { | 5131 if (FLAG_debug_code) { |
5128 Label done; | 5132 Label done; |
5129 // This can only be true for Constant, ConstantType and Undefined cells, | 5133 // This can only be true for Constant, ConstantType and Undefined cells, |
5130 // because we never store the_hole via this stub. | 5134 // because we never store the_hole via this stub. |
5131 __ cmpl(cell_details_reg, | 5135 __ cmpl(cell_details_reg, |
5132 Immediate(PropertyDetails::PropertyCellTypeField::encode( | 5136 Immediate(PropertyDetails::PropertyCellTypeField::encode( |
5133 PropertyCellType::kConstant) | | 5137 PropertyCellType::kConstant) | |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5582 kStackSpace, nullptr, return_value_operand, NULL); | 5586 kStackSpace, nullptr, return_value_operand, NULL); |
5583 } | 5587 } |
5584 | 5588 |
5585 | 5589 |
5586 #undef __ | 5590 #undef __ |
5587 | 5591 |
5588 } // namespace internal | 5592 } // namespace internal |
5589 } // namespace v8 | 5593 } // namespace v8 |
5590 | 5594 |
5591 #endif // V8_TARGET_ARCH_X64 | 5595 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |