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

Unified Diff: src/objects.cc

Issue 1700: Do not shortcut cons string symbols during garbage collection.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mark-compact.cc ('k') | src/parser.cc » ('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 249)
+++ src/objects.cc (working copy)
@@ -1124,8 +1124,7 @@
if (value->IsJSFunction()) {
JSFunction* function = JSFunction::cast(value);
- Object* new_map =
- map()->CopyDropTransitions();
+ Object* new_map = map()->CopyDropTransitions();
if (new_map->IsFailure()) return new_map;
set_map(Map::cast(new_map));
@@ -2646,7 +2645,7 @@
int new_size = number_of_descriptors() - transitions - null_descriptors;
// If key is in descriptor, we replace it in-place when filtering.
- int index = Search(descriptor->key());
+ int index = Search(descriptor->GetKey());
const bool inserting = (index == kNotFound);
const bool replacing = !inserting;
bool keep_enumeration_index = false;
@@ -2689,7 +2688,7 @@
// and inserting or replacing a descriptor.
DescriptorWriter w(new_descriptors);
DescriptorReader r(this);
- uint32_t descriptor_hash = descriptor->key()->Hash();
+ uint32_t descriptor_hash = descriptor->GetKey()->Hash();
for (; !r.eos(); r.advance()) {
if (r.GetKey()->Hash() > descriptor_hash ||
@@ -5385,6 +5384,15 @@
uint32_t Hash() { return string_->Hash(); }
Object* GetObject() {
+ // If the string is a cons string, attempt to flatten it so that
+ // symbols will most often be flat strings.
+ if (string_->IsConsString()) {
+ ConsString* cons_string = ConsString::cast(string_);
+ cons_string->TryFlatten();
+ if (cons_string->second() == Heap::empty_string()) {
+ string_ = String::cast(cons_string->first());
+ }
+ }
// Transform string to symbol if possible.
Map* map = Heap::SymbolMapForString(string_);
if (map != NULL) {
« no previous file with comments | « src/mark-compact.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698