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

Unified Diff: src/objects.cc

Issue 141031: Fix issue 386, a bug in JSObject::ReplaceSlowProperty with constant transitio... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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/objects.h ('k') | test/mjsunit/regress/regress-386.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
===================================================================
--- src/objects.cc (revision 2227)
+++ src/objects.cc (working copy)
@@ -1302,16 +1302,19 @@
Object* value,
PropertyAttributes attributes) {
Dictionary* dictionary = property_dictionary();
- PropertyDetails old_details =
- dictionary->DetailsAt(dictionary->FindStringEntry(name));
- int new_index = old_details.index();
- if (old_details.IsTransition()) new_index = 0;
+ int old_index = dictionary->FindStringEntry(name);
+ int new_enumeration_index = 0; // 0 means "Use the next available index."
+ if (old_index != -1) {
+ // All calls to ReplaceSlowProperty have had all transitions removed.
+ ASSERT(!dictionary->DetailsAt(old_index).IsTransition());
+ new_enumeration_index = dictionary->DetailsAt(old_index).index();
+ }
- PropertyDetails new_details(attributes, NORMAL, old_details.index());
+ PropertyDetails new_details(attributes, NORMAL, new_enumeration_index);
Object* result =
- property_dictionary()->SetOrAddStringEntry(name, value, new_details);
+ dictionary->SetOrAddStringEntry(name, value, new_details);
if (result->IsFailure()) return result;
- if (property_dictionary() != result) {
+ if (dictionary != result) {
set_properties(Dictionary::cast(result));
}
return value;
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/regress/regress-386.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698