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 "allocation.h" | 8 #include "allocation.h" |
9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
10 #include "builtins.h" | 10 #include "builtins.h" |
(...skipping 9968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9979 kKindKeys = 1, | 9979 kKindKeys = 1, |
9980 kKindValues = 2, | 9980 kKindValues = 2, |
9981 kKindEntries = 3 | 9981 kKindEntries = 3 |
9982 }; | 9982 }; |
9983 | 9983 |
9984 // Returns an iterator result object: {value: any, done: boolean} and moves | 9984 // Returns an iterator result object: {value: any, done: boolean} and moves |
9985 // the index to the next valid entry. Closes the iterator if moving past the | 9985 // the index to the next valid entry. Closes the iterator if moving past the |
9986 // end. | 9986 // end. |
9987 static Handle<JSObject> Next(Handle<Derived> iterator); | 9987 static Handle<JSObject> Next(Handle<Derived> iterator); |
9988 | 9988 |
9989 protected: | |
9990 static Handle<Derived> CreateInternal( | |
9991 Handle<Map> map, Handle<TableType> table, int kind); | |
9992 | |
9993 private: | 9989 private: |
9994 // Transitions the iterator to the non obsolote backing store. This is a NOP | 9990 // Transitions the iterator to the non obsolote backing store. This is a NOP |
9995 // if the [table] is not obsolete. | 9991 // if the [table] is not obsolete. |
9996 void Transition(); | 9992 void Transition(); |
9997 | 9993 |
9998 DISALLOW_IMPLICIT_CONSTRUCTORS(OrderedHashTableIterator); | 9994 DISALLOW_IMPLICIT_CONSTRUCTORS(OrderedHashTableIterator); |
9999 }; | 9995 }; |
10000 | 9996 |
10001 | 9997 |
10002 class JSSetIterator: public OrderedHashTableIterator<JSSetIterator, | 9998 class JSSetIterator: public OrderedHashTableIterator<JSSetIterator, |
10003 OrderedHashSet> { | 9999 OrderedHashSet> { |
10004 public: | 10000 public: |
10005 // Creates a new iterator associated with [table]. | |
10006 // [kind] needs to be one of the OrderedHashTableIterator Kind enum values. | |
10007 static inline Handle<JSSetIterator> Create( | |
10008 Handle<OrderedHashSet> table, int kind); | |
10009 | |
10010 // Dispatched behavior. | 10001 // Dispatched behavior. |
10011 DECLARE_PRINTER(JSSetIterator) | 10002 DECLARE_PRINTER(JSSetIterator) |
10012 DECLARE_VERIFIER(JSSetIterator) | 10003 DECLARE_VERIFIER(JSSetIterator) |
10013 | 10004 |
10014 // Casting. | 10005 // Casting. |
10015 static inline JSSetIterator* cast(Object* obj); | 10006 static inline JSSetIterator* cast(Object* obj); |
10016 | 10007 |
10017 static Handle<Object> ValueForKind( | 10008 static Handle<Object> ValueForKind( |
10018 Handle<JSSetIterator> iterator, | 10009 Handle<JSSetIterator> iterator, |
10019 int entry_index); | 10010 int entry_index); |
10020 | 10011 |
10021 private: | 10012 private: |
10022 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSetIterator); | 10013 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSetIterator); |
10023 }; | 10014 }; |
10024 | 10015 |
10025 | 10016 |
10026 class JSMapIterator: public OrderedHashTableIterator<JSMapIterator, | 10017 class JSMapIterator: public OrderedHashTableIterator<JSMapIterator, |
10027 OrderedHashMap> { | 10018 OrderedHashMap> { |
10028 public: | 10019 public: |
10029 // Creates a new iterator associated with [table]. | |
10030 // [kind] needs to be one of the OrderedHashTableIterator Kind enum values. | |
10031 static inline Handle<JSMapIterator> Create( | |
10032 Handle<OrderedHashMap> table, int kind); | |
10033 | |
10034 // Dispatched behavior. | 10020 // Dispatched behavior. |
10035 DECLARE_PRINTER(JSMapIterator) | 10021 DECLARE_PRINTER(JSMapIterator) |
10036 DECLARE_VERIFIER(JSMapIterator) | 10022 DECLARE_VERIFIER(JSMapIterator) |
10037 | 10023 |
10038 // Casting. | 10024 // Casting. |
10039 static inline JSMapIterator* cast(Object* obj); | 10025 static inline JSMapIterator* cast(Object* obj); |
10040 | 10026 |
10041 static Handle<Object> ValueForKind( | 10027 static Handle<Object> ValueForKind( |
10042 Handle<JSMapIterator> iterator, | 10028 Handle<JSMapIterator> iterator, |
10043 int entry_index); | 10029 int entry_index); |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11074 } else { | 11060 } else { |
11075 value &= ~(1 << bit_position); | 11061 value &= ~(1 << bit_position); |
11076 } | 11062 } |
11077 return value; | 11063 return value; |
11078 } | 11064 } |
11079 }; | 11065 }; |
11080 | 11066 |
11081 } } // namespace v8::internal | 11067 } } // namespace v8::internal |
11082 | 11068 |
11083 #endif // V8_OBJECTS_H_ | 11069 #endif // V8_OBJECTS_H_ |
OLD | NEW |