OLD | NEW |
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // - LiteralsArray |
| 80 // - BindingsArray |
80 // - HashTable | 81 // - HashTable |
81 // - Dictionary | 82 // - Dictionary |
82 // - StringTable | 83 // - StringTable |
83 // - CompilationCacheTable | 84 // - CompilationCacheTable |
84 // - CodeCacheHashTable | 85 // - CodeCacheHashTable |
85 // - MapCache | 86 // - MapCache |
86 // - OrderedHashTable | 87 // - OrderedHashTable |
87 // - OrderedHashSet | 88 // - OrderedHashSet |
88 // - OrderedHashMap | 89 // - OrderedHashMap |
89 // - Context | 90 // - Context |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 V(BytecodeArray) \ | 935 V(BytecodeArray) \ |
935 V(FreeSpace) \ | 936 V(FreeSpace) \ |
936 V(JSReceiver) \ | 937 V(JSReceiver) \ |
937 V(JSObject) \ | 938 V(JSObject) \ |
938 V(JSContextExtensionObject) \ | 939 V(JSContextExtensionObject) \ |
939 V(JSGeneratorObject) \ | 940 V(JSGeneratorObject) \ |
940 V(JSModule) \ | 941 V(JSModule) \ |
941 V(LayoutDescriptor) \ | 942 V(LayoutDescriptor) \ |
942 V(Map) \ | 943 V(Map) \ |
943 V(DescriptorArray) \ | 944 V(DescriptorArray) \ |
| 945 V(BindingsArray) \ |
944 V(TransitionArray) \ | 946 V(TransitionArray) \ |
945 V(LiteralsArray) \ | 947 V(LiteralsArray) \ |
946 V(TypeFeedbackVector) \ | 948 V(TypeFeedbackVector) \ |
947 V(DeoptimizationInputData) \ | 949 V(DeoptimizationInputData) \ |
948 V(DeoptimizationOutputData) \ | 950 V(DeoptimizationOutputData) \ |
949 V(DependentCode) \ | 951 V(DependentCode) \ |
950 V(HandlerTable) \ | 952 V(HandlerTable) \ |
951 V(FixedArray) \ | 953 V(FixedArray) \ |
952 V(FixedDoubleArray) \ | 954 V(FixedDoubleArray) \ |
953 V(WeakFixedArray) \ | 955 V(WeakFixedArray) \ |
(...skipping 3644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4598 DECLARE_CAST(LiteralsArray) | 4600 DECLARE_CAST(LiteralsArray) |
4599 | 4601 |
4600 private: | 4602 private: |
4601 inline Object* get(int index) const; | 4603 inline Object* get(int index) const; |
4602 inline void set(int index, Object* value); | 4604 inline void set(int index, Object* value); |
4603 inline void set(int index, Smi* value); | 4605 inline void set(int index, Smi* value); |
4604 inline void set(int index, Object* value, WriteBarrierMode mode); | 4606 inline void set(int index, Object* value, WriteBarrierMode mode); |
4605 }; | 4607 }; |
4606 | 4608 |
4607 | 4609 |
| 4610 // A bindings array contains the bindings for a bound function. It also holds |
| 4611 // the type feedback vector. |
| 4612 class BindingsArray : public FixedArray { |
| 4613 public: |
| 4614 inline TypeFeedbackVector* feedback_vector() const; |
| 4615 inline void set_feedback_vector(TypeFeedbackVector* vector); |
| 4616 |
| 4617 inline JSReceiver* bound_function() const; |
| 4618 inline void set_bound_function(JSReceiver* function); |
| 4619 inline Object* bound_this() const; |
| 4620 inline void set_bound_this(Object* bound_this); |
| 4621 |
| 4622 inline Object* binding(int binding_index) const; |
| 4623 inline void set_binding(int binding_index, Object* binding); |
| 4624 inline int bindings_count() const; |
| 4625 |
| 4626 static Handle<BindingsArray> New(Isolate* isolate, |
| 4627 Handle<TypeFeedbackVector> vector, |
| 4628 Handle<JSReceiver> bound_function, |
| 4629 Handle<Object> bound_this, |
| 4630 int number_of_bindings); |
| 4631 |
| 4632 static Handle<JSArray> CreateBoundArguments(Handle<BindingsArray> bindings); |
| 4633 static Handle<JSArray> CreateRuntimeBindings(Handle<BindingsArray> bindings); |
| 4634 |
| 4635 DECLARE_CAST(BindingsArray) |
| 4636 |
| 4637 private: |
| 4638 static const int kVectorIndex = 0; |
| 4639 static const int kBoundFunctionIndex = 1; |
| 4640 static const int kBoundThisIndex = 2; |
| 4641 static const int kFirstBindingIndex = 3; |
| 4642 |
| 4643 inline Object* get(int index) const; |
| 4644 inline void set(int index, Object* value); |
| 4645 inline void set(int index, Smi* value); |
| 4646 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 4647 |
| 4648 inline int length() const; |
| 4649 }; |
| 4650 |
| 4651 |
4608 // HandlerTable is a fixed array containing entries for exception handlers in | 4652 // HandlerTable is a fixed array containing entries for exception handlers in |
4609 // the code object it is associated with. The tables comes in two flavors: | 4653 // the code object it is associated with. The tables comes in two flavors: |
4610 // 1) Based on ranges: Used for unoptimized code. Contains one entry per | 4654 // 1) Based on ranges: Used for unoptimized code. Contains one entry per |
4611 // exception handler and a range representing the try-block covered by that | 4655 // exception handler and a range representing the try-block covered by that |
4612 // handler. Layout looks as follows: | 4656 // handler. Layout looks as follows: |
4613 // [ range-start , range-end , handler-offset , stack-depth ] | 4657 // [ range-start , range-end , handler-offset , stack-depth ] |
4614 // 2) Based on return addresses: Used for turbofanned code. Contains one entry | 4658 // 2) Based on return addresses: Used for turbofanned code. Contains one entry |
4615 // per call-site that could throw an exception. Layout looks as follows: | 4659 // per call-site that could throw an exception. Layout looks as follows: |
4616 // [ return-address-offset , handler-offset ] | 4660 // [ return-address-offset , handler-offset ] |
4617 class HandlerTable : public FixedArray { | 4661 class HandlerTable : public FixedArray { |
(...skipping 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7168 // access to. | 7212 // access to. |
7169 // | 7213 // |
7170 // On bound functions, the array is a (copy-on-write) fixed-array containing | 7214 // On bound functions, the array is a (copy-on-write) fixed-array containing |
7171 // the function that was bound, bound this-value and any bound | 7215 // the function that was bound, bound this-value and any bound |
7172 // arguments. Bound functions never contain literals. | 7216 // arguments. Bound functions never contain literals. |
7173 DECL_ACCESSORS(literals_or_bindings, FixedArray) | 7217 DECL_ACCESSORS(literals_or_bindings, FixedArray) |
7174 | 7218 |
7175 inline LiteralsArray* literals(); | 7219 inline LiteralsArray* literals(); |
7176 inline void set_literals(LiteralsArray* literals); | 7220 inline void set_literals(LiteralsArray* literals); |
7177 | 7221 |
7178 inline FixedArray* function_bindings(); | 7222 inline BindingsArray* function_bindings(); |
7179 inline void set_function_bindings(FixedArray* bindings); | 7223 inline void set_function_bindings(BindingsArray* bindings); |
7180 | 7224 |
7181 // The initial map for an object created by this constructor. | 7225 // The initial map for an object created by this constructor. |
7182 inline Map* initial_map(); | 7226 inline Map* initial_map(); |
7183 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, | 7227 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, |
7184 Handle<Object> prototype); | 7228 Handle<Object> prototype); |
7185 inline bool has_initial_map(); | 7229 inline bool has_initial_map(); |
7186 static void EnsureHasInitialMap(Handle<JSFunction> function); | 7230 static void EnsureHasInitialMap(Handle<JSFunction> function); |
7187 | 7231 |
7188 // Get and set the prototype property on a JSFunction. If the | 7232 // Get and set the prototype property on a JSFunction. If the |
7189 // function has an initial map the prototype is set on the initial | 7233 // function has an initial map the prototype is set on the initial |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7256 static const int kPrototypeOrInitialMapOffset = | 7300 static const int kPrototypeOrInitialMapOffset = |
7257 kCodeEntryOffset + kPointerSize; | 7301 kCodeEntryOffset + kPointerSize; |
7258 static const int kSharedFunctionInfoOffset = | 7302 static const int kSharedFunctionInfoOffset = |
7259 kPrototypeOrInitialMapOffset + kPointerSize; | 7303 kPrototypeOrInitialMapOffset + kPointerSize; |
7260 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; | 7304 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; |
7261 static const int kLiteralsOffset = kContextOffset + kPointerSize; | 7305 static const int kLiteralsOffset = kContextOffset + kPointerSize; |
7262 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; | 7306 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; |
7263 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; | 7307 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; |
7264 static const int kSize = kNextFunctionLinkOffset + kPointerSize; | 7308 static const int kSize = kNextFunctionLinkOffset + kPointerSize; |
7265 | 7309 |
7266 // Layout of the bound-function binding array. | |
7267 static const int kBoundFunctionIndex = 0; | |
7268 static const int kBoundThisIndex = 1; | |
7269 static const int kBoundArgumentsStartIndex = 2; | |
7270 | |
7271 private: | 7310 private: |
7272 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); | 7311 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); |
7273 }; | 7312 }; |
7274 | 7313 |
7275 | 7314 |
7276 // JSGlobalProxy's prototype must be a JSGlobalObject or null, | 7315 // JSGlobalProxy's prototype must be a JSGlobalObject or null, |
7277 // and the prototype is hidden. JSGlobalProxy always delegates | 7316 // and the prototype is hidden. JSGlobalProxy always delegates |
7278 // property accesses to its prototype if the prototype is not null. | 7317 // property accesses to its prototype if the prototype is not null. |
7279 // | 7318 // |
7280 // A JSGlobalProxy can be reinitialized which will preserve its identity. | 7319 // A JSGlobalProxy can be reinitialized which will preserve its identity. |
(...skipping 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10620 | 10659 |
10621 Isolate* isolate_; | 10660 Isolate* isolate_; |
10622 Handle<FixedArray> keys_; | 10661 Handle<FixedArray> keys_; |
10623 Handle<OrderedHashSet> set_; | 10662 Handle<OrderedHashSet> set_; |
10624 int length_; | 10663 int length_; |
10625 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10664 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
10626 }; | 10665 }; |
10627 } } // namespace v8::internal | 10666 } } // namespace v8::internal |
10628 | 10667 |
10629 #endif // V8_OBJECTS_H_ | 10668 #endif // V8_OBJECTS_H_ |
OLD | NEW |