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

Unified Diff: src/mips/code-stubs-mips.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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 7dbc5d8e7359dc7d5b07a1a95b117e498eedf8ef..8c8baa62dbd9fa9b1b26955a2839e429e578e1b7 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -5309,7 +5309,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
Register name_reg = a3;
Register value_reg = a0;
Register cell_reg = t0;
- Register cell_details_reg = t1;
+ Register cell_value_reg = t1;
+ Register cell_details_reg = t2;
Label fast_heapobject_case, fast_smi_case, slow_case;
if (FLAG_debug_code) {
@@ -5330,6 +5331,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
__ Addu(at, at, Context::SlotOffset(0));
__ lw(cell_reg, MemOperand(at));
+ // Check that cell value is not the_hole.
+ __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset));
+ __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
+ __ Branch(&slow_case, eq, cell_value_reg, Operand(at));
+
// Load PropertyDetails for the cell (actually only the cell_type and kind).
__ lw(cell_details_reg,
FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset));
@@ -5358,8 +5364,7 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
// Check if PropertyCell value matches the new value (relevant for Constant,
// ConstantType and Undefined cells).
Label not_same_value;
- __ lw(at, FieldMemOperand(cell_reg, PropertyCell::kValueOffset));
- __ Branch(&not_same_value, ne, value_reg, Operand(at));
+ __ Branch(&not_same_value, ne, value_reg, Operand(cell_value_reg));
if (FLAG_debug_code) {
Label done;
// This can only be true for Constant, ConstantType and Undefined cells,
@@ -5390,8 +5395,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
// Now either both old and new values must be SMIs or both must be heap
// objects with same map.
Label value_is_heap_object;
- Register cell_value_reg = cell_details_reg;
- __ lw(cell_value_reg, FieldMemOperand(cell_reg, PropertyCell::kValueOffset));
__ JumpIfNotSmi(value_reg, &value_is_heap_object);
__ JumpIfNotSmi(cell_value_reg, &slow_case);
// Old and new values are SMIs, no need for a write barrier here.
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698