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

Side by Side Diff: src/objects.h

Issue 2642743002: Revert [TypeFeedbackVector] Root literal arrays in function literal slots (Closed)
Patch Set: Altered test for wasm. Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/heap/object-stats.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4979 matching lines...) Expand 10 before | Expand all | Expand 10 after
4990 public: 4990 public:
4991 static const int kVectorIndex = 0; 4991 static const int kVectorIndex = 0;
4992 static const int kFirstLiteralIndex = 1; 4992 static const int kFirstLiteralIndex = 1;
4993 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset; 4993 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset;
4994 static const int kOffsetToFirstLiteral; 4994 static const int kOffsetToFirstLiteral;
4995 4995
4996 static int OffsetOfLiteralAt(int index) { 4996 static int OffsetOfLiteralAt(int index) {
4997 return OffsetOfElementAt(index + kFirstLiteralIndex); 4997 return OffsetOfElementAt(index + kFirstLiteralIndex);
4998 } 4998 }
4999 4999
5000 inline bool has_feedback_vector() const;
5001 inline TypeFeedbackVector* feedback_vector() const; 5000 inline TypeFeedbackVector* feedback_vector() const;
5002 inline void set_feedback_vector(TypeFeedbackVector* vector); 5001 inline void set_feedback_vector(TypeFeedbackVector* vector);
5003
5004 inline Object* literal(int literal_index) const; 5002 inline Object* literal(int literal_index) const;
5005 inline void set_literal(int literal_index, Object* literal); 5003 inline void set_literal(int literal_index, Object* literal);
5006 inline void set_literal_undefined(int literal_index); 5004 inline void set_literal_undefined(int literal_index);
5007 inline int literals_count() const; 5005 inline int literals_count() const;
5008 5006
5009 static Handle<LiteralsArray> New(Isolate* isolate, 5007 static Handle<LiteralsArray> New(Isolate* isolate,
5010 Handle<TypeFeedbackVector> vector, 5008 Handle<TypeFeedbackVector> vector,
5011 int number_of_literals, 5009 int number_of_literals,
5012 PretenureFlag pretenure = TENURED); 5010 PretenureFlag pretenure = TENURED);
5013 5011
(...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after
7130 kTypedArrayByteOffset, 7128 kTypedArrayByteOffset,
7131 kTypedArrayEntries, 7129 kTypedArrayEntries,
7132 kTypedArrayKeys, 7130 kTypedArrayKeys,
7133 kTypedArrayLength, 7131 kTypedArrayLength,
7134 kTypedArrayValues, 7132 kTypedArrayValues,
7135 kSharedArrayBufferByteLength, 7133 kSharedArrayBufferByteLength,
7136 kStringIterator, 7134 kStringIterator,
7137 kStringIteratorNext, 7135 kStringIteratorNext,
7138 }; 7136 };
7139 7137
7138 // Result of searching in an optimized code map of a SharedFunctionInfo. Note
7139 // that both {code} and {literals} can be NULL to pass search result status.
7140 struct CodeAndLiterals {
7141 Code* code; // Cached optimized code.
7142 LiteralsArray* literals; // Cached literals array.
7143 };
7140 7144
7141 // SharedFunctionInfo describes the JSFunction information that can be 7145 // SharedFunctionInfo describes the JSFunction information that can be
7142 // shared by multiple instances of the function. 7146 // shared by multiple instances of the function.
7143 class SharedFunctionInfo: public HeapObject { 7147 class SharedFunctionInfo: public HeapObject {
7144 public: 7148 public:
7145 // [name]: Function name. 7149 // [name]: Function name.
7146 DECL_ACCESSORS(name, Object) 7150 DECL_ACCESSORS(name, Object)
7147 7151
7148 // [code]: Function code. 7152 // [code]: Function code.
7149 DECL_ACCESSORS(code, Code) 7153 DECL_ACCESSORS(code, Code)
(...skipping 11 matching lines...) Expand all
7161 inline bool IsInterpreted() const; 7165 inline bool IsInterpreted() const;
7162 7166
7163 inline void ReplaceCode(Code* code); 7167 inline void ReplaceCode(Code* code);
7164 inline bool HasBaselineCode() const; 7168 inline bool HasBaselineCode() const;
7165 7169
7166 // [optimized_code_map]: Map from native context to optimized code 7170 // [optimized_code_map]: Map from native context to optimized code
7167 // and a shared literals array. 7171 // and a shared literals array.
7168 DECL_ACCESSORS(optimized_code_map, FixedArray) 7172 DECL_ACCESSORS(optimized_code_map, FixedArray)
7169 7173
7170 // Returns entry from optimized code map for specified context and OSR entry. 7174 // Returns entry from optimized code map for specified context and OSR entry.
7171 Code* SearchOptimizedCodeMap(Context* native_context, BailoutId osr_ast_id); 7175 // Note that {code == nullptr, literals == nullptr} indicates no matching
7176 // entry has been found, whereas {code, literals == nullptr} indicates that
7177 // code is context-independent.
7178 CodeAndLiterals SearchOptimizedCodeMap(Context* native_context,
7179 BailoutId osr_ast_id);
7172 7180
7173 // Clear optimized code map. 7181 // Clear optimized code map.
7174 void ClearOptimizedCodeMap(); 7182 void ClearOptimizedCodeMap();
7175 7183
7176 // Like ClearOptimizedCodeMap, but preserves literals. 7184 // Like ClearOptimizedCodeMap, but preserves literals.
7177 void ClearCodeFromOptimizedCodeMap(); 7185 void ClearCodeFromOptimizedCodeMap();
7178 7186
7179 // We have a special root FixedArray with the right shape and values 7187 // We have a special root FixedArray with the right shape and values
7180 // to represent the cleared optimized code map. This predicate checks 7188 // to represent the cleared optimized code map. This predicate checks
7181 // if that root is installed. 7189 // if that root is installed.
7182 inline bool OptimizedCodeMapIsCleared() const; 7190 inline bool OptimizedCodeMapIsCleared() const;
7183 7191
7184 // Removes a specific optimized code object from the optimized code map. 7192 // Removes a specific optimized code object from the optimized code map.
7185 // In case of non-OSR the code reference is cleared from the cache entry but 7193 // In case of non-OSR the code reference is cleared from the cache entry but
7186 // the entry itself is left in the map in order to proceed sharing literals. 7194 // the entry itself is left in the map in order to proceed sharing literals.
7187 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason); 7195 void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
7188 7196
7189 static Handle<LiteralsArray> FindOrCreateLiterals( 7197 static Handle<LiteralsArray> FindOrCreateLiterals(
7190 Handle<SharedFunctionInfo> shared, Handle<Context> native_context); 7198 Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
7191 7199
7192 // Add or update entry in the optimized code map for context-dependent code. 7200 // Add or update entry in the optimized code map for context-dependent code.
7201 // If {code} is not given, then an existing entry's code won't be overwritten.
7193 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 7202 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
7194 Handle<Context> native_context, 7203 Handle<Context> native_context,
7195 Handle<Code> code, BailoutId osr_ast_id); 7204 MaybeHandle<Code> code,
7205 Handle<LiteralsArray> literals,
7206 BailoutId osr_ast_id);
7196 7207
7197 // Set up the link between shared function info and the script. The shared 7208 // Set up the link between shared function info and the script. The shared
7198 // function info is added to the list on the script. 7209 // function info is added to the list on the script.
7199 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared, 7210 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared,
7200 Handle<Object> script_object); 7211 Handle<Object> script_object);
7201 7212
7202 // Layout description of the optimized code map. 7213 // Layout description of the optimized code map.
7203 static const int kEntriesStart = 0; 7214 static const int kEntriesStart = 0;
7204 static const int kContextOffset = 0; 7215 static const int kContextOffset = 0;
7205 static const int kCachedCodeOffset = 1; 7216 static const int kCachedCodeOffset = 1;
7206 static const int kEntryLength = 2; 7217 static const int kLiteralsOffset = 2;
7218 static const int kEntryLength = 3;
7207 static const int kInitialLength = kEntriesStart + kEntryLength; 7219 static const int kInitialLength = kEntriesStart + kEntryLength;
7208 7220
7209 static const int kNotFound = -1; 7221 static const int kNotFound = -1;
7210 7222
7211 // Helpers for assembly code that does a backwards walk of the optimized code 7223 // Helpers for assembly code that does a backwards walk of the optimized code
7212 // map. 7224 // map.
7213 static const int kOffsetToPreviousContext = 7225 static const int kOffsetToPreviousContext =
7214 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength); 7226 FixedArray::kHeaderSize + kPointerSize * (kContextOffset - kEntryLength);
7215 static const int kOffsetToPreviousCachedCode = 7227 static const int kOffsetToPreviousCachedCode =
7216 FixedArray::kHeaderSize + 7228 FixedArray::kHeaderSize +
7217 kPointerSize * (kCachedCodeOffset - kEntryLength); 7229 kPointerSize * (kCachedCodeOffset - kEntryLength);
7230 static const int kOffsetToPreviousLiterals =
7231 FixedArray::kHeaderSize + kPointerSize * (kLiteralsOffset - kEntryLength);
7218 7232
7219 // [scope_info]: Scope info. 7233 // [scope_info]: Scope info.
7220 DECL_ACCESSORS(scope_info, ScopeInfo) 7234 DECL_ACCESSORS(scope_info, ScopeInfo)
7221 7235
7222 // The outer scope info for the purpose of parsing this function, or the hole 7236 // The outer scope info for the purpose of parsing this function, or the hole
7223 // value if it isn't yet known. 7237 // value if it isn't yet known.
7224 DECL_ACCESSORS(outer_scope_info, HeapObject) 7238 DECL_ACCESSORS(outer_scope_info, HeapObject)
7225 7239
7226 // [construct stub]: Code stub for constructing instances of this function. 7240 // [construct stub]: Code stub for constructing instances of this function.
7227 DECL_ACCESSORS(construct_stub, Code) 7241 DECL_ACCESSORS(construct_stub, Code)
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
8157 // 8171 //
8158 // If the function contains object, regexp or array literals, the 8172 // If the function contains object, regexp or array literals, the
8159 // literals array prefix contains the object, regexp, and array 8173 // literals array prefix contains the object, regexp, and array
8160 // function to be used when creating these literals. This is 8174 // function to be used when creating these literals. This is
8161 // necessary so that we do not dynamically lookup the object, regexp 8175 // necessary so that we do not dynamically lookup the object, regexp
8162 // or array functions. Performing a dynamic lookup, we might end up 8176 // or array functions. Performing a dynamic lookup, we might end up
8163 // using the functions from a new context that we should not have 8177 // using the functions from a new context that we should not have
8164 // access to. For API objects we store the boilerplate in the literal array. 8178 // access to. For API objects we store the boilerplate in the literal array.
8165 DECL_ACCESSORS(literals, LiteralsArray) 8179 DECL_ACCESSORS(literals, LiteralsArray)
8166 8180
8167 inline bool has_literals_array() const;
8168 static void EnsureLiterals(Handle<JSFunction> function); 8181 static void EnsureLiterals(Handle<JSFunction> function);
8169 inline TypeFeedbackVector* feedback_vector(); 8182 inline TypeFeedbackVector* feedback_vector();
8170 8183
8171 // Unconditionally clear the type feedback vector (including vector ICs). 8184 // Unconditionally clear the type feedback vector (including vector ICs).
8172 void ClearTypeFeedbackInfo(); 8185 void ClearTypeFeedbackInfo();
8173 8186
8174 // Clear the type feedback vector with a more subtle policy at GC time. 8187 // Clear the type feedback vector with a more subtle policy at GC time.
8175 void ClearTypeFeedbackInfoAtGCTime(); 8188 void ClearTypeFeedbackInfoAtGCTime();
8176 8189
8177 // The initial map for an object created by this constructor. 8190 // The initial map for an object created by this constructor.
(...skipping 3509 matching lines...) Expand 10 before | Expand all | Expand 10 after
11687 } 11700 }
11688 }; 11701 };
11689 11702
11690 11703
11691 } // NOLINT, false-positive due to second-order macros. 11704 } // NOLINT, false-positive due to second-order macros.
11692 } // NOLINT, false-positive due to second-order macros. 11705 } // NOLINT, false-positive due to second-order macros.
11693 11706
11694 #include "src/objects/object-macros-undef.h" 11707 #include "src/objects/object-macros-undef.h"
11695 11708
11696 #endif // V8_OBJECTS_H_ 11709 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap/object-stats.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698