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

Unified Diff: src/objects.h

Issue 1680513002: [runtime] We don't need an actual instance type for JSIteratorResult. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 209226322c1e87c29aeb4f25653d33b3d534e334..2d910e75a0d7eab1699c74e7cfc57b5aa1c5fe91 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -429,7 +429,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_MAP_TYPE) \
V(JS_SET_ITERATOR_TYPE) \
V(JS_MAP_ITERATOR_TYPE) \
- V(JS_ITERATOR_RESULT_TYPE) \
V(JS_WEAK_MAP_TYPE) \
V(JS_WEAK_SET_TYPE) \
V(JS_PROMISE_TYPE) \
@@ -723,7 +722,6 @@ enum InstanceType {
JS_MAP_TYPE,
JS_SET_ITERATOR_TYPE,
JS_MAP_ITERATOR_TYPE,
- JS_ITERATOR_RESULT_TYPE,
JS_WEAK_MAP_TYPE,
JS_WEAK_SET_TYPE,
JS_PROMISE_TYPE,
@@ -963,7 +961,6 @@ template <class C> inline bool Is(Object* obj);
V(JSMap) \
V(JSSetIterator) \
V(JSMapIterator) \
- V(JSIteratorResult) \
V(JSWeakCollection) \
V(JSWeakMap) \
V(JSWeakSet) \
@@ -2600,6 +2597,24 @@ class JSDataPropertyDescriptor: public JSObject {
};
+// JSIteratorResult is just a JSObject with a specific initial map.
+// This initial map adds in-object properties for "done" and "value,
+// as specified by ES6 section 25.1.1.3 The IteratorResult Interface
+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 :-)
+ public:
+ // Offsets of object fields.
+ static const int kValueOffset = JSObject::kHeaderSize;
+ static const int kDoneOffset = kValueOffset + kPointerSize;
+ static const int kSize = kDoneOffset + kPointerSize;
+ // Indices of in-object properties.
+ static const int kValueIndex = 0;
+ static const int kDoneIndex = 1;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult);
+};
+
+
// Common superclass for FixedArrays that allow implementations to share
// common accessors and some code paths.
class FixedArrayBase: public HeapObject {
@@ -9880,40 +9895,6 @@ class JSMapIterator: public OrderedHashTableIterator<JSMapIterator,
};
-// ES6 section 25.1.1.3 The IteratorResult Interface
-class JSIteratorResult final : public JSObject {
- public:
- // [done]: This is the result status of an iterator next method call. If the
- // end of the iterator was reached done is true. If the end was not reached
- // done is false and a [value] is available.
- DECL_ACCESSORS(done, Object)
-
- // [value]: If [done] is false, this is the current iteration element value.
- // If [done] is true, this is the return value of the iterator, if it supplied
- // one. If the iterator does not have a return value, value is undefined.
- // In that case, the value property may be absent from the conforming object
- // if it does not inherit an explicit value property.
- DECL_ACCESSORS(value, Object)
-
- // Dispatched behavior.
- DECLARE_PRINTER(JSIteratorResult)
- DECLARE_VERIFIER(JSIteratorResult)
-
- DECLARE_CAST(JSIteratorResult)
-
- static const int kValueOffset = JSObject::kHeaderSize;
- static const int kDoneOffset = kValueOffset + kPointerSize;
- static const int kSize = kDoneOffset + kPointerSize;
-
- // Indices of in-object properties.
- static const int kValueIndex = 0;
- static const int kDoneIndex = 1;
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult);
-};
-
-
// Base class for both JSWeakMap and JSWeakSet
class JSWeakCollection: public JSObject {
public:
« no previous file with comments | « src/heap/objects-visiting.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698