Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: src/objects.h

Issue 2348493003: [builtins] move String.prototype[@@iterator] to C++ builtin (Closed)
Patch Set: V5 (try to make gcmole happy) Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include <memory> 9 #include <memory>
10 10
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 V(JS_PROXY_TYPE) \ 425 V(JS_PROXY_TYPE) \
426 V(JS_SET_TYPE) \ 426 V(JS_SET_TYPE) \
427 V(JS_MAP_TYPE) \ 427 V(JS_MAP_TYPE) \
428 V(JS_SET_ITERATOR_TYPE) \ 428 V(JS_SET_ITERATOR_TYPE) \
429 V(JS_MAP_ITERATOR_TYPE) \ 429 V(JS_MAP_ITERATOR_TYPE) \
430 V(JS_WEAK_MAP_TYPE) \ 430 V(JS_WEAK_MAP_TYPE) \
431 V(JS_WEAK_SET_TYPE) \ 431 V(JS_WEAK_SET_TYPE) \
432 V(JS_PROMISE_TYPE) \ 432 V(JS_PROMISE_TYPE) \
433 V(JS_REGEXP_TYPE) \ 433 V(JS_REGEXP_TYPE) \
434 V(JS_ERROR_TYPE) \ 434 V(JS_ERROR_TYPE) \
435 V(JS_STRING_ITERATOR_TYPE) \
435 \ 436 \
436 V(JS_BOUND_FUNCTION_TYPE) \ 437 V(JS_BOUND_FUNCTION_TYPE) \
437 V(JS_FUNCTION_TYPE) \ 438 V(JS_FUNCTION_TYPE) \
438 V(DEBUG_INFO_TYPE) \ 439 V(DEBUG_INFO_TYPE) \
439 V(BREAK_POINT_INFO_TYPE) 440 V(BREAK_POINT_INFO_TYPE)
440 441
441 // Since string types are not consecutive, this macro is used to 442 // Since string types are not consecutive, this macro is used to
442 // iterate over them. 443 // iterate over them.
443 #define STRING_TYPE_LIST(V) \ 444 #define STRING_TYPE_LIST(V) \
444 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ 445 V(STRING_TYPE, kVariableSizeSentinel, string, String) \
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 JS_DATA_VIEW_TYPE, 718 JS_DATA_VIEW_TYPE,
718 JS_SET_TYPE, 719 JS_SET_TYPE,
719 JS_MAP_TYPE, 720 JS_MAP_TYPE,
720 JS_SET_ITERATOR_TYPE, 721 JS_SET_ITERATOR_TYPE,
721 JS_MAP_ITERATOR_TYPE, 722 JS_MAP_ITERATOR_TYPE,
722 JS_WEAK_MAP_TYPE, 723 JS_WEAK_MAP_TYPE,
723 JS_WEAK_SET_TYPE, 724 JS_WEAK_SET_TYPE,
724 JS_PROMISE_TYPE, 725 JS_PROMISE_TYPE,
725 JS_REGEXP_TYPE, 726 JS_REGEXP_TYPE,
726 JS_ERROR_TYPE, 727 JS_ERROR_TYPE,
728 JS_STRING_ITERATOR_TYPE,
727 JS_BOUND_FUNCTION_TYPE, 729 JS_BOUND_FUNCTION_TYPE,
728 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 730 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
729 731
730 // Pseudo-types 732 // Pseudo-types
731 FIRST_TYPE = 0x0, 733 FIRST_TYPE = 0x0,
732 LAST_TYPE = JS_FUNCTION_TYPE, 734 LAST_TYPE = JS_FUNCTION_TYPE,
733 FIRST_NAME_TYPE = FIRST_TYPE, 735 FIRST_NAME_TYPE = FIRST_TYPE,
734 LAST_NAME_TYPE = SYMBOL_TYPE, 736 LAST_NAME_TYPE = SYMBOL_TYPE,
735 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, 737 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
736 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, 738 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 V(Boolean) \ 1001 V(Boolean) \
1000 V(JSArray) \ 1002 V(JSArray) \
1001 V(JSArrayBuffer) \ 1003 V(JSArrayBuffer) \
1002 V(JSArrayBufferView) \ 1004 V(JSArrayBufferView) \
1003 V(JSCollection) \ 1005 V(JSCollection) \
1004 V(JSTypedArray) \ 1006 V(JSTypedArray) \
1005 V(JSDataView) \ 1007 V(JSDataView) \
1006 V(JSProxy) \ 1008 V(JSProxy) \
1007 V(JSError) \ 1009 V(JSError) \
1008 V(JSPromise) \ 1010 V(JSPromise) \
1011 V(JSStringIterator) \
1009 V(JSSet) \ 1012 V(JSSet) \
1010 V(JSMap) \ 1013 V(JSMap) \
1011 V(JSSetIterator) \ 1014 V(JSSetIterator) \
1012 V(JSMapIterator) \ 1015 V(JSMapIterator) \
1013 V(JSWeakCollection) \ 1016 V(JSWeakCollection) \
1014 V(JSWeakMap) \ 1017 V(JSWeakMap) \
1015 V(JSWeakSet) \ 1018 V(JSWeakSet) \
1016 V(JSRegExp) \ 1019 V(JSRegExp) \
1017 V(HashTable) \ 1020 V(HashTable) \
1018 V(Dictionary) \ 1021 V(Dictionary) \
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 private: 2608 private:
2606 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataPropertyDescriptor); 2609 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataPropertyDescriptor);
2607 }; 2610 };
2608 2611
2609 2612
2610 // JSIteratorResult is just a JSObject with a specific initial map. 2613 // JSIteratorResult is just a JSObject with a specific initial map.
2611 // This initial map adds in-object properties for "done" and "value", 2614 // This initial map adds in-object properties for "done" and "value",
2612 // as specified by ES6 section 25.1.1.3 The IteratorResult Interface 2615 // as specified by ES6 section 25.1.1.3 The IteratorResult Interface
2613 class JSIteratorResult: public JSObject { 2616 class JSIteratorResult: public JSObject {
2614 public: 2617 public:
2618 DECL_ACCESSORS(value, Object)
2619
2620 DECL_ACCESSORS(done, Object)
2621
2615 // Offsets of object fields. 2622 // Offsets of object fields.
2616 static const int kValueOffset = JSObject::kHeaderSize; 2623 static const int kValueOffset = JSObject::kHeaderSize;
2617 static const int kDoneOffset = kValueOffset + kPointerSize; 2624 static const int kDoneOffset = kValueOffset + kPointerSize;
2618 static const int kSize = kDoneOffset + kPointerSize; 2625 static const int kSize = kDoneOffset + kPointerSize;
2619 // Indices of in-object properties. 2626 // Indices of in-object properties.
2620 static const int kValueIndex = 0; 2627 static const int kValueIndex = 0;
2621 static const int kDoneIndex = 1; 2628 static const int kDoneIndex = 1;
2622 2629
2623 private: 2630 private:
2624 DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult); 2631 DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult);
(...skipping 7608 matching lines...) Expand 10 before | Expand all | Expand 10 after
10233 static void Clear(Handle<JSMap> map); 10240 static void Clear(Handle<JSMap> map);
10234 10241
10235 // Dispatched behavior. 10242 // Dispatched behavior.
10236 DECLARE_PRINTER(JSMap) 10243 DECLARE_PRINTER(JSMap)
10237 DECLARE_VERIFIER(JSMap) 10244 DECLARE_VERIFIER(JSMap)
10238 10245
10239 private: 10246 private:
10240 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10247 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
10241 }; 10248 };
10242 10249
10250 class JSStringIterator : public JSObject {
10251 public:
10252 // Dispatched behavior.
10253 DECLARE_PRINTER(JSStringIterator)
10254 DECLARE_VERIFIER(JSStringIterator)
10255
10256 DECLARE_CAST(JSStringIterator)
10257
10258 // [string]: the [[IteratedString]] internal field.
10259 DECL_ACCESSORS(string, String)
10260
10261 // [index]: The [[StringIteratorNextIndex]] internal field.
10262 inline int index() const;
10263 inline void set_index(int value);
10264
10265 static const int kStringOffset = JSObject::kHeaderSize;
10266 static const int kNextIndexOffset = kStringOffset + kPointerSize;
10267 static const int kSize = kNextIndexOffset + kPointerSize;
10268
10269 private:
10270 // Used by verifier
10271 DECL_ACCESSORS(index_object, Object)
Benedikt Meurer 2016/09/19 04:05:18 You don't need this, the index() accessor does Smi
caitp 2016/09/19 16:03:05 Done.
10272
10273 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
10274 };
10243 10275
10244 // OrderedHashTableIterator is an iterator that iterates over the keys and 10276 // OrderedHashTableIterator is an iterator that iterates over the keys and
10245 // values of an OrderedHashTable. 10277 // values of an OrderedHashTable.
10246 // 10278 //
10247 // The iterator has a reference to the underlying OrderedHashTable data, 10279 // The iterator has a reference to the underlying OrderedHashTable data,
10248 // [table], as well as the current [index] the iterator is at. 10280 // [table], as well as the current [index] the iterator is at.
10249 // 10281 //
10250 // When the OrderedHashTable is rehashed it adds a reference from the old table 10282 // When the OrderedHashTable is rehashed it adds a reference from the old table
10251 // to the new table as well as storing enough data about the changes so that the 10283 // to the new table as well as storing enough data about the changes so that the
10252 // iterator [index] can be adjusted accordingly. 10284 // iterator [index] can be adjusted accordingly.
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
11282 } 11314 }
11283 return value; 11315 return value;
11284 } 11316 }
11285 }; 11317 };
11286 11318
11287 11319
11288 } // NOLINT, false-positive due to second-order macros. 11320 } // NOLINT, false-positive due to second-order macros.
11289 } // NOLINT, false-positive due to second-order macros. 11321 } // NOLINT, false-positive due to second-order macros.
11290 11322
11291 #endif // V8_OBJECTS_H_ 11323 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698