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

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

Issue 1259583003: PPC: 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 7 #if V8_TARGET_ARCH_PPC
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 5359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5370 for (int i = 0; i < depth(); i++) { 5370 for (int i = 0; i < depth(); i++) {
5371 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX)); 5371 __ LoadP(context_temp, ContextOperand(context, Context::PREVIOUS_INDEX));
5372 context = context_temp; 5372 context = context_temp;
5373 } 5373 }
5374 5374
5375 // Load the PropertyCell at the specified slot. 5375 // Load the PropertyCell at the specified slot.
5376 __ ShiftLeftImm(cell, slot, Operand(kPointerSizeLog2)); 5376 __ ShiftLeftImm(cell, slot, Operand(kPointerSizeLog2));
5377 __ add(cell, context, cell); 5377 __ add(cell, context, cell);
5378 __ LoadP(cell, ContextOperand(cell)); 5378 __ LoadP(cell, ContextOperand(cell));
5379 5379
5380 // Check that cell value is not the_hole.
5381 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5382 __ CompareRoot(cell_value, Heap::kTheHoleValueRootIndex);
5383 __ beq(&slow_case);
5384
5380 // Load PropertyDetails for the cell (actually only the cell_type and kind). 5385 // Load PropertyDetails for the cell (actually only the cell_type and kind).
5381 __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset)); 5386 __ LoadP(cell_details, FieldMemOperand(cell, PropertyCell::kDetailsOffset));
5382 __ SmiUntag(cell_details); 5387 __ SmiUntag(cell_details);
5383 __ andi(cell_details, cell_details, 5388 __ andi(cell_details, cell_details,
5384 Operand(PropertyDetails::PropertyCellTypeField::kMask | 5389 Operand(PropertyDetails::PropertyCellTypeField::kMask |
5385 PropertyDetails::KindField::kMask)); 5390 PropertyDetails::KindField::kMask));
5386 5391
5387 // Check if PropertyCell holds mutable data. 5392 // Check if PropertyCell holds mutable data.
5388 Label not_mutable_data; 5393 Label not_mutable_data;
5389 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode( 5394 __ cmpi(cell_details, Operand(PropertyDetails::PropertyCellTypeField::encode(
5390 PropertyCellType::kMutable) | 5395 PropertyCellType::kMutable) |
5391 PropertyDetails::KindField::encode(kData))); 5396 PropertyDetails::KindField::encode(kData)));
5392 __ bne(&not_mutable_data); 5397 __ bne(&not_mutable_data);
5393 __ JumpIfSmi(value, &fast_smi_case); 5398 __ JumpIfSmi(value, &fast_smi_case);
5394 5399
5395 __ bind(&fast_heapobject_case); 5400 __ bind(&fast_heapobject_case);
5396 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0); 5401 __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0);
5397 // RecordWriteField clobbers the value register, so we copy it before the 5402 // RecordWriteField clobbers the value register, so we copy it before the
5398 // call. 5403 // call.
5399 __ mr(r7, value); 5404 __ mr(r7, value);
5400 __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch, 5405 __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch,
5401 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 5406 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
5402 OMIT_SMI_CHECK); 5407 OMIT_SMI_CHECK);
5403 __ Ret(); 5408 __ Ret();
5404 5409
5405 __ bind(&not_mutable_data); 5410 __ bind(&not_mutable_data);
5406 // Check if PropertyCell value matches the new value (relevant for Constant, 5411 // Check if PropertyCell value matches the new value (relevant for Constant,
5407 // ConstantType and Undefined cells). 5412 // ConstantType and Undefined cells).
5408 Label not_same_value; 5413 Label not_same_value;
5409 __ LoadP(cell_value, FieldMemOperand(cell, PropertyCell::kValueOffset));
5410 __ cmp(cell_value, value); 5414 __ cmp(cell_value, value);
5411 __ bne(&not_same_value); 5415 __ bne(&not_same_value);
5412 5416
5413 if (FLAG_debug_code) { 5417 if (FLAG_debug_code) {
5414 Label done; 5418 Label done;
5415 // This can only be true for Constant, ConstantType and Undefined cells, 5419 // This can only be true for Constant, ConstantType and Undefined cells,
5416 // because we never store the_hole via this stub. 5420 // because we never store the_hole via this stub.
5417 __ cmpi(cell_details, 5421 __ cmpi(cell_details,
5418 Operand(PropertyDetails::PropertyCellTypeField::encode( 5422 Operand(PropertyDetails::PropertyCellTypeField::encode(
5419 PropertyCellType::kConstant) | 5423 PropertyCellType::kConstant) |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
5826 kStackUnwindSpace, NULL, 5830 kStackUnwindSpace, NULL,
5827 MemOperand(fp, 6 * kPointerSize), NULL); 5831 MemOperand(fp, 6 * kPointerSize), NULL);
5828 } 5832 }
5829 5833
5830 5834
5831 #undef __ 5835 #undef __
5832 } // namespace internal 5836 } // namespace internal
5833 } // namespace v8 5837 } // namespace v8
5834 5838
5835 #endif // V8_TARGET_ARCH_PPC 5839 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698