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

Side by Side Diff: src/objects.cc

Issue 10908216: Ensure correct enumeration indices in the dict (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-148376.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; 480 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value;
481 } 481 }
482 Object* dict; 482 Object* dict;
483 { MaybeObject* maybe_dict = 483 { MaybeObject* maybe_dict =
484 property_dictionary()->Add(name, store_value, details); 484 property_dictionary()->Add(name, store_value, details);
485 if (!maybe_dict->ToObject(&dict)) return maybe_dict; 485 if (!maybe_dict->ToObject(&dict)) return maybe_dict;
486 } 486 }
487 set_properties(StringDictionary::cast(dict)); 487 set_properties(StringDictionary::cast(dict));
488 return value; 488 return value;
489 } 489 }
490 // Preserve enumeration index. 490
491 PropertyDetails original_details = property_dictionary()->DetailsAt(entry);
492 int enumeration_index;
493 // Preserve the enumeration index unless the property was deleted.
494 if (original_details.IsDeleted()) {
495 enumeration_index = property_dictionary()->NextEnumerationIndex();
496 property_dictionary()->SetNextEnumerationIndex(enumeration_index + 1);
497 } else {
498 enumeration_index = original_details.dictionary_index();
499 ASSERT(enumeration_index > 0);
500 }
501
491 details = PropertyDetails( 502 details = PropertyDetails(
492 details.attributes(), 503 details.attributes(), details.type(), enumeration_index);
493 details.type(),
494 property_dictionary()->DetailsAt(entry).dictionary_index());
495 504
496 if (IsGlobalObject()) { 505 if (IsGlobalObject()) {
497 JSGlobalPropertyCell* cell = 506 JSGlobalPropertyCell* cell =
498 JSGlobalPropertyCell::cast(property_dictionary()->ValueAt(entry)); 507 JSGlobalPropertyCell::cast(property_dictionary()->ValueAt(entry));
499 cell->set_value(value); 508 cell->set_value(value);
500 // Please note we have to update the property details. 509 // Please note we have to update the property details.
501 property_dictionary()->DetailsAtPut(entry, details); 510 property_dictionary()->DetailsAtPut(entry, details);
502 } else { 511 } else {
503 property_dictionary()->SetEntry(entry, name, value, details); 512 property_dictionary()->SetEntry(entry, name, value, details);
504 } 513 }
(...skipping 12964 matching lines...) Expand 10 before | Expand all | Expand 10 after
13469 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13470 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13471 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13472 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13473 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13474 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13475 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13476 } 13485 }
13477 13486
13478 } } // namespace v8::internal 13487 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-148376.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698