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

Unified Diff: src/objects.h

Issue 2407423002: [modules] Implement @@iterator on namespace objects. (Closed)
Patch Set: Created 4 years, 2 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 d02c04dbc0337d20fd56c9ea6dc2cae554b868aa..1c89d5a233aad697ff86772baf3d13e662481051 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -72,6 +72,7 @@
// - JSDate
// - JSMessageObject
// - JSModuleNamespace
+// - JSFixedArrayIterator
// - JSProxy
// - FixedArrayBase
// - ByteArray
@@ -418,6 +419,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
V(JS_GENERATOR_OBJECT_TYPE) \
V(JS_MODULE_NAMESPACE_TYPE) \
+ V(JS_FIXED_ARRAY_ITERATOR_TYPE) \
V(JS_GLOBAL_OBJECT_TYPE) \
V(JS_GLOBAL_PROXY_TYPE) \
V(JS_API_OBJECT_TYPE) \
@@ -720,6 +722,7 @@ enum InstanceType {
JS_CONTEXT_EXTENSION_OBJECT_TYPE,
JS_GENERATOR_OBJECT_TYPE,
JS_MODULE_NAMESPACE_TYPE,
+ JS_FIXED_ARRAY_ITERATOR_TYPE,
JS_ARRAY_TYPE,
JS_ARRAY_BUFFER_TYPE,
JS_TYPED_ARRAY_TYPE,
@@ -975,6 +978,7 @@ template <class C> inline bool Is(Object* obj);
V(JSContextExtensionObject) \
V(JSGeneratorObject) \
V(JSModuleNamespace) \
+ V(JSFixedArrayIterator) \
V(Map) \
V(DescriptorArray) \
V(FrameArray) \
@@ -10410,6 +10414,34 @@ class JSStringIterator : public JSObject {
DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
};
+// A JS iterator over the elements of a FixedArray.
+// This corresponds to ListIterator in ecma262/#sec-createlistiterator.
+class JSFixedArrayIterator : public JSObject {
+ public:
+ DECLARE_CAST(JSFixedArrayIterator)
+ DECLARE_PRINTER(JSFixedArrayIterator)
+ DECLARE_VERIFIER(JSFixedArrayIterator)
+
+ // The value of the object's "next" property.
+ DECL_ACCESSORS(next, JSFunction)
+
+ // The array over which the iterator iterates.
+ DECL_ACCESSORS(array, FixedArray)
+
+ // The index of the array element that will be returned next.
+ DECL_INT_ACCESSORS(index)
+
+ static const int kNextOffset = JSObject::kHeaderSize;
+ static const int kArrayOffset = kNextOffset + kPointerSize;
+ static const int kIndexOffset = kArrayOffset + kPointerSize;
+ static const int kSize = kIndexOffset + kPointerSize;
+
+ enum InObjectPropertyIndex { kNextIndex };
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSFixedArrayIterator);
+};
+
// OrderedHashTableIterator is an iterator that iterates over the keys and
// values of an OrderedHashTable.
//

Powered by Google App Engine
This is Rietveld 408576698