Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1259853002: Cross-script variables handling fixed. It was possible to write to read-only global variable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after
5113 // Go up the context chain to the script context. 5113 // Go up the context chain to the script context.
5114 for (int i = 0; i < depth(); i++) { 5114 for (int i = 0; i < depth(); i++) {
5115 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); 5115 __ ldr(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX));
5116 context = context_temp; 5116 context = context_temp;
5117 } 5117 }
5118 5118
5119 // Load the PropertyCell at the specified slot. 5119 // Load the PropertyCell at the specified slot.
5120 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); 5120 __ add(cell, context, Operand(slot, LSL, kPointerSizeLog2));
5121 __ ldr(cell, ContextOperand(cell)); 5121 __ ldr(cell, ContextOperand(cell));
5122 5122
5123 // Check that cell value is not the_hole.
5124 __ ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5125 __ CompareRoot(cell_value, Heap::kTheHoleValueRootIndex);
5126 __ b(eq, &slow_case);
5127
5123 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5128 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5124 __ ldr(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); 5129 __ ldr(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset));
5125 __ SmiUntag(cell_details); 5130 __ SmiUntag(cell_details);
5126 __ and_(cell_details, cell_details, 5131 __ and_(cell_details, cell_details,
5127 Operand(PropertyDetails::PropertyCellTypeField::kMask | 5132 Operand(PropertyDetails::PropertyCellTypeField::kMask |
5128 PropertyDetails::KindField::kMask)); 5133 PropertyDetails::KindField::kMask));
5129 5134
5130 // Check if PropertyCell holds mutable data. 5135 // Check if PropertyCell holds mutable data.
5131 Label not_mutable_data; 5136 Label not_mutable_data;
5132 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( 5137 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
5133 PropertyCellType::kMutable) | 5138 PropertyCellType::kMutable) |
5134 PropertyDetails::KindField::encode(kData))); 5139 PropertyDetails::KindField::encode(kData)));
5135 __ b(ne, &not_mutable_data); 5140 __ b(ne, &not_mutable_data);
5136 __ JumpIfSmi(value, &fast_smi_case); 5141 __ JumpIfSmi(value, &fast_smi_case);
5137 5142
5138 __ bind(&fast_heapobject_case); 5143 __ bind(&fast_heapobject_case);
5139 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); 5144 __ str(value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5140 // RecordWriteField clobbers the value register, so we copy it before the 5145 // RecordWriteField clobbers the value register, so we copy it before the
5141 // call. 5146 // call.
5142 __ mov(r4, Operand(value)); 5147 __ mov(r4, Operand(value));
5143 __ RecordWriteField(cell, PropertyCell::kValueOffset, r4, scratch, 5148 __ RecordWriteField(cell, PropertyCell::kValueOffset, r4, scratch,
5144 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 5149 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
5145 OMIT_SMI_CHECK); 5150 OMIT_SMI_CHECK);
5146 __ Ret(); 5151 __ Ret();
5147 5152
5148 __ bind(&not_mutable_data); 5153 __ bind(&not_mutable_data);
5149 // Check if PropertyCell value matches the new value (relevant for Constant, 5154 // Check if PropertyCell value matches the new value (relevant for Constant,
5150 // ConstantType and Undefined cells). 5155 // ConstantType and Undefined cells).
5151 Label not_same_value; 5156 Label not_same_value;
5152 __ ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5153 __ cmp(cell_value, value); 5157 __ cmp(cell_value, value);
5154 __ b(ne, &not_same_value); 5158 __ b(ne, &not_same_value);
5155 5159
5156 if (FLAG_debug_code) { 5160 if (FLAG_debug_code) {
5157 Label done; 5161 Label done;
5158 // This can only be true for Constant, ConstantType and Undefined cells, 5162 // This can only be true for Constant, ConstantType and Undefined cells,
5159 // because we never store the_hole via this stub. 5163 // because we never store the_hole via this stub.
5160 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( 5164 __ cmp(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
5161 PropertyCellType::kConstant) | 5165 PropertyCellType::kConstant) |
5162 PropertyDetails::KindField::encode(kData))); 5166 PropertyDetails::KindField::encode(kData)));
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
5526 MemOperand(fp, 6 * kPointerSize), NULL); 5530 MemOperand(fp, 6 * kPointerSize), NULL);
5527 } 5531 }
5528 5532
5529 5533
5530 #undef __ 5534 #undef __
5531 5535
5532 } // namespace internal 5536 } // namespace internal
5533 } // namespace v8 5537 } // namespace v8
5534 5538
5535 #endif // V8_TARGET_ARCH_ARM 5539 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698