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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index de3026eefca666af7091ca20f1b5a8888ffa7afc..2565cf1dad773f275246f76cce0db86079f34341 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -432,6 +432,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_PROMISE_TYPE) \
V(JS_REGEXP_TYPE) \
V(JS_ERROR_TYPE) \
+ V(JS_STRING_ITERATOR_TYPE) \
\
V(JS_BOUND_FUNCTION_TYPE) \
V(JS_FUNCTION_TYPE) \
@@ -724,6 +725,7 @@ enum InstanceType {
JS_PROMISE_TYPE,
JS_REGEXP_TYPE,
JS_ERROR_TYPE,
+ JS_STRING_ITERATOR_TYPE,
JS_BOUND_FUNCTION_TYPE,
JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
@@ -1006,6 +1008,7 @@ template <class C> inline bool Is(Object* obj);
V(JSProxy) \
V(JSError) \
V(JSPromise) \
+ V(JSStringIterator) \
V(JSSet) \
V(JSMap) \
V(JSSetIterator) \
@@ -2612,6 +2615,10 @@ class JSDataPropertyDescriptor: public JSObject {
// as specified by ES6 section 25.1.1.3 The IteratorResult Interface
class JSIteratorResult: public JSObject {
public:
+ DECL_ACCESSORS(value, Object)
+
+ DECL_ACCESSORS(done, Object)
+
// Offsets of object fields.
static const int kValueOffset = JSObject::kHeaderSize;
static const int kDoneOffset = kValueOffset + kPointerSize;
@@ -10240,6 +10247,31 @@ class JSMap : public JSCollection {
DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
};
+class JSStringIterator : public JSObject {
+ public:
+ // Dispatched behavior.
+ DECLARE_PRINTER(JSStringIterator)
+ DECLARE_VERIFIER(JSStringIterator)
+
+ DECLARE_CAST(JSStringIterator)
+
+ // [string]: the [[IteratedString]] internal field.
+ DECL_ACCESSORS(string, String)
+
+ // [index]: The [[StringIteratorNextIndex]] internal field.
+ inline int index() const;
+ inline void set_index(int value);
+
+ static const int kStringOffset = JSObject::kHeaderSize;
+ static const int kNextIndexOffset = kStringOffset + kPointerSize;
+ static const int kSize = kNextIndexOffset + kPointerSize;
+
+ private:
+ // Used by verifier
+ 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.
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
+};
// OrderedHashTableIterator is an iterator that iterates over the keys and
// values of an OrderedHashTable.

Powered by Google App Engine
This is Rietveld 408576698