| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 37016da8916aa86db6ae03b743334d1c47bfc4e4..4dddd0bc56629befbd1c91542fc1787ce84b588c 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -4984,10 +4984,8 @@ class LiteralsArray : public FixedArray {
|
| return OffsetOfElementAt(index + kFirstLiteralIndex);
|
| }
|
|
|
| - inline bool has_feedback_vector() const;
|
| inline TypeFeedbackVector* feedback_vector() const;
|
| inline void set_feedback_vector(TypeFeedbackVector* vector);
|
| -
|
| inline Object* literal(int literal_index) const;
|
| inline void set_literal(int literal_index, Object* literal);
|
| inline void set_literal_undefined(int literal_index);
|
| @@ -7124,6 +7122,12 @@ enum BuiltinFunctionId {
|
| kStringIteratorNext,
|
| };
|
|
|
| +// Result of searching in an optimized code map of a SharedFunctionInfo. Note
|
| +// that both {code} and {literals} can be NULL to pass search result status.
|
| +struct CodeAndLiterals {
|
| + Code* code; // Cached optimized code.
|
| + LiteralsArray* literals; // Cached literals array.
|
| +};
|
|
|
| // SharedFunctionInfo describes the JSFunction information that can be
|
| // shared by multiple instances of the function.
|
| @@ -7155,7 +7159,11 @@ class SharedFunctionInfo: public HeapObject {
|
| DECL_ACCESSORS(optimized_code_map, FixedArray)
|
|
|
| // Returns entry from optimized code map for specified context and OSR entry.
|
| - Code* SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id);
|
| + // 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();
|
| @@ -7177,9 +7185,12 @@ class SharedFunctionInfo: public HeapObject {
|
| Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
|
|
|
| // Add or update entry in the optimized code map for context-dependent code.
|
| + // If {code} is not given, then an existing entry's code won't be overwritten.
|
| static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
|
| Handle<Context> native_context,
|
| - Handle<Code> code, BailoutId osr_ast_id);
|
| + MaybeHandle<Code> code,
|
| + Handle<LiteralsArray> literals,
|
| + BailoutId osr_ast_id);
|
|
|
| // Set up the link between shared function info and the script. The shared
|
| // function info is added to the list on the script.
|
| @@ -7190,7 +7201,8 @@ class SharedFunctionInfo: public HeapObject {
|
| static const int kEntriesStart = 0;
|
| static const int kContextOffset = 0;
|
| static const int kCachedCodeOffset = 1;
|
| - static const int kEntryLength = 2;
|
| + static const int kLiteralsOffset = 2;
|
| + static const int kEntryLength = 3;
|
| static const int kInitialLength = kEntriesStart + kEntryLength;
|
|
|
| static const int kNotFound = -1;
|
| @@ -7202,6 +7214,8 @@ class SharedFunctionInfo: public HeapObject {
|
| static const int kOffsetToPreviousCachedCode =
|
| FixedArray::kHeaderSize +
|
| kPointerSize * (kCachedCodeOffset - kEntryLength);
|
| + static const int kOffsetToPreviousLiterals =
|
| + FixedArray::kHeaderSize + kPointerSize * (kLiteralsOffset - kEntryLength);
|
|
|
| // [scope_info]: Scope info.
|
| DECL_ACCESSORS(scope_info, ScopeInfo)
|
| @@ -8151,7 +8165,6 @@ class JSFunction: public JSObject {
|
| // access to. For API objects we store the boilerplate in the literal array.
|
| DECL_ACCESSORS(literals, LiteralsArray)
|
|
|
| - inline bool has_literals_array() const;
|
| static void EnsureLiterals(Handle<JSFunction> function);
|
| inline TypeFeedbackVector* feedback_vector();
|
|
|
|
|