OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CONTEXTS_H_ | 5 #ifndef V8_CONTEXTS_H_ |
6 #define V8_CONTEXTS_H_ | 6 #define V8_CONTEXTS_H_ |
7 | 7 |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \ | 275 V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \ |
276 V(MATH_RANDOM_INDEX_INDEX, Smi, math_random_index) \ | 276 V(MATH_RANDOM_INDEX_INDEX, Smi, math_random_index) \ |
277 V(MATH_RANDOM_CACHE_INDEX, Object, math_random_cache) \ | 277 V(MATH_RANDOM_CACHE_INDEX, Object, math_random_cache) \ |
278 V(MESSAGE_LISTENERS_INDEX, TemplateList, message_listeners) \ | 278 V(MESSAGE_LISTENERS_INDEX, TemplateList, message_listeners) \ |
279 V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \ | 279 V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \ |
280 V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \ | 280 V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \ |
281 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ | 281 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ |
282 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ | 282 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ |
283 V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \ | 283 V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \ |
284 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ | 284 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ |
| 285 V(OSR_CODE_TABLE_INDEX, FixedArray, osr_code_table) \ |
285 V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \ | 286 V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \ |
286 V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \ | 287 V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \ |
287 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \ | 288 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \ |
288 V(PROXY_FUNCTION_MAP_INDEX, Map, proxy_function_map) \ | 289 V(PROXY_FUNCTION_MAP_INDEX, Map, proxy_function_map) \ |
289 V(PROXY_MAP_INDEX, Map, proxy_map) \ | 290 V(PROXY_MAP_INDEX, Map, proxy_map) \ |
290 V(PROMISE_RESOLVE_SHARED_FUN, SharedFunctionInfo, \ | 291 V(PROMISE_RESOLVE_SHARED_FUN, SharedFunctionInfo, \ |
291 promise_resolve_shared_fun) \ | 292 promise_resolve_shared_fun) \ |
292 V(PROMISE_REJECT_SHARED_FUN, SharedFunctionInfo, promise_reject_shared_fun) \ | 293 V(PROMISE_REJECT_SHARED_FUN, SharedFunctionInfo, promise_reject_shared_fun) \ |
293 V(PROMISE_PROTOTYPE_MAP_INDEX, Map, promise_prototype_map) \ | 294 V(PROMISE_PROTOTYPE_MAP_INDEX, Map, promise_prototype_map) \ |
294 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ | 295 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 inline bool IsFunctionContext(); | 552 inline bool IsFunctionContext(); |
552 inline bool IsCatchContext(); | 553 inline bool IsCatchContext(); |
553 inline bool IsWithContext(); | 554 inline bool IsWithContext(); |
554 inline bool IsDebugEvaluateContext(); | 555 inline bool IsDebugEvaluateContext(); |
555 inline bool IsBlockContext(); | 556 inline bool IsBlockContext(); |
556 inline bool IsModuleContext(); | 557 inline bool IsModuleContext(); |
557 inline bool IsScriptContext(); | 558 inline bool IsScriptContext(); |
558 | 559 |
559 inline bool HasSameSecurityTokenAs(Context* that); | 560 inline bool HasSameSecurityTokenAs(Context* that); |
560 | 561 |
| 562 // Removes a specific optimized code object from the optimized code map. |
| 563 // In case of non-OSR the code reference is cleared from the cache entry but |
| 564 // the entry itself is left in the map in order to proceed sharing literals. |
| 565 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
| 566 |
| 567 // Clear optimized code map. |
| 568 void ClearOptimizedCodeMap(); |
| 569 |
| 570 // A native context keeps track of all osrd optimized functions. |
| 571 inline bool OptimizedCodeMapIsCleared(); |
| 572 void SearchOptimizedCodeMap(SharedFunctionInfo* shared, BailoutId osr_ast_id, |
| 573 Code** pcode, LiteralsArray** pliterals); |
| 574 int SearchOptimizedCodeMapEntry(SharedFunctionInfo* shared, |
| 575 BailoutId osr_ast_id); |
| 576 |
| 577 static void AddToOptimizedCodeMap(Handle<Context> native_context, |
| 578 Handle<SharedFunctionInfo> shared, |
| 579 Handle<Code> code, |
| 580 Handle<LiteralsArray> literals, |
| 581 BailoutId osr_ast_id); |
| 582 |
561 // A native context holds a list of all functions with optimized code. | 583 // A native context holds a list of all functions with optimized code. |
562 void AddOptimizedFunction(JSFunction* function); | 584 void AddOptimizedFunction(JSFunction* function); |
563 void RemoveOptimizedFunction(JSFunction* function); | 585 void RemoveOptimizedFunction(JSFunction* function); |
564 void SetOptimizedFunctionsListHead(Object* head); | 586 void SetOptimizedFunctionsListHead(Object* head); |
565 Object* OptimizedFunctionsListHead(); | 587 Object* OptimizedFunctionsListHead(); |
566 | 588 |
567 // The native context also stores a list of all optimized code and a | 589 // The native context also stores a list of all optimized code and a |
568 // list of all deoptimized code, which are needed by the deoptimizer. | 590 // list of all deoptimized code, which are needed by the deoptimizer. |
569 void AddOptimizedCode(Code* code); | 591 void AddOptimizedCode(Code* code); |
570 void SetOptimizedCodeListHead(Object* head); | 592 void SetOptimizedCodeListHead(Object* head); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 690 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
669 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 691 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
670 }; | 692 }; |
671 | 693 |
672 typedef Context::Field ContextField; | 694 typedef Context::Field ContextField; |
673 | 695 |
674 } // namespace internal | 696 } // namespace internal |
675 } // namespace v8 | 697 } // namespace v8 |
676 | 698 |
677 #endif // V8_CONTEXTS_H_ | 699 #endif // V8_CONTEXTS_H_ |
OLD | NEW |