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

Unified Diff: src/objects.cc

Issue 223613002: When freezing global object, go through the property cell (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | « no previous file | test/mjsunit/regress/regress-global-freeze-const.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 9cda2baf0d44476c6aeef51b8deb600a5fe35395..a544c8686563fd84109f18eec414bc215f78d138 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -5507,8 +5507,11 @@ static void FreezeDictionary(Dictionary* dictionary) {
PropertyDetails details = dictionary->DetailsAt(i);
int attrs = DONT_DELETE;
// READ_ONLY is an invalid attribute for JS setters/getters.
- if (details.type() != CALLBACKS ||
- !dictionary->ValueAt(i)->IsAccessorPair()) {
+ if (details.type() == CALLBACKS) {
+ Object* v = dictionary->ValueAt(i);
+ if (v->IsPropertyCell()) v = PropertyCell::cast(v)->value();
+ if (!v->IsAccessorPair()) attrs |= READ_ONLY;
+ } else {
attrs |= READ_ONLY;
}
details = details.CopyAddAttributes(
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-global-freeze-const.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698