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

Unified Diff: src/objects.cc

Issue 16051002: Fix Object.freeze for objects with mixed accessors and data properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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/object-freeze.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 99fd8e21f0a6dfd0ba2019289caf06c770f241a0..c5abb109cd9ff3df0e4d5fb64bf0447638c6421a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6744,11 +6744,14 @@ MaybeObject* DescriptorArray::CopyUpToAddAttributes(
for (int i = 0; i < size; ++i) {
Object* value = GetValue(i);
PropertyDetails details = GetDetails(i);
+ int mask = DONT_DELETE | DONT_ENUM;
Toon Verwaest 2013/05/25 10:52:59 This is very confusing to me. Don't we just want t
// READ_ONLY is an invalid attribute for JS setters/getters.
- if (details.type() == CALLBACKS && value->IsAccessorPair()) {
- attributes = static_cast<PropertyAttributes>(attributes & ~READ_ONLY);
+ if (details.type() != CALLBACKS || !value->IsAccessorPair()) {
+ mask |= READ_ONLY;
}
- Descriptor desc(GetKey(i), value, details.CopyAddAttributes(attributes));
+ details = details.CopyAddAttributes(
+ static_cast<PropertyAttributes>(attributes & mask));
+ Descriptor desc(GetKey(i), value, details);
descriptors->Set(i, &desc, witness);
}
} else {
« no previous file with comments | « no previous file | test/mjsunit/object-freeze.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698