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

Unified Diff: src/mips64/code-stubs-mips64.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/mips/code-stubs-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/code-stubs-mips64.cc
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
index dad5e75fd75b47f3f7d0d560aefa0cbdd71be4aa..f2661830d2b20bd0432fad378f482c1b85d6daa7 100644
--- a/src/mips64/code-stubs-mips64.cc
+++ b/src/mips64/code-stubs-mips64.cc
@@ -5340,7 +5340,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
Register name_reg = a3;
Register value_reg = a0;
Register cell_reg = a4;
- Register cell_details_reg = a5;
+ Register cell_value_reg = a5;
+ Register cell_details_reg = a6;
Label fast_heapobject_case, fast_smi_case, slow_case;
if (FLAG_debug_code) {
@@ -5361,6 +5362,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
__ Daddu(at, at, Context::SlotOffset(0));
__ ld(cell_reg, MemOperand(at));
+ // Check that cell value is not the_hole.
+ __ ld(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).
__ ld(cell_details_reg,
FieldMemOperand(cell_reg, PropertyCell::kDetailsOffset));
@@ -5389,8 +5395,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;
- __ ld(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,
@@ -5421,8 +5426,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;
- __ ld(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/mips/code-stubs-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698