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

Side by Side Diff: src/arm64/code-stubs-arm64.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/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.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 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after
5546 // Go up the context chain to the script context. 5546 // Go up the context chain to the script context.
5547 for (int i = 0; i < depth(); i++) { 5547 for (int i = 0; i < depth(); i++) {
5548 __ Ldr(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX)); 5548 __ Ldr(context_temp, ContextMemOperand(context, Context::PREVIOUS_INDEX));
5549 context = context_temp; 5549 context = context_temp;
5550 } 5550 }
5551 5551
5552 // Load the PropertyCell at the specified slot. 5552 // Load the PropertyCell at the specified slot.
5553 __ Add(cell, context, Operand(slot, LSL, kPointerSizeLog2)); 5553 __ Add(cell, context, Operand(slot, LSL, kPointerSizeLog2));
5554 __ Ldr(cell, ContextMemOperand(cell)); 5554 __ Ldr(cell, ContextMemOperand(cell));
5555 5555
5556 // Check that cell value is not the_hole.
5557 __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5558 __ JumpIfRoot(cell_value, Heap::kTheHoleValueRootIndex, &slow_case);
5559
5556 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5560 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5557 __ Ldr(cell_details, 5561 __ Ldr(cell_details,
5558 UntagSmiFieldMemOperand(cell, PropertyCell::kDetailsOffset)); 5562 UntagSmiFieldMemOperand(cell, PropertyCell::kDetailsOffset));
5559 __ And(cell_details, cell_details, 5563 __ And(cell_details, cell_details,
5560 PropertyDetails::PropertyCellTypeField::kMask | 5564 PropertyDetails::PropertyCellTypeField::kMask |
5561 PropertyDetails::KindField::kMask); 5565 PropertyDetails::KindField::kMask);
5562 5566
5563 // Check if PropertyCell holds mutable data. 5567 // Check if PropertyCell holds mutable data.
5564 Label not_mutable_data; 5568 Label not_mutable_data;
5565 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( 5569 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode(
5566 PropertyCellType::kMutable) | 5570 PropertyCellType::kMutable) |
5567 PropertyDetails::KindField::encode(kData)); 5571 PropertyDetails::KindField::encode(kData));
5568 __ B(ne, &not_mutable_data); 5572 __ B(ne, &not_mutable_data);
5569 __ JumpIfSmi(value, &fast_smi_case); 5573 __ JumpIfSmi(value, &fast_smi_case);
5570 __ Bind(&fast_heapobject_case); 5574 __ Bind(&fast_heapobject_case);
5571 __ Str(value, FieldMemOperand(cell, PropertyCell::kValueOffset)); 5575 __ Str(value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5572 // RecordWriteField clobbers the value register, so we copy it before the 5576 // RecordWriteField clobbers the value register, so we copy it before the
5573 // call. 5577 // call.
5574 __ Mov(x11, value); 5578 __ Mov(x11, value);
5575 __ RecordWriteField(cell, PropertyCell::kValueOffset, x11, x12, 5579 __ RecordWriteField(cell, PropertyCell::kValueOffset, x11, x12,
5576 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 5580 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
5577 OMIT_SMI_CHECK); 5581 OMIT_SMI_CHECK);
5578 __ Ret(); 5582 __ Ret();
5579 5583
5580 __ Bind(&not_mutable_data); 5584 __ Bind(&not_mutable_data);
5581 // Check if PropertyCell value matches the new value (relevant for Constant, 5585 // Check if PropertyCell value matches the new value (relevant for Constant,
5582 // ConstantType and Undefined cells). 5586 // ConstantType and Undefined cells).
5583 Label not_same_value; 5587 Label not_same_value;
5584 __ Ldr(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5585 __ Cmp(cell_value, value); 5588 __ Cmp(cell_value, value);
5586 __ B(ne, &not_same_value); 5589 __ B(ne, &not_same_value);
5587 5590
5588 if (FLAG_debug_code) { 5591 if (FLAG_debug_code) {
5589 Label done; 5592 Label done;
5590 // This can only be true for Constant, ConstantType and Undefined cells, 5593 // This can only be true for Constant, ConstantType and Undefined cells,
5591 // because we never store the_hole via this stub. 5594 // because we never store the_hole via this stub.
5592 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode( 5595 __ Cmp(cell_details, PropertyDetails::PropertyCellTypeField::encode(
5593 PropertyCellType::kConstant) | 5596 PropertyCellType::kConstant) |
5594 PropertyDetails::KindField::encode(kData)); 5597 PropertyDetails::KindField::encode(kData));
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
5984 MemOperand(fp, 6 * kPointerSize), NULL); 5987 MemOperand(fp, 6 * kPointerSize), NULL);
5985 } 5988 }
5986 5989
5987 5990
5988 #undef __ 5991 #undef __
5989 5992
5990 } // namespace internal 5993 } // namespace internal
5991 } // namespace v8 5994 } // namespace v8
5992 5995
5993 #endif // V8_TARGET_ARCH_ARM64 5996 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698