Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 5766a8ccfb18b0f89490d14df13a8d6318e6c31e..51dbfa7e378318a26942aea6f2e998d7d820ea5f 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -76,6 +76,7 @@ |
| // - BytecodeArray |
| // - FixedArray |
| // - DescriptorArray |
| +// - LiteralsArray |
| // - HashTable |
| // - Dictionary |
| // - StringTable |
| @@ -848,6 +849,7 @@ class FunctionLiteral; |
| class GlobalObject; |
| class JSBuiltinsObject; |
| class LayoutDescriptor; |
| +class LiteralsArray; |
| class LookupIterator; |
| class ObjectHashTable; |
| class ObjectVisitor; |
| @@ -936,6 +938,7 @@ template <class C> inline bool Is(Object* obj); |
| V(Map) \ |
| V(DescriptorArray) \ |
| V(TransitionArray) \ |
| + V(LiteralsArray) \ |
| V(TypeFeedbackVector) \ |
| V(DeoptimizationInputData) \ |
| V(DeoptimizationOutputData) \ |
| @@ -4548,6 +4551,27 @@ class DeoptimizationOutputData: public FixedArray { |
| }; |
| +// A literals array contains the literals for a JSFunction. It also holds |
| +// the type feedback vector. |
| +class LiteralsArray : public FixedArray { |
| + public: |
| + static const int kVectorIndex = 0; |
| + static const int kFirstLiteralIndex = 1; |
| + static const int kOffsetToFirstLiteral = |
| + FixedArray::kHeaderSize + kPointerSize; |
| + |
| + static int OffsetOfLiteralAt(int index) { return SizeFor(index + 1); } |
|
Igor Sheludko
2015/09/28 16:35:28
+ kFirstLiteralIndex ?
mvstanton
2015/09/29 08:25:13
Done.
|
| + |
| + 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 int literals_count() const; |
| + |
| + DECLARE_CAST(LiteralsArray) |
|
Igor Sheludko
2015/09/28 16:35:28
Can we add FixedArray's get/set methods to private
mvstanton
2015/09/29 08:25:13
Good idea, done.
|
| +}; |
| + |
| + |
| // HandlerTable is a fixed array containing entries for exception handlers in |
| // the code object it is associated with. The tables comes in two flavors: |
| // 1) Based on ranges: Used for unoptimized code. Contains one entry per |
| @@ -6272,7 +6296,7 @@ enum BuiltinFunctionId { |
| // that both {code} and {literals} can be NULL to pass search result status. |
| struct CodeAndLiterals { |
| Code* code; // Cached optimized code. |
| - FixedArray* literals; // Cached literals array. |
| + LiteralsArray* literals; // Cached literals array. |
| }; |
| @@ -6319,7 +6343,7 @@ class SharedFunctionInfo: public HeapObject { |
| static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| Handle<Context> native_context, |
| Handle<HeapObject> code, |
| - Handle<FixedArray> literals, |
| + Handle<LiteralsArray> literals, |
| BailoutId osr_ast_id); |
| // Set up the link between shared function info and the script. The shared |
| @@ -7115,8 +7139,8 @@ class JSFunction: public JSObject { |
| // arguments. Bound functions never contain literals. |
| DECL_ACCESSORS(literals_or_bindings, FixedArray) |
| - inline FixedArray* literals(); |
| - inline void set_literals(FixedArray* literals); |
| + inline LiteralsArray* literals(); |
| + inline void set_literals(LiteralsArray* literals); |
| inline FixedArray* function_bindings(); |
| inline void set_function_bindings(FixedArray* bindings); |