Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: src/objects.h

Issue 1353363002: Share literals arrays per <NativeContext, SharedFunctionInfo> pair. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: More fixes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e28081c33f4cd8bb48dfee82dbfb9aa9e86dfbd4..0bb94616b684d1e0a751ca208c7aa4ff446708a6 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -6288,15 +6288,23 @@ class SharedFunctionInfo: public HeapObject {
DECL_ACCESSORS(optimized_code_map, Object)
// Returns entry from optimized code map for specified context and OSR entry.
- // Note that {code == nullptr} indicates no matching entry has been found,
- // whereas {literals == nullptr} indicates the code is context-independent.
+ // The result is either kNotFound, kSharedCodeIndex for context-independent
+ // entry or a start index of the context-dependent entry.
+ 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.
+ BailoutId osr_ast_id);
+ // Returns entry from optimized code map for specified context and OSR entry.
+ // Note that {code == nullptr, literals == nullptr} indicates no matching
+ // entry has been found, whereas {code, literals == nullptr} indicates that
+ // code is context-independent.
CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
BailoutId osr_ast_id);
// Clear optimized code map.
void ClearOptimizedCodeMap();
- // Removed a specific optimized code object from the optimized code map.
+ // Removes a specific optimized code object from the optimized code map.
+ // In case of non-OSR the code reference is cleared from the cache entry but
+ // the entry itself is left in the map in order to proceed sharing literals.
void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
// Trims the optimized code map after entries have been removed.
@@ -6307,6 +6315,8 @@ class SharedFunctionInfo: public HeapObject {
Handle<Code> code);
// Add a new entry to the optimized code map for context-dependent code.
+ // If |code| is an empty handle then an entry is added to map
+ // |native_context, osr_ast_id| pair to |literals| array.
static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
Handle<Context> native_context,
Handle<Code> code,
@@ -6329,6 +6339,8 @@ class SharedFunctionInfo: public HeapObject {
static const int kEntryLength = 4;
static const int kInitialLength = kEntriesStart + kEntryLength;
+ static const int kNotFound = -1;
+
// [scope_info]: Scope info.
DECL_ACCESSORS(scope_info, ScopeInfo)

Powered by Google App Engine
This is Rietveld 408576698