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

Side by Side Diff: src/heap.cc

Issue 7837026: Fix assert on Mozilla test after String split optimization. (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 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 } 2275 }
2276 2276
2277 2277
2278 void StringSplitCache::Enter(Heap* heap, 2278 void StringSplitCache::Enter(Heap* heap,
2279 FixedArray* cache, 2279 FixedArray* cache,
2280 String* string, 2280 String* string,
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 uintptr_t hash = string->Hash(); 2284 uintptr_t hash = string->Hash();
2285 array->set_map(heap->fixed_cow_array_map());
2286 uintptr_t index = ((hash & (kStringSplitCacheSize - 1)) & 2285 uintptr_t index = ((hash & (kStringSplitCacheSize - 1)) &
2287 ~(kArrayEntriesPerCacheEntry - 1)); 2286 ~(kArrayEntriesPerCacheEntry - 1));
2288 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) { 2287 if (cache->get(index + kStringOffset) == Smi::FromInt(0)) {
2289 cache->set(index + kStringOffset, string); 2288 cache->set(index + kStringOffset, string);
2290 cache->set(index + kPatternOffset, pattern); 2289 cache->set(index + kPatternOffset, pattern);
2291 cache->set(index + kArrayOffset, array); 2290 cache->set(index + kArrayOffset, array);
2292 return; 2291 return;
2293 } 2292 }
2294 uintptr_t index2 = 2293 uintptr_t index2 =
2295 ((index + kArrayEntriesPerCacheEntry) & (kStringSplitCacheSize - 1)); 2294 ((index + kArrayEntriesPerCacheEntry) & (kStringSplitCacheSize - 1));
(...skipping 12 matching lines...) Expand all
2308 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.
2309 for (int i = 0; i < array->length(); i++) { 2308 for (int i = 0; i < array->length(); i++) {
2310 String* str = String::cast(array->get(i)); 2309 String* str = String::cast(array->get(i));
2311 Object* symbol; 2310 Object* symbol;
2312 MaybeObject* maybe_symbol = heap->LookupSymbol(str); 2311 MaybeObject* maybe_symbol = heap->LookupSymbol(str);
2313 if (maybe_symbol->ToObject(&symbol)) { 2312 if (maybe_symbol->ToObject(&symbol)) {
2314 array->set(i, symbol); 2313 array->set(i, symbol);
2315 } 2314 }
2316 } 2315 }
2317 } 2316 }
2317 array->set_map(heap->fixed_cow_array_map());
2318 } 2318 }
2319 2319
2320 2320
2321 void StringSplitCache::Clear(FixedArray* cache) { 2321 void StringSplitCache::Clear(FixedArray* cache) {
2322 for (int i = 0; i < kStringSplitCacheSize; i++) { 2322 for (int i = 0; i < kStringSplitCacheSize; i++) {
2323 cache->set(i, Smi::FromInt(0)); 2323 cache->set(i, Smi::FromInt(0));
2324 } 2324 }
2325 } 2325 }
2326 2326
2327 2327
(...skipping 3898 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