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

Side by Side Diff: src/contexts.h

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/compiler.cc ('k') | src/contexts.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 OBSERVERS_DELIVER_CHANGES_INDEX, 330 OBSERVERS_DELIVER_CHANGES_INDEX,
331 GENERATOR_FUNCTION_MAP_INDEX, 331 GENERATOR_FUNCTION_MAP_INDEX,
332 STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX, 332 STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX,
333 GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, 333 GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX,
334 GENERATOR_RESULT_MAP_INDEX, 334 GENERATOR_RESULT_MAP_INDEX,
335 RANDOM_SEED_INDEX, 335 RANDOM_SEED_INDEX,
336 336
337 // Properties from here are treated as weak references by the full GC. 337 // Properties from here are treated as weak references by the full GC.
338 // Scavenge treats them as strong references. 338 // Scavenge treats them as strong references.
339 OPTIMIZED_FUNCTIONS_LIST, // Weak. 339 OPTIMIZED_FUNCTIONS_LIST, // Weak.
340 MAP_CACHE_INDEX, // Weak. 340 OPTIMIZED_CODE_LIST, // Weak.
341 NEXT_CONTEXT_LINK, // Weak. 341 DEOPTIMIZED_CODE_LIST, // Weak.
342 MAP_CACHE_INDEX, // Weak.
343 NEXT_CONTEXT_LINK, // Weak.
342 344
343 // Total number of slots. 345 // Total number of slots.
344 NATIVE_CONTEXT_SLOTS, 346 NATIVE_CONTEXT_SLOTS,
345 347
346 FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST 348 FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST
347 }; 349 };
348 350
349 // Direct slot access. 351 // Direct slot access.
350 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); } 352 JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); }
351 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); } 353 void set_closure(JSFunction* closure) { set(CLOSURE_INDEX, closure); }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 Map* map = this->map(); 423 Map* map = this->map();
422 return map == map->GetHeap()->global_context_map(); 424 return map == map->GetHeap()->global_context_map();
423 } 425 }
424 426
425 // Tells whether the native context is marked with out of memory. 427 // Tells whether the native context is marked with out of memory.
426 inline bool has_out_of_memory(); 428 inline bool has_out_of_memory();
427 429
428 // Mark the native context with out of memory. 430 // Mark the native context with out of memory.
429 inline void mark_out_of_memory(); 431 inline void mark_out_of_memory();
430 432
431 // A native context hold a list of all functions which have been optimized. 433 // A native context holds a list of all functions with optimized code.
432 void AddOptimizedFunction(JSFunction* function); 434 void AddOptimizedFunction(JSFunction* function);
433 void RemoveOptimizedFunction(JSFunction* function); 435 void RemoveOptimizedFunction(JSFunction* function);
436 void SetOptimizedFunctionsListHead(Object* head);
434 Object* OptimizedFunctionsListHead(); 437 Object* OptimizedFunctionsListHead();
435 void ClearOptimizedFunctions(); 438
439 // The native context also stores a list of all optimized code and a
440 // list of all deoptimized code, which are needed by the deoptimizer.
441 void AddOptimizedCode(Code* code);
442 void SetOptimizedCodeListHead(Object* head);
443 Object* OptimizedCodeListHead();
444 void SetDeoptimizedCodeListHead(Object* head);
445 Object* DeoptimizedCodeListHead();
436 446
437 Handle<Object> ErrorMessageForCodeGenerationFromStrings(); 447 Handle<Object> ErrorMessageForCodeGenerationFromStrings();
438 448
439 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ 449 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
440 void set_##name(type* value) { \ 450 void set_##name(type* value) { \
441 ASSERT(IsNativeContext()); \ 451 ASSERT(IsNativeContext()); \
442 set(index, value); \ 452 set(index, value); \
443 } \ 453 } \
444 bool is_##name(type* value) { \ 454 bool is_##name(type* value) { \
445 ASSERT(IsNativeContext()); \ 455 ASSERT(IsNativeContext()); \
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); 521 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object);
512 #endif 522 #endif
513 523
514 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); 524 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize);
515 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); 525 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
516 }; 526 };
517 527
518 } } // namespace v8::internal 528 } } // namespace v8::internal
519 529
520 #endif // V8_CONTEXTS_H_ 530 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698