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

Side by Side Diff: src/contexts.cc

Issue 23444029: Add OptimizedCodeList and DeoptimizedCodeList to native contexts. Both lists are weak. This makes i… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed final comments. Created 7 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 | « src/contexts.h ('k') | src/deoptimizer.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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 element_function->set_next_function_link(GetHeap()->undefined_value()); 312 element_function->set_next_function_link(GetHeap()->undefined_value());
313 return; 313 return;
314 } 314 }
315 prev = element_function; 315 prev = element_function;
316 element = element_function->next_function_link(); 316 element = element_function->next_function_link();
317 } 317 }
318 UNREACHABLE(); 318 UNREACHABLE();
319 } 319 }
320 320
321 321
322 void Context::SetOptimizedFunctionsListHead(Object* head) {
323 ASSERT(IsNativeContext());
324 set(OPTIMIZED_FUNCTIONS_LIST, head);
325 }
326
327
322 Object* Context::OptimizedFunctionsListHead() { 328 Object* Context::OptimizedFunctionsListHead() {
323 ASSERT(IsNativeContext()); 329 ASSERT(IsNativeContext());
324 return get(OPTIMIZED_FUNCTIONS_LIST); 330 return get(OPTIMIZED_FUNCTIONS_LIST);
325 } 331 }
326 332
327 333
328 void Context::ClearOptimizedFunctions() { 334 void Context::AddOptimizedCode(Code* code) {
329 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); 335 ASSERT(IsNativeContext());
336 ASSERT(code->kind() == Code::OPTIMIZED_FUNCTION);
337 ASSERT(code->next_code_link()->IsUndefined());
338 code->set_next_code_link(get(OPTIMIZED_CODE_LIST));
339 set(OPTIMIZED_CODE_LIST, code);
330 } 340 }
331 341
332 342
343 void Context::SetOptimizedCodeListHead(Object* head) {
344 ASSERT(IsNativeContext());
345 set(OPTIMIZED_CODE_LIST, head);
346 }
347
348
349 Object* Context::OptimizedCodeListHead() {
350 ASSERT(IsNativeContext());
351 return get(OPTIMIZED_CODE_LIST);
352 }
353
354
355 void Context::SetDeoptimizedCodeListHead(Object* head) {
356 ASSERT(IsNativeContext());
357 set(DEOPTIMIZED_CODE_LIST, head);
358 }
359
360
361 Object* Context::DeoptimizedCodeListHead() {
362 ASSERT(IsNativeContext());
363 return get(DEOPTIMIZED_CODE_LIST);
364 }
365
366
333 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { 367 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
334 Handle<Object> result(error_message_for_code_gen_from_strings(), 368 Handle<Object> result(error_message_for_code_gen_from_strings(),
335 GetIsolate()); 369 GetIsolate());
336 if (!result->IsUndefined()) return result; 370 if (!result->IsUndefined()) return result;
337 return GetIsolate()->factory()->NewStringFromAscii(i::CStrVector( 371 return GetIsolate()->factory()->NewStringFromAscii(i::CStrVector(
338 "Code generation from strings disallowed for this context")); 372 "Code generation from strings disallowed for this context"));
339 } 373 }
340 374
341 375
342 #ifdef DEBUG 376 #ifdef DEBUG
(...skipping 12 matching lines...) Expand all
355 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 389 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
356 // During bootstrapping we allow all objects to pass as global 390 // During bootstrapping we allow all objects to pass as global
357 // objects. This is necessary to fix circular dependencies. 391 // objects. This is necessary to fix circular dependencies.
358 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 392 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
359 isolate->bootstrapper()->IsActive() || 393 isolate->bootstrapper()->IsActive() ||
360 object->IsGlobalObject(); 394 object->IsGlobalObject();
361 } 395 }
362 #endif 396 #endif
363 397
364 } } // namespace v8::internal 398 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698