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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 6270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6281 | 6281 |
6282 // [code]: Function code. | 6282 // [code]: Function code. |
6283 DECL_ACCESSORS(code, Code) | 6283 DECL_ACCESSORS(code, Code) |
6284 inline void ReplaceCode(Code* code); | 6284 inline void ReplaceCode(Code* code); |
6285 | 6285 |
6286 // [optimized_code_map]: Map from native context to optimized code | 6286 // [optimized_code_map]: Map from native context to optimized code |
6287 // and a shared literals array or Smi(0) if none. | 6287 // and a shared literals array or Smi(0) if none. |
6288 DECL_ACCESSORS(optimized_code_map, Object) | 6288 DECL_ACCESSORS(optimized_code_map, Object) |
6289 | 6289 |
6290 // Returns entry from optimized code map for specified context and OSR entry. | 6290 // Returns entry from optimized code map for specified context and OSR entry. |
6291 // Note that {code == nullptr} indicates no matching entry has been found, | 6291 // The result is either kNotFound, kSharedCodeIndex for context-independent |
6292 // whereas {literals == nullptr} indicates the code is context-independent. | 6292 // entry or a start index of the context-dependent entry. |
6293 int SearchOptimizedCodeMapEntry(Context* native_context, | |
Michael Starzinger
2015/09/22 10:44:39
I think we should avoid exposing this function pro
Igor Sheludko
2015/09/22 12:58:11
The implementation uses a lot of internal SFI stuf
Michael Starzinger
2015/09/23 08:14:22
Acknowledged. Yep, works for me.
| |
6294 BailoutId osr_ast_id); | |
6295 // Returns entry from optimized code map for specified context and OSR entry. | |
6296 // Note that {code == nullptr, literals == nullptr} indicates no matching | |
6297 // entry has been found, whereas {code, literals == nullptr} indicates that | |
6298 // code is context-independent. | |
6293 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context, | 6299 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context, |
6294 BailoutId osr_ast_id); | 6300 BailoutId osr_ast_id); |
6295 | 6301 |
6296 // Clear optimized code map. | 6302 // Clear optimized code map. |
6297 void ClearOptimizedCodeMap(); | 6303 void ClearOptimizedCodeMap(); |
6298 | 6304 |
6299 // Removed a specific optimized code object from the optimized code map. | 6305 // Removes a specific optimized code object from the optimized code map. |
6306 // In case of non-OSR the code reference is cleared from the cache entry but | |
6307 // the entry itself is left in the map in order to proceed sharing literals. | |
6300 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 6308 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
6301 | 6309 |
6302 // Trims the optimized code map after entries have been removed. | 6310 // Trims the optimized code map after entries have been removed. |
6303 void TrimOptimizedCodeMap(int shrink_by); | 6311 void TrimOptimizedCodeMap(int shrink_by); |
6304 | 6312 |
6305 // Add a new entry to the optimized code map for context-independent code. | 6313 // Add a new entry to the optimized code map for context-independent code. |
6306 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6314 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
6307 Handle<Code> code); | 6315 Handle<Code> code); |
6308 | 6316 |
6309 // Add a new entry to the optimized code map for context-dependent code. | 6317 // Add a new entry to the optimized code map for context-dependent code. |
6318 // If |code| is an empty handle then an entry is added to map | |
6319 // |native_context, osr_ast_id| pair to |literals| array. | |
6310 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 6320 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
6311 Handle<Context> native_context, | 6321 Handle<Context> native_context, |
6312 Handle<Code> code, | 6322 Handle<Code> code, |
6313 Handle<FixedArray> literals, | 6323 Handle<FixedArray> literals, |
6314 BailoutId osr_ast_id); | 6324 BailoutId osr_ast_id); |
6315 | 6325 |
6316 // Set up the link between shared function info and the script. The shared | 6326 // Set up the link between shared function info and the script. The shared |
6317 // function info is added to the list on the script. | 6327 // function info is added to the list on the script. |
6318 static void SetScript(Handle<SharedFunctionInfo> shared, | 6328 static void SetScript(Handle<SharedFunctionInfo> shared, |
6319 Handle<Object> script_object); | 6329 Handle<Object> script_object); |
6320 | 6330 |
6321 // Layout description of the optimized code map. | 6331 // Layout description of the optimized code map. |
6322 static const int kNextMapIndex = 0; | 6332 static const int kNextMapIndex = 0; |
6323 static const int kSharedCodeIndex = 1; | 6333 static const int kSharedCodeIndex = 1; |
6324 static const int kEntriesStart = 2; | 6334 static const int kEntriesStart = 2; |
6325 static const int kContextOffset = 0; | 6335 static const int kContextOffset = 0; |
6326 static const int kCachedCodeOffset = 1; | 6336 static const int kCachedCodeOffset = 1; |
6327 static const int kLiteralsOffset = 2; | 6337 static const int kLiteralsOffset = 2; |
6328 static const int kOsrAstIdOffset = 3; | 6338 static const int kOsrAstIdOffset = 3; |
6329 static const int kEntryLength = 4; | 6339 static const int kEntryLength = 4; |
6330 static const int kInitialLength = kEntriesStart + kEntryLength; | 6340 static const int kInitialLength = kEntriesStart + kEntryLength; |
6331 | 6341 |
6342 static const int kNotFound = -1; | |
6343 | |
6332 // [scope_info]: Scope info. | 6344 // [scope_info]: Scope info. |
6333 DECL_ACCESSORS(scope_info, ScopeInfo) | 6345 DECL_ACCESSORS(scope_info, ScopeInfo) |
6334 | 6346 |
6335 // [construct stub]: Code stub for constructing instances of this function. | 6347 // [construct stub]: Code stub for constructing instances of this function. |
6336 DECL_ACCESSORS(construct_stub, Code) | 6348 DECL_ACCESSORS(construct_stub, Code) |
6337 | 6349 |
6338 // Returns if this function has been compiled to native code yet. | 6350 // Returns if this function has been compiled to native code yet. |
6339 inline bool is_compiled(); | 6351 inline bool is_compiled(); |
6340 | 6352 |
6341 // [length]: The function length - usually the number of declared parameters. | 6353 // [length]: The function length - usually the number of declared parameters. |
(...skipping 4219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10561 | 10573 |
10562 Isolate* isolate_; | 10574 Isolate* isolate_; |
10563 Handle<FixedArray> keys_; | 10575 Handle<FixedArray> keys_; |
10564 Handle<OrderedHashSet> set_; | 10576 Handle<OrderedHashSet> set_; |
10565 int length_; | 10577 int length_; |
10566 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10578 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
10567 }; | 10579 }; |
10568 } } // namespace v8::internal | 10580 } } // namespace v8::internal |
10569 | 10581 |
10570 #endif // V8_OBJECTS_H_ | 10582 #endif // V8_OBJECTS_H_ |
OLD | NEW |