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

Side by Side Diff: src/heap.cc

Issue 7849012: Fix missing setting of array to copy-on-write in (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 String* pattern, 2281 String* pattern,
2282 FixedArray* array) { 2282 FixedArray* array) {
2283 if (!string->IsSymbol() || !pattern->IsSymbol()) return; 2283 if (!string->IsSymbol() || !pattern->IsSymbol()) return;
2284 uint32_t hash = string->Hash(); 2284 uint32_t hash = string->Hash();
2285 uint32_t index = ((hash & (kStringSplitCacheSize - 1)) & 2285 uint32_t index = ((hash & (kStringSplitCacheSize - 1)) &
2286 ~(kArrayEntriesPerCacheEntry - 1)); 2286 ~(kArrayEntriesPerCacheEntry - 1));
2287 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) { 2287 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) {
2288 cache->set(index + kStringOffset, string); 2288 cache->set(index + kStringOffset, string);
2289 cache->set(index + kPatternOffset, pattern); 2289 cache->set(index + kPatternOffset, pattern);
2290 cache->set(index + kArrayOffset, array); 2290 cache->set(index + kArrayOffset, array);
2291 return; 2291 } else {
2292 uint32_t index2 =
2293 ((index + kArrayEntriesPerCacheEntry) & (kStringSplitCacheSize - 1));
2294 if (cache->get(index2 + kStringOffset) == Smi::FromInt(0)) {
2295 cache->set(index2 + kStringOffset, string);
2296 cache->set(index2 + kPatternOffset, pattern);
2297 cache->set(index2 + kArrayOffset, array);
2298 } else {
2299 cache->set(index2 + kStringOffset, Smi::FromInt(0));
2300 cache->set(index2 + kPatternOffset, Smi::FromInt(0));
2301 cache->set(index2 + kArrayOffset, Smi::FromInt(0));
2302 cache->set(index + kStringOffset, string);
2303 cache->set(index + kPatternOffset, pattern);
2304 cache->set(index + kArrayOffset, array);
2305 }
2292 } 2306 }
2293 uint32_t index2 =
2294 ((index + kArrayEntriesPerCacheEntry) & (kStringSplitCacheSize - 1));
2295 if (cache->get(index2 + kStringOffset) == Smi::FromInt(0)) {
2296 cache->set(index2 + kStringOffset, string);
2297 cache->set(index2 + kPatternOffset, pattern);
2298 cache->set(index2 + kArrayOffset, array);
2299 return;
2300 }
2301 cache->set(index2 + kStringOffset, Smi::FromInt(0));
2302 cache->set(index2 + kPatternOffset, Smi::FromInt(0));
2303 cache->set(index2 + kArrayOffset, Smi::FromInt(0));
2304 cache->set(index + kStringOffset, string);
2305 cache->set(index + kPatternOffset, pattern);
2306 cache->set(index + kArrayOffset, array);
2307 if (array->length() < 100) { // Limit how many new symbols we want to make. 2307 if (array->length() < 100) { // Limit how many new symbols we want to make.
2308 for (int i = 0; i < array->length(); i++) { 2308 for (int i = 0; i < array->length(); i++) {
2309 String* str = String::cast(array->get(i)); 2309 String* str = String::cast(array->get(i));
2310 Object* symbol; 2310 Object* symbol;
2311 MaybeObject* maybe_symbol = heap->LookupSymbol(str); 2311 MaybeObject* maybe_symbol = heap->LookupSymbol(str);
2312 if (maybe_symbol->ToObject(&symbol)) { 2312 if (maybe_symbol->ToObject(&symbol)) {
2313 array->set(i, symbol); 2313 array->set(i, symbol);
2314 } 2314 }
2315 } 2315 }
2316 } 2316 }
(...skipping 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after
6226 } 6226 }
6227 6227
6228 6228
6229 void ExternalStringTable::TearDown() { 6229 void ExternalStringTable::TearDown() {
6230 new_space_strings_.Free(); 6230 new_space_strings_.Free();
6231 old_space_strings_.Free(); 6231 old_space_strings_.Free();
6232 } 6232 }
6233 6233
6234 6234
6235 } } // namespace v8::internal 6235 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698