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 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 void set(int index, Smi* value); | 2624 void set(int index, Smi* value); |
2625 void set(int index, Object* value); | 2625 void set(int index, Object* value); |
2626 void set(int index, Object* value, WriteBarrierMode mode); | 2626 void set(int index, Object* value, WriteBarrierMode mode); |
2627 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray); | 2627 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakFixedArray); |
2628 }; | 2628 }; |
2629 | 2629 |
2630 | 2630 |
2631 // Generic array grows dynamically with O(1) amortized insertion. | 2631 // Generic array grows dynamically with O(1) amortized insertion. |
2632 class ArrayList : public FixedArray { | 2632 class ArrayList : public FixedArray { |
2633 public: | 2633 public: |
2634 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj); | 2634 enum AddMode { |
| 2635 kNone, |
| 2636 // Use this if GC can delete elements from the array. |
| 2637 kReloadLengthAfterAllocation, |
| 2638 }; |
| 2639 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj, |
| 2640 AddMode mode = kNone); |
2635 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj1, | 2641 static Handle<ArrayList> Add(Handle<ArrayList> array, Handle<Object> obj1, |
2636 Handle<Object> obj2); | 2642 Handle<Object> obj2, AddMode = kNone); |
2637 inline int Length(); | 2643 inline int Length(); |
2638 inline void SetLength(int length); | 2644 inline void SetLength(int length); |
2639 inline Object* Get(int index); | 2645 inline Object* Get(int index); |
2640 inline Object** Slot(int index); | 2646 inline Object** Slot(int index); |
2641 inline void Set(int index, Object* obj); | 2647 inline void Set(int index, Object* obj); |
2642 inline void Clear(int index, Object* undefined); | 2648 inline void Clear(int index, Object* undefined); |
2643 DECLARE_CAST(ArrayList) | 2649 DECLARE_CAST(ArrayList) |
2644 | 2650 |
2645 private: | 2651 private: |
2646 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 2652 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
(...skipping 8348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10995 } else { | 11001 } else { |
10996 value &= ~(1 << bit_position); | 11002 value &= ~(1 << bit_position); |
10997 } | 11003 } |
10998 return value; | 11004 return value; |
10999 } | 11005 } |
11000 }; | 11006 }; |
11001 | 11007 |
11002 } } // namespace v8::internal | 11008 } } // namespace v8::internal |
11003 | 11009 |
11004 #endif // V8_OBJECTS_H_ | 11010 #endif // V8_OBJECTS_H_ |
OLD | NEW |