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

Unified Diff: src/x64/code-stubs-x64.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/runtime/runtime-object.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index 303e5954ccf4e7dda038c67f9c9f6771c7843051..6baea7fd7b640564dd56056f093a9f41dc2a3a6c 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -5091,6 +5091,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
// Load the PropertyCell at the specified slot.
__ movp(cell_reg, ContextOperand(context_reg, slot_reg));
+ // Check that value is not the_hole.
+ __ movp(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
+ __ CompareRoot(cell_value_reg, Heap::kTheHoleValueRootIndex);
+ __ j(equal, &slow_case, FLAG_debug_code ? Label::kFar : Label::kNear);
+
// Load PropertyDetails for the cell (actually only the cell_type and kind).
__ SmiToInteger32(cell_details_reg,
FieldOperand(cell_reg, PropertyCell::kDetailsOffset));
@@ -5120,7 +5125,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
// Check if PropertyCell value matches the new value (relevant for Constant,
// ConstantType and Undefined cells).
Label not_same_value;
- __ movp(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
__ cmpp(cell_value_reg, value_reg);
__ j(not_equal, &not_same_value,
FLAG_debug_code ? Label::kFar : Label::kNear);
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698