|
77 | 77 | // - FixedArray |
78 | 78 | // - DescriptorArray |
79 | 79 | // - LiteralsArray |
| 80 | +// - BindingsArray |
80 | 81 | // - HashTable |
81 | 82 | // - Dictionary |
82 | 83 | // - StringTable |
@@ -941,6 +942,7 @@ template <class C> inline bool Is(Object* obj); |
941 | 942 | V(LayoutDescriptor) \ |
942 | 943 | V(Map) \ |
943 | 944 | V(DescriptorArray) \ |
| 945 | + V(BindingsArray) \ |
944 | 946 | V(TransitionArray) \ |
945 | 947 | V(LiteralsArray) \ |
946 | 948 | V(TypeFeedbackVector) \ |
@@ -4606,6 +4608,48 @@ class LiteralsArray : public FixedArray { |
4606 | 4608 | }; |
4607 | 4609 |
|
4608 | 4610 |
|
| 4611 | +// A bindings array contains the bindings for a bound function. It also holds |
| 4612 | +// the type feedback vector. |
| 4613 | +class BindingsArray : public FixedArray { |
| 4614 | + public: |
| 4615 | + inline TypeFeedbackVector* feedback_vector() const; |
| 4616 | + inline void set_feedback_vector(TypeFeedbackVector* vector); |
| 4617 | + |
| 4618 | + inline JSReceiver* bound_function() const; |
| 4619 | + inline void set_bound_function(JSReceiver* function); |
| 4620 | + inline Object* bound_this() const; |
| 4621 | + inline void set_bound_this(Object* bound_this); |
| 4622 | + |
| 4623 | + inline Object* binding(int binding_index) const; |
| 4624 | + inline void set_binding(int binding_index, Object* binding); |
| 4625 | + inline int bindings_count() const; |
| 4626 | + |
| 4627 | + static Handle<BindingsArray> New(Isolate* isolate, |
| 4628 | + Handle<TypeFeedbackVector> vector, |
| 4629 | + Handle<JSReceiver> bound_function, |
| 4630 | + Handle<Object> bound_this, |
| 4631 | + int number_of_bindings); |
| 4632 | + |
| 4633 | + static Handle<JSArray> CreateBoundArguments(Handle<BindingsArray> bindings); |
| 4634 | + static Handle<JSArray> CreateRuntimeBindings(Handle<BindingsArray> bindings); |
| 4635 | + |
| 4636 | + DECLARE_CAST(BindingsArray) |
| 4637 | + |
| 4638 | + private: |
| 4639 | + static const int kVectorIndex = 0; |
| 4640 | + static const int kBoundFunctionIndex = 1; |
| 4641 | + static const int kBoundThisIndex = 2; |
| 4642 | + static const int kFirstBindingIndex = 3; |
| 4643 | + |
| 4644 | + inline Object* get(int index) const; |
| 4645 | + inline void set(int index, Object* value); |
| 4646 | + inline void set(int index, Smi* value); |
| 4647 | + inline void set(int index, Object* value, WriteBarrierMode mode); |
| 4648 | + |
| 4649 | + inline int length() const; |
| 4650 | +}; |
| 4651 | + |
| 4652 | + |
4609 | 4653 | // HandlerTable is a fixed array containing entries for exception handlers in |
4610 | 4654 | // the code object it is associated with. The tables comes in two flavors: |
4611 | 4655 | // 1) Based on ranges: Used for unoptimized code. Contains one entry per |
@@ -7176,8 +7220,8 @@ class JSFunction: public JSObject { |
7176 | 7220 | inline LiteralsArray* literals(); |
7177 | 7221 | inline void set_literals(LiteralsArray* literals); |
7178 | 7222 |
|
7179 | | - inline FixedArray* function_bindings(); |
7180 | | - inline void set_function_bindings(FixedArray* bindings); |
| 7223 | + inline BindingsArray* function_bindings(); |
| 7224 | + inline void set_function_bindings(BindingsArray* bindings); |
7181 | 7225 |
|
7182 | 7226 | // The initial map for an object created by this constructor. |
7183 | 7227 | inline Map* initial_map(); |
@@ -7264,11 +7308,6 @@ class JSFunction: public JSObject { |
7264 | 7308 | static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; |
7265 | 7309 | static const int kSize = kNextFunctionLinkOffset + kPointerSize; |
7266 | 7310 |
|
7267 | | - // Layout of the bound-function binding array. |
7268 | | - static const int kBoundFunctionIndex = 0; |
7269 | | - static const int kBoundThisIndex = 1; |
7270 | | - static const int kBoundArgumentsStartIndex = 2; |
7271 | | - |
7272 | 7311 | private: |
7273 | 7312 | DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); |
7274 | 7313 | }; |
|
0 commit comments