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

Side by Side Diff: src/ia32/code-stubs-ia32.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 | « src/arm64/code-stubs-arm64.cc ('k') | src/mips/code-stubs-mips.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 5155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5166 5166
5167 // Go up context chain to the script context. 5167 // Go up context chain to the script context.
5168 for (int i = 0; i < depth(); ++i) { 5168 for (int i = 0; i < depth(); ++i) {
5169 __ mov(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); 5169 __ mov(cell_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX));
5170 context_reg = cell_reg; 5170 context_reg = cell_reg;
5171 } 5171 }
5172 5172
5173 // Load the PropertyCell at the specified slot. 5173 // Load the PropertyCell at the specified slot.
5174 __ mov(cell_reg, ContextOperand(context_reg, slot_reg)); 5174 __ mov(cell_reg, ContextOperand(context_reg, slot_reg));
5175 5175
5176 // Check that cell value is not the_hole.
5177 {
5178 // TODO(bmeurer): use ecx (name_reg) when name parameter is removed.
5179 Register cell_value_reg = cell_details_reg;
5180 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
5181 __ CompareRoot(cell_value_reg, Heap::kTheHoleValueRootIndex);
5182 __ j(equal, &slow_case, FLAG_debug_code ? Label::kFar : Label::kNear);
5183 }
5184
5176 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5185 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5177 __ mov(cell_details_reg, 5186 __ mov(cell_details_reg,
5178 FieldOperand(cell_reg, PropertyCell::kDetailsOffset)); 5187 FieldOperand(cell_reg, PropertyCell::kDetailsOffset));
5179 __ SmiUntag(cell_details_reg); 5188 __ SmiUntag(cell_details_reg);
5180 __ and_(cell_details_reg, 5189 __ and_(cell_details_reg,
5181 Immediate(PropertyDetails::PropertyCellTypeField::kMask | 5190 Immediate(PropertyDetails::PropertyCellTypeField::kMask |
5182 PropertyDetails::KindField::kMask)); 5191 PropertyDetails::KindField::kMask));
5183 5192
5184 5193
5185 // Check if PropertyCell holds mutable data. 5194 // Check if PropertyCell holds mutable data.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
5233 // Check if PropertyCell contains data with constant type. 5242 // Check if PropertyCell contains data with constant type.
5234 __ cmp(cell_details_reg, 5243 __ cmp(cell_details_reg,
5235 Immediate(PropertyDetails::PropertyCellTypeField::encode( 5244 Immediate(PropertyDetails::PropertyCellTypeField::encode(
5236 PropertyCellType::kConstantType) | 5245 PropertyCellType::kConstantType) |
5237 PropertyDetails::KindField::encode(kData))); 5246 PropertyDetails::KindField::encode(kData)));
5238 __ j(not_equal, &slow_case, Label::kNear); 5247 __ j(not_equal, &slow_case, Label::kNear);
5239 5248
5240 // Now either both old and new values must be SMIs or both must be heap 5249 // Now either both old and new values must be SMIs or both must be heap
5241 // objects with same map. 5250 // objects with same map.
5242 Label value_is_heap_object; 5251 Label value_is_heap_object;
5252 // TODO(bmeurer): use ecx (name_reg) when name parameter is removed.
5243 Register cell_value_reg = cell_details_reg; 5253 Register cell_value_reg = cell_details_reg;
5244 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset)); 5254 __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
5245 __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear); 5255 __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear);
5246 __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear); 5256 __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear);
5247 // Old and new values are SMIs, no need for a write barrier here. 5257 // Old and new values are SMIs, no need for a write barrier here.
5248 __ bind(&fast_smi_case); 5258 __ bind(&fast_smi_case);
5249 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg); 5259 __ mov(FieldOperand(cell_reg, PropertyCell::kValueOffset), value_reg);
5250 __ Ret(); 5260 __ Ret();
5251 __ bind(&value_is_heap_object); 5261 __ bind(&value_is_heap_object);
5252 __ JumpIfSmi(cell_value_reg, &slow_case, Label::kNear); 5262 __ JumpIfSmi(cell_value_reg, &slow_case, Label::kNear);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
5654 Operand(ebp, 7 * kPointerSize), NULL); 5664 Operand(ebp, 7 * kPointerSize), NULL);
5655 } 5665 }
5656 5666
5657 5667
5658 #undef __ 5668 #undef __
5659 5669
5660 } // namespace internal 5670 } // namespace internal
5661 } // namespace v8 5671 } // namespace v8
5662 5672
5663 #endif // V8_TARGET_ARCH_IA32 5673 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698