OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 V(JS_GLOBAL_PROXY_TYPE) \ | 422 V(JS_GLOBAL_PROXY_TYPE) \ |
423 V(JS_ARRAY_TYPE) \ | 423 V(JS_ARRAY_TYPE) \ |
424 V(JS_ARRAY_BUFFER_TYPE) \ | 424 V(JS_ARRAY_BUFFER_TYPE) \ |
425 V(JS_TYPED_ARRAY_TYPE) \ | 425 V(JS_TYPED_ARRAY_TYPE) \ |
426 V(JS_DATA_VIEW_TYPE) \ | 426 V(JS_DATA_VIEW_TYPE) \ |
427 V(JS_PROXY_TYPE) \ | 427 V(JS_PROXY_TYPE) \ |
428 V(JS_SET_TYPE) \ | 428 V(JS_SET_TYPE) \ |
429 V(JS_MAP_TYPE) \ | 429 V(JS_MAP_TYPE) \ |
430 V(JS_SET_ITERATOR_TYPE) \ | 430 V(JS_SET_ITERATOR_TYPE) \ |
431 V(JS_MAP_ITERATOR_TYPE) \ | 431 V(JS_MAP_ITERATOR_TYPE) \ |
432 V(JS_ITERATOR_RESULT_TYPE) \ | |
433 V(JS_WEAK_MAP_TYPE) \ | 432 V(JS_WEAK_MAP_TYPE) \ |
434 V(JS_WEAK_SET_TYPE) \ | 433 V(JS_WEAK_SET_TYPE) \ |
435 V(JS_PROMISE_TYPE) \ | 434 V(JS_PROMISE_TYPE) \ |
436 V(JS_REGEXP_TYPE) \ | 435 V(JS_REGEXP_TYPE) \ |
437 \ | 436 \ |
438 V(JS_BOUND_FUNCTION_TYPE) \ | 437 V(JS_BOUND_FUNCTION_TYPE) \ |
439 V(JS_FUNCTION_TYPE) \ | 438 V(JS_FUNCTION_TYPE) \ |
440 V(DEBUG_INFO_TYPE) \ | 439 V(DEBUG_INFO_TYPE) \ |
441 V(BREAK_POINT_INFO_TYPE) | 440 V(BREAK_POINT_INFO_TYPE) |
442 | 441 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
716 JS_GLOBAL_OBJECT_TYPE, | 715 JS_GLOBAL_OBJECT_TYPE, |
717 JS_GLOBAL_PROXY_TYPE, | 716 JS_GLOBAL_PROXY_TYPE, |
718 JS_ARRAY_TYPE, | 717 JS_ARRAY_TYPE, |
719 JS_ARRAY_BUFFER_TYPE, | 718 JS_ARRAY_BUFFER_TYPE, |
720 JS_TYPED_ARRAY_TYPE, | 719 JS_TYPED_ARRAY_TYPE, |
721 JS_DATA_VIEW_TYPE, | 720 JS_DATA_VIEW_TYPE, |
722 JS_SET_TYPE, | 721 JS_SET_TYPE, |
723 JS_MAP_TYPE, | 722 JS_MAP_TYPE, |
724 JS_SET_ITERATOR_TYPE, | 723 JS_SET_ITERATOR_TYPE, |
725 JS_MAP_ITERATOR_TYPE, | 724 JS_MAP_ITERATOR_TYPE, |
726 JS_ITERATOR_RESULT_TYPE, | |
727 JS_WEAK_MAP_TYPE, | 725 JS_WEAK_MAP_TYPE, |
728 JS_WEAK_SET_TYPE, | 726 JS_WEAK_SET_TYPE, |
729 JS_PROMISE_TYPE, | 727 JS_PROMISE_TYPE, |
730 JS_REGEXP_TYPE, | 728 JS_REGEXP_TYPE, |
731 JS_BOUND_FUNCTION_TYPE, | 729 JS_BOUND_FUNCTION_TYPE, |
732 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 730 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
733 | 731 |
734 // Pseudo-types | 732 // Pseudo-types |
735 FIRST_TYPE = 0x0, | 733 FIRST_TYPE = 0x0, |
736 LAST_TYPE = JS_FUNCTION_TYPE, | 734 LAST_TYPE = JS_FUNCTION_TYPE, |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
956 V(JSArray) \ | 954 V(JSArray) \ |
957 V(JSArrayBuffer) \ | 955 V(JSArrayBuffer) \ |
958 V(JSArrayBufferView) \ | 956 V(JSArrayBufferView) \ |
959 V(JSTypedArray) \ | 957 V(JSTypedArray) \ |
960 V(JSDataView) \ | 958 V(JSDataView) \ |
961 V(JSProxy) \ | 959 V(JSProxy) \ |
962 V(JSSet) \ | 960 V(JSSet) \ |
963 V(JSMap) \ | 961 V(JSMap) \ |
964 V(JSSetIterator) \ | 962 V(JSSetIterator) \ |
965 V(JSMapIterator) \ | 963 V(JSMapIterator) \ |
966 V(JSIteratorResult) \ | |
967 V(JSWeakCollection) \ | 964 V(JSWeakCollection) \ |
968 V(JSWeakMap) \ | 965 V(JSWeakMap) \ |
969 V(JSWeakSet) \ | 966 V(JSWeakSet) \ |
970 V(JSRegExp) \ | 967 V(JSRegExp) \ |
971 V(HashTable) \ | 968 V(HashTable) \ |
972 V(Dictionary) \ | 969 V(Dictionary) \ |
973 V(StringTable) \ | 970 V(StringTable) \ |
974 V(NormalizedMapCache) \ | 971 V(NormalizedMapCache) \ |
975 V(CompilationCacheTable) \ | 972 V(CompilationCacheTable) \ |
976 V(CodeCacheHashTable) \ | 973 V(CodeCacheHashTable) \ |
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2593 static const int kValueIndex = 0; | 2590 static const int kValueIndex = 0; |
2594 static const int kWritableIndex = 1; | 2591 static const int kWritableIndex = 1; |
2595 static const int kEnumerableIndex = 2; | 2592 static const int kEnumerableIndex = 2; |
2596 static const int kConfigurableIndex = 3; | 2593 static const int kConfigurableIndex = 3; |
2597 | 2594 |
2598 private: | 2595 private: |
2599 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataPropertyDescriptor); | 2596 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataPropertyDescriptor); |
2600 }; | 2597 }; |
2601 | 2598 |
2602 | 2599 |
2600 // JSIteratorResult is just a JSObject with a specific initial map. | |
2601 // This initial map adds in-object properties for "done" and "value, | |
2602 // as specified by ES6 section 25.1.1.3 The IteratorResult Interface | |
2603 class JSIteratorResult: public JSObject { | |
Yang
2016/02/08 06:27:13
do we want to keep the "final" keyword here?
Benedikt Meurer
2016/02/08 06:28:22
Style fix :-)
| |
2604 public: | |
2605 // Offsets of object fields. | |
2606 static const int kValueOffset = JSObject::kHeaderSize; | |
2607 static const int kDoneOffset = kValueOffset + kPointerSize; | |
2608 static const int kSize = kDoneOffset + kPointerSize; | |
2609 // Indices of in-object properties. | |
2610 static const int kValueIndex = 0; | |
2611 static const int kDoneIndex = 1; | |
2612 | |
2613 private: | |
2614 DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult); | |
2615 }; | |
2616 | |
2617 | |
2603 // Common superclass for FixedArrays that allow implementations to share | 2618 // Common superclass for FixedArrays that allow implementations to share |
2604 // common accessors and some code paths. | 2619 // common accessors and some code paths. |
2605 class FixedArrayBase: public HeapObject { | 2620 class FixedArrayBase: public HeapObject { |
2606 public: | 2621 public: |
2607 // [length]: length of the array. | 2622 // [length]: length of the array. |
2608 inline int length() const; | 2623 inline int length() const; |
2609 inline void set_length(int value); | 2624 inline void set_length(int value); |
2610 | 2625 |
2611 // Get and set the length using acquire loads and release stores. | 2626 // Get and set the length using acquire loads and release stores. |
2612 inline int synchronized_length() const; | 2627 inline int synchronized_length() const; |
(...skipping 7260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9873 | 9888 |
9874 private: | 9889 private: |
9875 // Returns the current value of the iterator. This should only be called when | 9890 // Returns the current value of the iterator. This should only be called when |
9876 // |HasMore| returns true. | 9891 // |HasMore| returns true. |
9877 inline Object* CurrentValue(); | 9892 inline Object* CurrentValue(); |
9878 | 9893 |
9879 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator); | 9894 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator); |
9880 }; | 9895 }; |
9881 | 9896 |
9882 | 9897 |
9883 // ES6 section 25.1.1.3 The IteratorResult Interface | |
9884 class JSIteratorResult final : public JSObject { | |
9885 public: | |
9886 // [done]: This is the result status of an iterator next method call. If the | |
9887 // end of the iterator was reached done is true. If the end was not reached | |
9888 // done is false and a [value] is available. | |
9889 DECL_ACCESSORS(done, Object) | |
9890 | |
9891 // [value]: If [done] is false, this is the current iteration element value. | |
9892 // If [done] is true, this is the return value of the iterator, if it supplied | |
9893 // one. If the iterator does not have a return value, value is undefined. | |
9894 // In that case, the value property may be absent from the conforming object | |
9895 // if it does not inherit an explicit value property. | |
9896 DECL_ACCESSORS(value, Object) | |
9897 | |
9898 // Dispatched behavior. | |
9899 DECLARE_PRINTER(JSIteratorResult) | |
9900 DECLARE_VERIFIER(JSIteratorResult) | |
9901 | |
9902 DECLARE_CAST(JSIteratorResult) | |
9903 | |
9904 static const int kValueOffset = JSObject::kHeaderSize; | |
9905 static const int kDoneOffset = kValueOffset + kPointerSize; | |
9906 static const int kSize = kDoneOffset + kPointerSize; | |
9907 | |
9908 // Indices of in-object properties. | |
9909 static const int kValueIndex = 0; | |
9910 static const int kDoneIndex = 1; | |
9911 | |
9912 private: | |
9913 DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult); | |
9914 }; | |
9915 | |
9916 | |
9917 // Base class for both JSWeakMap and JSWeakSet | 9898 // Base class for both JSWeakMap and JSWeakSet |
9918 class JSWeakCollection: public JSObject { | 9899 class JSWeakCollection: public JSObject { |
9919 public: | 9900 public: |
9920 // [table]: the backing hash table mapping keys to values. | 9901 // [table]: the backing hash table mapping keys to values. |
9921 DECL_ACCESSORS(table, Object) | 9902 DECL_ACCESSORS(table, Object) |
9922 | 9903 |
9923 // [next]: linked list of encountered weak maps during GC. | 9904 // [next]: linked list of encountered weak maps during GC. |
9924 DECL_ACCESSORS(next, Object) | 9905 DECL_ACCESSORS(next, Object) |
9925 | 9906 |
9926 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); | 9907 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10810 } | 10791 } |
10811 return value; | 10792 return value; |
10812 } | 10793 } |
10813 }; | 10794 }; |
10814 | 10795 |
10815 | 10796 |
10816 } // NOLINT, false-positive due to second-order macros. | 10797 } // NOLINT, false-positive due to second-order macros. |
10817 } // NOLINT, false-positive due to second-order macros. | 10798 } // NOLINT, false-positive due to second-order macros. |
10818 | 10799 |
10819 #endif // V8_OBJECTS_H_ | 10800 #endif // V8_OBJECTS_H_ |
OLD | NEW |