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

Side by Side Diff: src/runtime.cc

Issue 8381040: Move some heap verification code in under the --verify-heap flag to speed (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month 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 | « src/objects-inl.h ('k') | src/spaces.h » ('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 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 13181 matching lines...) Expand 10 before | Expand all | Expand 10 after
13192 bool pending_exception; 13192 bool pending_exception;
13193 value = Execution::Call(factory, 13193 value = Execution::Call(factory,
13194 receiver, 13194 receiver,
13195 ARRAY_SIZE(argv), 13195 ARRAY_SIZE(argv),
13196 argv, 13196 argv,
13197 &pending_exception); 13197 &pending_exception);
13198 if (pending_exception) return Failure::Exception(); 13198 if (pending_exception) return Failure::Exception();
13199 } 13199 }
13200 13200
13201 #ifdef DEBUG 13201 #ifdef DEBUG
13202 cache_handle->JSFunctionResultCacheVerify(); 13202 if (FLAG_verify_heap) {
13203 cache_handle->JSFunctionResultCacheVerify();
13204 }
13203 #endif 13205 #endif
13204 13206
13205 // Function invocation may have cleared the cache. Reread all the data. 13207 // Function invocation may have cleared the cache. Reread all the data.
13206 finger_index = cache_handle->finger_index(); 13208 finger_index = cache_handle->finger_index();
13207 size = cache_handle->size(); 13209 size = cache_handle->size();
13208 13210
13209 // If we have spare room, put new data into it, otherwise evict post finger 13211 // If we have spare room, put new data into it, otherwise evict post finger
13210 // entry which is likely to be the least recently used. 13212 // entry which is likely to be the least recently used.
13211 int index = -1; 13213 int index = -1;
13212 if (size < cache_handle->length()) { 13214 if (size < cache_handle->length()) {
13213 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize); 13215 cache_handle->set_size(size + JSFunctionResultCache::kEntrySize);
13214 index = size; 13216 index = size;
13215 } else { 13217 } else {
13216 index = finger_index + JSFunctionResultCache::kEntrySize; 13218 index = finger_index + JSFunctionResultCache::kEntrySize;
13217 if (index == cache_handle->length()) { 13219 if (index == cache_handle->length()) {
13218 index = JSFunctionResultCache::kEntriesIndex; 13220 index = JSFunctionResultCache::kEntriesIndex;
13219 } 13221 }
13220 } 13222 }
13221 13223
13222 ASSERT(index % 2 == 0); 13224 ASSERT(index % 2 == 0);
13223 ASSERT(index >= JSFunctionResultCache::kEntriesIndex); 13225 ASSERT(index >= JSFunctionResultCache::kEntriesIndex);
13224 ASSERT(index < cache_handle->length()); 13226 ASSERT(index < cache_handle->length());
13225 13227
13226 cache_handle->set(index, *key_handle); 13228 cache_handle->set(index, *key_handle);
13227 cache_handle->set(index + 1, *value); 13229 cache_handle->set(index + 1, *value);
13228 cache_handle->set_finger_index(index); 13230 cache_handle->set_finger_index(index);
13229 13231
13230 #ifdef DEBUG 13232 #ifdef DEBUG
13231 cache_handle->JSFunctionResultCacheVerify(); 13233 if (FLAG_verify_heap) {
13234 cache_handle->JSFunctionResultCacheVerify();
13235 }
13232 #endif 13236 #endif
13233 13237
13234 return *value; 13238 return *value;
13235 } 13239 }
13236 13240
13237 13241
13238 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) { 13242 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewMessageObject) {
13239 HandleScope scope(isolate); 13243 HandleScope scope(isolate);
13240 CONVERT_ARG_CHECKED(String, type, 0); 13244 CONVERT_ARG_CHECKED(String, type, 0);
13241 CONVERT_ARG_CHECKED(JSArray, arguments, 1); 13245 CONVERT_ARG_CHECKED(JSArray, arguments, 1);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
13446 } else { 13450 } else {
13447 // Handle last resort GC and make sure to allow future allocations 13451 // Handle last resort GC and make sure to allow future allocations
13448 // to grow the heap without causing GCs (if possible). 13452 // to grow the heap without causing GCs (if possible).
13449 isolate->counters()->gc_last_resort_from_js()->Increment(); 13453 isolate->counters()->gc_last_resort_from_js()->Increment();
13450 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13454 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13451 } 13455 }
13452 } 13456 }
13453 13457
13454 13458
13455 } } // namespace v8::internal 13459 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698