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) \ | |
286 V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \ | 285 V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \ |
287 V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \ | 286 V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \ |
288 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \ | 287 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \ |
289 V(PROXY_FUNCTION_MAP_INDEX, Map, proxy_function_map) \ | 288 V(PROXY_FUNCTION_MAP_INDEX, Map, proxy_function_map) \ |
290 V(PROXY_MAP_INDEX, Map, proxy_map) \ | 289 V(PROXY_MAP_INDEX, Map, proxy_map) \ |
291 V(PROMISE_RESOLVE_SHARED_FUN, SharedFunctionInfo, \ | 290 V(PROMISE_RESOLVE_SHARED_FUN, SharedFunctionInfo, \ |
292 promise_resolve_shared_fun) \ | 291 promise_resolve_shared_fun) \ |
293 V(PROMISE_REJECT_SHARED_FUN, SharedFunctionInfo, promise_reject_shared_fun) \ | 292 V(PROMISE_REJECT_SHARED_FUN, SharedFunctionInfo, promise_reject_shared_fun) \ |
294 V(PROMISE_PROTOTYPE_MAP_INDEX, Map, promise_prototype_map) \ | 293 V(PROMISE_PROTOTYPE_MAP_INDEX, Map, promise_prototype_map) \ |
295 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ | 294 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 inline bool IsFunctionContext(); | 551 inline bool IsFunctionContext(); |
553 inline bool IsCatchContext(); | 552 inline bool IsCatchContext(); |
554 inline bool IsWithContext(); | 553 inline bool IsWithContext(); |
555 inline bool IsDebugEvaluateContext(); | 554 inline bool IsDebugEvaluateContext(); |
556 inline bool IsBlockContext(); | 555 inline bool IsBlockContext(); |
557 inline bool IsModuleContext(); | 556 inline bool IsModuleContext(); |
558 inline bool IsScriptContext(); | 557 inline bool IsScriptContext(); |
559 | 558 |
560 inline bool HasSameSecurityTokenAs(Context* that); | 559 inline bool HasSameSecurityTokenAs(Context* that); |
561 | 560 |
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 | |
583 // A native context holds a list of all functions with optimized code. | 561 // A native context holds a list of all functions with optimized code. |
584 void AddOptimizedFunction(JSFunction* function); | 562 void AddOptimizedFunction(JSFunction* function); |
585 void RemoveOptimizedFunction(JSFunction* function); | 563 void RemoveOptimizedFunction(JSFunction* function); |
586 void SetOptimizedFunctionsListHead(Object* head); | 564 void SetOptimizedFunctionsListHead(Object* head); |
587 Object* OptimizedFunctionsListHead(); | 565 Object* OptimizedFunctionsListHead(); |
588 | 566 |
589 // The native context also stores a list of all optimized code and a | 567 // The native context also stores a list of all optimized code and a |
590 // list of all deoptimized code, which are needed by the deoptimizer. | 568 // list of all deoptimized code, which are needed by the deoptimizer. |
591 void AddOptimizedCode(Code* code); | 569 void AddOptimizedCode(Code* code); |
592 void SetOptimizedCodeListHead(Object* head); | 570 void SetOptimizedCodeListHead(Object* head); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 668 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
691 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 669 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
692 }; | 670 }; |
693 | 671 |
694 typedef Context::Field ContextField; | 672 typedef Context::Field ContextField; |
695 | 673 |
696 } // namespace internal | 674 } // namespace internal |
697 } // namespace v8 | 675 } // namespace v8 |
698 | 676 |
699 #endif // V8_CONTEXTS_H_ | 677 #endif // V8_CONTEXTS_H_ |
OLD | NEW |