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

Side by Side Diff: src/objects.h

Issue 1374723002: Introduce LiteralsArray to hide it's implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 2 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // - JSValue 69 // - JSValue
70 // - JSDate 70 // - JSDate
71 // - JSMessageObject 71 // - JSMessageObject
72 // - JSProxy 72 // - JSProxy
73 // - JSFunctionProxy 73 // - JSFunctionProxy
74 // - FixedArrayBase 74 // - FixedArrayBase
75 // - ByteArray 75 // - ByteArray
76 // - BytecodeArray 76 // - BytecodeArray
77 // - FixedArray 77 // - FixedArray
78 // - DescriptorArray 78 // - DescriptorArray
79 // - LiteralsArray
79 // - HashTable 80 // - HashTable
80 // - Dictionary 81 // - Dictionary
81 // - StringTable 82 // - StringTable
82 // - CompilationCacheTable 83 // - CompilationCacheTable
83 // - CodeCacheHashTable 84 // - CodeCacheHashTable
84 // - MapCache 85 // - MapCache
85 // - OrderedHashTable 86 // - OrderedHashTable
86 // - OrderedHashSet 87 // - OrderedHashSet
87 // - OrderedHashMap 88 // - OrderedHashMap
88 // - Context 89 // - Context
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 class AllocationSiteCreationContext; 842 class AllocationSiteCreationContext;
842 class AllocationSiteUsageContext; 843 class AllocationSiteUsageContext;
843 class Cell; 844 class Cell;
844 class ConsString; 845 class ConsString;
845 class ElementsAccessor; 846 class ElementsAccessor;
846 class FixedArrayBase; 847 class FixedArrayBase;
847 class FunctionLiteral; 848 class FunctionLiteral;
848 class GlobalObject; 849 class GlobalObject;
849 class JSBuiltinsObject; 850 class JSBuiltinsObject;
850 class LayoutDescriptor; 851 class LayoutDescriptor;
852 class LiteralsArray;
851 class LookupIterator; 853 class LookupIterator;
852 class ObjectHashTable; 854 class ObjectHashTable;
853 class ObjectVisitor; 855 class ObjectVisitor;
854 class PropertyCell; 856 class PropertyCell;
855 class SafepointEntry; 857 class SafepointEntry;
856 class SharedFunctionInfo; 858 class SharedFunctionInfo;
857 class StringStream; 859 class StringStream;
858 class TypeFeedbackInfo; 860 class TypeFeedbackInfo;
859 class TypeFeedbackVector; 861 class TypeFeedbackVector;
860 class WeakCell; 862 class WeakCell;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 V(FreeSpace) \ 931 V(FreeSpace) \
930 V(JSReceiver) \ 932 V(JSReceiver) \
931 V(JSObject) \ 933 V(JSObject) \
932 V(JSContextExtensionObject) \ 934 V(JSContextExtensionObject) \
933 V(JSGeneratorObject) \ 935 V(JSGeneratorObject) \
934 V(JSModule) \ 936 V(JSModule) \
935 V(LayoutDescriptor) \ 937 V(LayoutDescriptor) \
936 V(Map) \ 938 V(Map) \
937 V(DescriptorArray) \ 939 V(DescriptorArray) \
938 V(TransitionArray) \ 940 V(TransitionArray) \
941 V(LiteralsArray) \
939 V(TypeFeedbackVector) \ 942 V(TypeFeedbackVector) \
940 V(DeoptimizationInputData) \ 943 V(DeoptimizationInputData) \
941 V(DeoptimizationOutputData) \ 944 V(DeoptimizationOutputData) \
942 V(DependentCode) \ 945 V(DependentCode) \
943 V(HandlerTable) \ 946 V(HandlerTable) \
944 V(FixedArray) \ 947 V(FixedArray) \
945 V(FixedDoubleArray) \ 948 V(FixedDoubleArray) \
946 V(WeakFixedArray) \ 949 V(WeakFixedArray) \
947 V(ArrayList) \ 950 V(ArrayList) \
948 V(Context) \ 951 V(Context) \
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 PretenureFlag pretenure); 4544 PretenureFlag pretenure);
4542 4545
4543 DECLARE_CAST(DeoptimizationOutputData) 4546 DECLARE_CAST(DeoptimizationOutputData)
4544 4547
4545 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 4548 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
4546 void DeoptimizationOutputDataPrint(std::ostream& os); // NOLINT 4549 void DeoptimizationOutputDataPrint(std::ostream& os); // NOLINT
4547 #endif 4550 #endif
4548 }; 4551 };
4549 4552
4550 4553
4554 // A literals array contains the literals for a JSFunction. It also holds
4555 // the type feedback vector.
4556 class LiteralsArray : public FixedArray {
4557 public:
4558 static const int kVectorIndex = 0;
4559 static const int kFirstLiteralIndex = 1;
4560 static const int kOffsetToFirstLiteral =
4561 FixedArray::kHeaderSize + kPointerSize;
4562
4563 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.
4564
4565 inline TypeFeedbackVector* feedback_vector() const;
4566 inline void set_feedback_vector(TypeFeedbackVector* vector);
4567 inline Object* literal(int literal_index) const;
4568 inline void set_literal(int literal_index, Object* literal);
4569 inline int literals_count() const;
4570
4571 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.
4572 };
4573
4574
4551 // HandlerTable is a fixed array containing entries for exception handlers in 4575 // HandlerTable is a fixed array containing entries for exception handlers in
4552 // the code object it is associated with. The tables comes in two flavors: 4576 // the code object it is associated with. The tables comes in two flavors:
4553 // 1) Based on ranges: Used for unoptimized code. Contains one entry per 4577 // 1) Based on ranges: Used for unoptimized code. Contains one entry per
4554 // exception handler and a range representing the try-block covered by that 4578 // exception handler and a range representing the try-block covered by that
4555 // handler. Layout looks as follows: 4579 // handler. Layout looks as follows:
4556 // [ range-start , range-end , handler-offset , stack-depth ] 4580 // [ range-start , range-end , handler-offset , stack-depth ]
4557 // 2) Based on return addresses: Used for turbofanned code. Contains one entry 4581 // 2) Based on return addresses: Used for turbofanned code. Contains one entry
4558 // per call-site that could throw an exception. Layout looks as follows: 4582 // per call-site that could throw an exception. Layout looks as follows:
4559 // [ return-address-offset , handler-offset ] 4583 // [ return-address-offset , handler-offset ]
4560 class HandlerTable : public FixedArray { 4584 class HandlerTable : public FixedArray {
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after
6265 // Fake id for a special case of Math.pow. Note, it continues the 6289 // Fake id for a special case of Math.pow. Note, it continues the
6266 // list of math functions. 6290 // list of math functions.
6267 kMathPowHalf 6291 kMathPowHalf
6268 }; 6292 };
6269 6293
6270 6294
6271 // Result of searching in an optimized code map of a SharedFunctionInfo. Note 6295 // Result of searching in an optimized code map of a SharedFunctionInfo. Note
6272 // that both {code} and {literals} can be NULL to pass search result status. 6296 // that both {code} and {literals} can be NULL to pass search result status.
6273 struct CodeAndLiterals { 6297 struct CodeAndLiterals {
6274 Code* code; // Cached optimized code. 6298 Code* code; // Cached optimized code.
6275 FixedArray* literals; // Cached literals array. 6299 LiteralsArray* literals; // Cached literals array.
6276 }; 6300 };
6277 6301
6278 6302
6279 // SharedFunctionInfo describes the JSFunction information that can be 6303 // SharedFunctionInfo describes the JSFunction information that can be
6280 // shared by multiple instances of the function. 6304 // shared by multiple instances of the function.
6281 class SharedFunctionInfo: public HeapObject { 6305 class SharedFunctionInfo: public HeapObject {
6282 public: 6306 public:
6283 // [name]: Function name. 6307 // [name]: Function name.
6284 DECL_ACCESSORS(name, Object) 6308 DECL_ACCESSORS(name, Object)
6285 6309
(...skipping 26 matching lines...) Expand all
6312 // Add a new entry to the optimized code map for context-independent code. 6336 // Add a new entry to the optimized code map for context-independent code.
6313 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6337 static void AddSharedCodeToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6314 Handle<Code> code); 6338 Handle<Code> code);
6315 6339
6316 // Add a new entry to the optimized code map for context-dependent code. 6340 // Add a new entry to the optimized code map for context-dependent code.
6317 // |code| is either a code object or an undefined value. In the latter case 6341 // |code| is either a code object or an undefined value. In the latter case
6318 // the entry just maps |native_context, osr_ast_id| pair to |literals| array. 6342 // the entry just maps |native_context, osr_ast_id| pair to |literals| array.
6319 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, 6343 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared,
6320 Handle<Context> native_context, 6344 Handle<Context> native_context,
6321 Handle<HeapObject> code, 6345 Handle<HeapObject> code,
6322 Handle<FixedArray> literals, 6346 Handle<LiteralsArray> literals,
6323 BailoutId osr_ast_id); 6347 BailoutId osr_ast_id);
6324 6348
6325 // Set up the link between shared function info and the script. The shared 6349 // Set up the link between shared function info and the script. The shared
6326 // function info is added to the list on the script. 6350 // function info is added to the list on the script.
6327 static void SetScript(Handle<SharedFunctionInfo> shared, 6351 static void SetScript(Handle<SharedFunctionInfo> shared,
6328 Handle<Object> script_object); 6352 Handle<Object> script_object);
6329 6353
6330 // Layout description of the optimized code map. 6354 // Layout description of the optimized code map.
6331 static const int kNextMapIndex = 0; 6355 static const int kNextMapIndex = 0;
6332 static const int kSharedCodeIndex = 1; 6356 static const int kSharedCodeIndex = 1;
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
7108 // necessary so that we do not dynamically lookup the object, regexp 7132 // necessary so that we do not dynamically lookup the object, regexp
7109 // or array functions. Performing a dynamic lookup, we might end up 7133 // or array functions. Performing a dynamic lookup, we might end up
7110 // using the functions from a new context that we should not have 7134 // using the functions from a new context that we should not have
7111 // access to. 7135 // access to.
7112 // 7136 //
7113 // On bound functions, the array is a (copy-on-write) fixed-array containing 7137 // On bound functions, the array is a (copy-on-write) fixed-array containing
7114 // the function that was bound, bound this-value and any bound 7138 // the function that was bound, bound this-value and any bound
7115 // arguments. Bound functions never contain literals. 7139 // arguments. Bound functions never contain literals.
7116 DECL_ACCESSORS(literals_or_bindings, FixedArray) 7140 DECL_ACCESSORS(literals_or_bindings, FixedArray)
7117 7141
7118 inline FixedArray* literals(); 7142 inline LiteralsArray* literals();
7119 inline void set_literals(FixedArray* literals); 7143 inline void set_literals(LiteralsArray* literals);
7120 7144
7121 inline FixedArray* function_bindings(); 7145 inline FixedArray* function_bindings();
7122 inline void set_function_bindings(FixedArray* bindings); 7146 inline void set_function_bindings(FixedArray* bindings);
7123 7147
7124 // The initial map for an object created by this constructor. 7148 // The initial map for an object created by this constructor.
7125 inline Map* initial_map(); 7149 inline Map* initial_map();
7126 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, 7150 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
7127 Handle<Object> prototype); 7151 Handle<Object> prototype);
7128 inline bool has_initial_map(); 7152 inline bool has_initial_map();
7129 static void EnsureHasInitialMap(Handle<JSFunction> function); 7153 static void EnsureHasInitialMap(Handle<JSFunction> function);
(...skipping 3442 matching lines...) Expand 10 before | Expand all | Expand 10 after
10572 10596
10573 Isolate* isolate_; 10597 Isolate* isolate_;
10574 Handle<FixedArray> keys_; 10598 Handle<FixedArray> keys_;
10575 Handle<OrderedHashSet> set_; 10599 Handle<OrderedHashSet> set_;
10576 int length_; 10600 int length_;
10577 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 10601 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
10578 }; 10602 };
10579 } } // namespace v8::internal 10603 } } // namespace v8::internal
10580 10604
10581 #endif // V8_OBJECTS_H_ 10605 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698