OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 7150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7161 // In case of non-OSR the code reference is cleared from the cache entry but | 7161 // In case of non-OSR the code reference is cleared from the cache entry but |
7162 // the entry itself is left in the map in order to proceed sharing literals. | 7162 // the entry itself is left in the map in order to proceed sharing literals. |
7163 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); | 7163 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); |
7164 | 7164 |
7165 // Trims the optimized code map after entries have been removed. | 7165 // Trims the optimized code map after entries have been removed. |
7166 void TrimOptimizedCodeMap(int shrink_by); | 7166 void TrimOptimizedCodeMap(int shrink_by); |
7167 | 7167 |
7168 static Handle<LiteralsArray> FindOrCreateLiterals( | 7168 static Handle<LiteralsArray> FindOrCreateLiterals( |
7169 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); | 7169 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); |
7170 | 7170 |
| 7171 // Add or update entry in the optimized code map for context-independent code. |
| 7172 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| 7173 Handle<Code> code); |
| 7174 |
7171 // Add or update entry in the optimized code map for context-dependent code. | 7175 // Add or update entry in the optimized code map for context-dependent code. |
7172 // If {code} is not given, then an existing entry's code won't be overwritten. | 7176 // If {code} is not given, then an existing entry's code won't be overwritten. |
7173 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 7177 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
7174 Handle<Context> native_context, | 7178 Handle<Context> native_context, |
7175 MaybeHandle<Code> code, | 7179 MaybeHandle<Code> code, |
7176 Handle<LiteralsArray> literals, | 7180 Handle<LiteralsArray> literals, |
7177 BailoutId osr_ast_id); | 7181 BailoutId osr_ast_id); |
7178 | 7182 |
7179 // Set up the link between shared function info and the script. The shared | 7183 // Set up the link between shared function info and the script. The shared |
7180 // function info is added to the list on the script. | 7184 // function info is added to the list on the script. |
7181 static void SetScript(Handle<SharedFunctionInfo> shared, | 7185 static void SetScript(Handle<SharedFunctionInfo> shared, |
7182 Handle<Object> script_object); | 7186 Handle<Object> script_object); |
7183 | 7187 |
7184 // Layout description of the optimized code map. | 7188 // Layout description of the optimized code map. |
7185 static const int kEntriesStart = 0; | 7189 static const int kSharedCodeIndex = 0; |
| 7190 static const int kEntriesStart = 1; |
7186 static const int kContextOffset = 0; | 7191 static const int kContextOffset = 0; |
7187 static const int kCachedCodeOffset = 1; | 7192 static const int kCachedCodeOffset = 1; |
7188 static const int kLiteralsOffset = 2; | 7193 static const int kLiteralsOffset = 2; |
7189 static const int kOsrAstIdOffset = 3; | 7194 static const int kOsrAstIdOffset = 3; |
7190 static const int kEntryLength = 4; | 7195 static const int kEntryLength = 4; |
7191 static const int kInitialLength = kEntriesStart + kEntryLength; | 7196 static const int kInitialLength = kEntriesStart + kEntryLength; |
7192 | 7197 |
7193 static const int kNotFound = -1; | 7198 static const int kNotFound = -1; |
7194 | 7199 |
7195 // Helpers for assembly code that does a backwards walk of the optimized code | 7200 // Helpers for assembly code that does a backwards walk of the optimized code |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7777 #endif | 7782 #endif |
7778 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7783 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
7779 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7784 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
7780 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7785 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
7781 static const int kHasDuplicateParametersByteOffset = | 7786 static const int kHasDuplicateParametersByteOffset = |
7782 BYTE_OFFSET(kHasDuplicateParameters); | 7787 BYTE_OFFSET(kHasDuplicateParameters); |
7783 #undef BYTE_OFFSET | 7788 #undef BYTE_OFFSET |
7784 | 7789 |
7785 private: | 7790 private: |
7786 // Returns entry from optimized code map for specified context and OSR entry. | 7791 // Returns entry from optimized code map for specified context and OSR entry. |
7787 // The result is either kNotFound, or a start index of the context-dependent | 7792 // The result is either kNotFound, kSharedCodeIndex for context-independent |
7788 // entry. | 7793 // entry or a start index of the context-dependent entry. |
7789 int SearchOptimizedCodeMapEntry(Context* native_context, | 7794 int SearchOptimizedCodeMapEntry(Context* native_context, |
7790 BailoutId osr_ast_id); | 7795 BailoutId osr_ast_id); |
7791 | 7796 |
7792 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 7797 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
7793 }; | 7798 }; |
7794 | 7799 |
7795 | 7800 |
7796 // Printing support. | 7801 // Printing support. |
7797 struct SourceCodeOf { | 7802 struct SourceCodeOf { |
7798 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1) | 7803 explicit SourceCodeOf(SharedFunctionInfo* v, int max = -1) |
(...skipping 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11401 } | 11406 } |
11402 return value; | 11407 return value; |
11403 } | 11408 } |
11404 }; | 11409 }; |
11405 | 11410 |
11406 | 11411 |
11407 } // NOLINT, false-positive due to second-order macros. | 11412 } // NOLINT, false-positive due to second-order macros. |
11408 } // NOLINT, false-positive due to second-order macros. | 11413 } // NOLINT, false-positive due to second-order macros. |
11409 | 11414 |
11410 #endif // V8_OBJECTS_H_ | 11415 #endif // V8_OBJECTS_H_ |
OLD | NEW |