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

Side by Side Diff: src/contexts.cc

Issue 11140025: Enable incremental code flushing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Prevent recording a flushing candidate twice. Created 8 years, 2 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 | src/heap.cc » ('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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 ASSERT(IsNativeContext()); 244 ASSERT(IsNativeContext());
245 #ifdef DEBUG 245 #ifdef DEBUG
246 if (FLAG_enable_slow_asserts) { 246 if (FLAG_enable_slow_asserts) {
247 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); 247 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
248 while (!element->IsUndefined()) { 248 while (!element->IsUndefined()) {
249 CHECK(element != function); 249 CHECK(element != function);
250 element = JSFunction::cast(element)->next_function_link(); 250 element = JSFunction::cast(element)->next_function_link();
251 } 251 }
252 } 252 }
253 253
254 CHECK(function->next_function_link()->IsUndefined());
255
256 // Check that the context belongs to the weak native contexts list. 254 // Check that the context belongs to the weak native contexts list.
257 bool found = false; 255 bool found = false;
258 Object* context = GetHeap()->native_contexts_list(); 256 Object* context = GetHeap()->native_contexts_list();
259 while (!context->IsUndefined()) { 257 while (!context->IsUndefined()) {
260 if (context == this) { 258 if (context == this) {
261 found = true; 259 found = true;
262 break; 260 break;
263 } 261 }
264 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); 262 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
265 } 263 }
266 CHECK(found); 264 CHECK(found);
267 #endif 265 #endif
266
267 // If the function link field is already used then the function was
268 // enqueued as a code flushing candidate and we remove it now.
269 if (!function->next_function_link()->IsUndefined()) {
270 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
271 flusher->EvictCandidate(function);
272 }
273
274 ASSERT(function->next_function_link()->IsUndefined());
275
268 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST)); 276 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST));
269 set(OPTIMIZED_FUNCTIONS_LIST, function); 277 set(OPTIMIZED_FUNCTIONS_LIST, function);
270 } 278 }
271 279
272 280
273 void Context::RemoveOptimizedFunction(JSFunction* function) { 281 void Context::RemoveOptimizedFunction(JSFunction* function) {
274 ASSERT(IsNativeContext()); 282 ASSERT(IsNativeContext());
275 Object* element = get(OPTIMIZED_FUNCTIONS_LIST); 283 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
276 JSFunction* prev = NULL; 284 JSFunction* prev = NULL;
277 while (!element->IsUndefined()) { 285 while (!element->IsUndefined()) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // During bootstrapping we allow all objects to pass as global 342 // During bootstrapping we allow all objects to pass as global
335 // objects. This is necessary to fix circular dependencies. 343 // objects. This is necessary to fix circular dependencies.
336 Isolate* isolate = Isolate::Current(); 344 Isolate* isolate = Isolate::Current();
337 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 345 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
338 isolate->bootstrapper()->IsActive() || 346 isolate->bootstrapper()->IsActive() ||
339 object->IsGlobalObject(); 347 object->IsGlobalObject();
340 } 348 }
341 #endif 349 #endif
342 350
343 } } // namespace v8::internal 351 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698