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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 V(Map) \ | 934 V(Map) \ |
935 V(DescriptorArray) \ | 935 V(DescriptorArray) \ |
936 V(TransitionArray) \ | 936 V(TransitionArray) \ |
937 V(TypeFeedbackVector) \ | 937 V(TypeFeedbackVector) \ |
938 V(DeoptimizationInputData) \ | 938 V(DeoptimizationInputData) \ |
939 V(DeoptimizationOutputData) \ | 939 V(DeoptimizationOutputData) \ |
940 V(DependentCode) \ | 940 V(DependentCode) \ |
941 V(FixedArray) \ | 941 V(FixedArray) \ |
942 V(FixedDoubleArray) \ | 942 V(FixedDoubleArray) \ |
943 V(WeakFixedArray) \ | 943 V(WeakFixedArray) \ |
| 944 V(ArrayList) \ |
944 V(ConstantPoolArray) \ | 945 V(ConstantPoolArray) \ |
945 V(Context) \ | 946 V(Context) \ |
946 V(ScriptContextTable) \ | 947 V(ScriptContextTable) \ |
947 V(NativeContext) \ | 948 V(NativeContext) \ |
948 V(ScopeInfo) \ | 949 V(ScopeInfo) \ |
949 V(JSFunction) \ | 950 V(JSFunction) \ |
950 V(Code) \ | 951 V(Code) \ |
951 V(Oddball) \ | 952 V(Oddball) \ |
952 V(SharedFunctionInfo) \ | 953 V(SharedFunctionInfo) \ |
953 V(JSValue) \ | 954 V(JSValue) \ |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 inline void set_last_used_index(int index); | 2621 inline void set_last_used_index(int index); |
2621 | 2622 |
2622 // Disallow inherited setters. | 2623 // Disallow inherited setters. |
2623 void set(int index, Smi* value); | 2624 void set(int index, Smi* value); |
2624 void set(int index, Object* value); | 2625 void set(int index, Object* value); |
2625 void set(int index, Object* value, WriteBarrierMode mode); | 2626 void set(int index, Object* value, WriteBarrierMode mode); |
2626 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray); | 2627 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray); |
2627 }; | 2628 }; |
2628 | 2629 |
2629 | 2630 |
| 2631 // Generic array grows dynamically with O(1) amortized insertion. |
| 2632 class ArrayList : public FixedArray { |
| 2633 public: |
| 2634 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj); |
| 2635 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj1, |
| 2636 Handle<Object> obj2); |
| 2637 inline int Length(); |
| 2638 inline void SetLength(int length); |
| 2639 inline Object* Get(int index); |
| 2640 inline Object** Slot(int index); |
| 2641 inline void Set(int index, Object* obj); |
| 2642 inline void Clear(int index, Object* undefined); |
| 2643 DECLARE_CAST(ArrayList) |
| 2644 |
| 2645 private: |
| 2646 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
| 2647 static const int kLengthIndex = 0; |
| 2648 static const int kFirstIndex = 1; |
| 2649 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
| 2650 }; |
| 2651 |
| 2652 |
2630 // ConstantPoolArray describes a fixed-sized array containing constant pool | 2653 // ConstantPoolArray describes a fixed-sized array containing constant pool |
2631 // entries. | 2654 // entries. |
2632 // | 2655 // |
2633 // A ConstantPoolArray can be structured in two different ways depending upon | 2656 // A ConstantPoolArray can be structured in two different ways depending upon |
2634 // whether it is extended or small. The is_extended_layout() method can be used | 2657 // whether it is extended or small. The is_extended_layout() method can be used |
2635 // to discover which layout the constant pool has. | 2658 // to discover which layout the constant pool has. |
2636 // | 2659 // |
2637 // The format of a small constant pool is: | 2660 // The format of a small constant pool is: |
2638 // [kSmallLayout1Offset] : Small section layout bitmap 1 | 2661 // [kSmallLayout1Offset] : Small section layout bitmap 1 |
2639 // [kSmallLayout2Offset] : Small section layout bitmap 2 | 2662 // [kSmallLayout2Offset] : Small section layout bitmap 2 |
(...skipping 8343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10983 } else { | 11006 } else { |
10984 value &= ~(1 << bit_position); | 11007 value &= ~(1 << bit_position); |
10985 } | 11008 } |
10986 return value; | 11009 return value; |
10987 } | 11010 } |
10988 }; | 11011 }; |
10989 | 11012 |
10990 } } // namespace v8::internal | 11013 } } // namespace v8::internal |
10991 | 11014 |
10992 #endif // V8_OBJECTS_H_ | 11015 #endif // V8_OBJECTS_H_ |
OLD | NEW |