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(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ | 294 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \ |
294 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ | 295 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 inline bool IsFunctionContext(); | 551 inline bool IsFunctionContext(); |
551 inline bool IsCatchContext(); | 552 inline bool IsCatchContext(); |
552 inline bool IsWithContext(); | 553 inline bool IsWithContext(); |
553 inline bool IsDebugEvaluateContext(); | 554 inline bool IsDebugEvaluateContext(); |
554 inline bool IsBlockContext(); | 555 inline bool IsBlockContext(); |
555 inline bool IsModuleContext(); | 556 inline bool IsModuleContext(); |
556 inline bool IsScriptContext(); | 557 inline bool IsScriptContext(); |
557 | 558 |
558 inline bool HasSameSecurityTokenAs(Context* that); | 559 inline bool HasSameSecurityTokenAs(Context* that); |
559 | 560 |
| 561 // Removes a specific optimized code object from the optimized code map. |
| 562 // In case of non-OSR the code reference is cleared from the cache entry but |
| 563 // the entry itself is left in the map in order to proceed sharing literals. |
| 564 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
| 565 |
| 566 // Clear optimized code map. |
| 567 void ClearOptimizedCodeMap(); |
| 568 |
| 569 // A native context keeps track of all osrd optimized functions. |
| 570 inline bool OptimizedCodeMapIsCleared(); |
| 571 void SearchOptimizedCodeMap(SharedFunctionInfo* shared, BailoutId osr_ast_id, |
| 572 Code** pcode, LiteralsArray** pliterals); |
| 573 int SearchOptimizedCodeMapEntry(SharedFunctionInfo* shared, |
| 574 BailoutId osr_ast_id); |
| 575 |
| 576 static void AddToOptimizedCodeMap(Handle<Context> native_context, |
| 577 Handle<SharedFunctionInfo> shared, |
| 578 Handle<Code> code, |
| 579 Handle<LiteralsArray> literals, |
| 580 BailoutId osr_ast_id); |
| 581 |
560 // A native context holds a list of all functions with optimized code. | 582 // A native context holds a list of all functions with optimized code. |
561 void AddOptimizedFunction(JSFunction* function); | 583 void AddOptimizedFunction(JSFunction* function); |
562 void RemoveOptimizedFunction(JSFunction* function); | 584 void RemoveOptimizedFunction(JSFunction* function); |
563 void SetOptimizedFunctionsListHead(Object* head); | 585 void SetOptimizedFunctionsListHead(Object* head); |
564 Object* OptimizedFunctionsListHead(); | 586 Object* OptimizedFunctionsListHead(); |
565 | 587 |
566 // The native context also stores a list of all optimized code and a | 588 // The native context also stores a list of all optimized code and a |
567 // list of all deoptimized code, which are needed by the deoptimizer. | 589 // list of all deoptimized code, which are needed by the deoptimizer. |
568 void AddOptimizedCode(Code* code); | 590 void AddOptimizedCode(Code* code); |
569 void SetOptimizedCodeListHead(Object* head); | 591 void SetOptimizedCodeListHead(Object* head); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 689 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
668 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 690 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
669 }; | 691 }; |
670 | 692 |
671 typedef Context::Field ContextField; | 693 typedef Context::Field ContextField; |
672 | 694 |
673 } // namespace internal | 695 } // namespace internal |
674 } // namespace v8 | 696 } // namespace v8 |
675 | 697 |
676 #endif // V8_CONTEXTS_H_ | 698 #endif // V8_CONTEXTS_H_ |
OLD | NEW |