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

Side by Side Diff: src/objects.h

Issue 1302173007: [es6] Introduce a dedicated JSIteratorResult type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 V(JS_GLOBAL_PROXY_TYPE) \ 424 V(JS_GLOBAL_PROXY_TYPE) \
425 V(JS_ARRAY_TYPE) \ 425 V(JS_ARRAY_TYPE) \
426 V(JS_ARRAY_BUFFER_TYPE) \ 426 V(JS_ARRAY_BUFFER_TYPE) \
427 V(JS_TYPED_ARRAY_TYPE) \ 427 V(JS_TYPED_ARRAY_TYPE) \
428 V(JS_DATA_VIEW_TYPE) \ 428 V(JS_DATA_VIEW_TYPE) \
429 V(JS_PROXY_TYPE) \ 429 V(JS_PROXY_TYPE) \
430 V(JS_SET_TYPE) \ 430 V(JS_SET_TYPE) \
431 V(JS_MAP_TYPE) \ 431 V(JS_MAP_TYPE) \
432 V(JS_SET_ITERATOR_TYPE) \ 432 V(JS_SET_ITERATOR_TYPE) \
433 V(JS_MAP_ITERATOR_TYPE) \ 433 V(JS_MAP_ITERATOR_TYPE) \
434 V(JS_ITERATOR_RESULT_TYPE) \
434 V(JS_WEAK_MAP_TYPE) \ 435 V(JS_WEAK_MAP_TYPE) \
435 V(JS_WEAK_SET_TYPE) \ 436 V(JS_WEAK_SET_TYPE) \
436 V(JS_REGEXP_TYPE) \ 437 V(JS_REGEXP_TYPE) \
437 \ 438 \
438 V(JS_FUNCTION_TYPE) \ 439 V(JS_FUNCTION_TYPE) \
439 V(JS_FUNCTION_PROXY_TYPE) \ 440 V(JS_FUNCTION_PROXY_TYPE) \
440 V(DEBUG_INFO_TYPE) \ 441 V(DEBUG_INFO_TYPE) \
441 V(BREAK_POINT_INFO_TYPE) 442 V(BREAK_POINT_INFO_TYPE)
442 443
443 444
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 JS_BUILTINS_OBJECT_TYPE, 723 JS_BUILTINS_OBJECT_TYPE,
723 JS_GLOBAL_PROXY_TYPE, 724 JS_GLOBAL_PROXY_TYPE,
724 JS_ARRAY_TYPE, 725 JS_ARRAY_TYPE,
725 JS_ARRAY_BUFFER_TYPE, 726 JS_ARRAY_BUFFER_TYPE,
726 JS_TYPED_ARRAY_TYPE, 727 JS_TYPED_ARRAY_TYPE,
727 JS_DATA_VIEW_TYPE, 728 JS_DATA_VIEW_TYPE,
728 JS_SET_TYPE, 729 JS_SET_TYPE,
729 JS_MAP_TYPE, 730 JS_MAP_TYPE,
730 JS_SET_ITERATOR_TYPE, 731 JS_SET_ITERATOR_TYPE,
731 JS_MAP_ITERATOR_TYPE, 732 JS_MAP_ITERATOR_TYPE,
733 JS_ITERATOR_RESULT_TYPE,
732 JS_WEAK_MAP_TYPE, 734 JS_WEAK_MAP_TYPE,
733 JS_WEAK_SET_TYPE, 735 JS_WEAK_SET_TYPE,
734 JS_REGEXP_TYPE, 736 JS_REGEXP_TYPE,
735 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 737 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
736 738
737 // Pseudo-types 739 // Pseudo-types
738 FIRST_TYPE = 0x0, 740 FIRST_TYPE = 0x0,
739 LAST_TYPE = JS_FUNCTION_TYPE, 741 LAST_TYPE = JS_FUNCTION_TYPE,
740 FIRST_NAME_TYPE = FIRST_TYPE, 742 FIRST_NAME_TYPE = FIRST_TYPE,
741 LAST_NAME_TYPE = SYMBOL_TYPE, 743 LAST_NAME_TYPE = SYMBOL_TYPE,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 V(JSArrayBuffer) \ 952 V(JSArrayBuffer) \
951 V(JSArrayBufferView) \ 953 V(JSArrayBufferView) \
952 V(JSTypedArray) \ 954 V(JSTypedArray) \
953 V(JSDataView) \ 955 V(JSDataView) \
954 V(JSProxy) \ 956 V(JSProxy) \
955 V(JSFunctionProxy) \ 957 V(JSFunctionProxy) \
956 V(JSSet) \ 958 V(JSSet) \
957 V(JSMap) \ 959 V(JSMap) \
958 V(JSSetIterator) \ 960 V(JSSetIterator) \
959 V(JSMapIterator) \ 961 V(JSMapIterator) \
962 V(JSIteratorResult) \
960 V(JSWeakCollection) \ 963 V(JSWeakCollection) \
961 V(JSWeakMap) \ 964 V(JSWeakMap) \
962 V(JSWeakSet) \ 965 V(JSWeakSet) \
963 V(JSRegExp) \ 966 V(JSRegExp) \
964 V(HashTable) \ 967 V(HashTable) \
965 V(Dictionary) \ 968 V(Dictionary) \
966 V(StringTable) \ 969 V(StringTable) \
967 V(NormalizedMapCache) \ 970 V(NormalizedMapCache) \
968 V(CompilationCacheTable) \ 971 V(CompilationCacheTable) \
969 V(CodeCacheHashTable) \ 972 V(CodeCacheHashTable) \
(...skipping 5874 matching lines...) Expand 10 before | Expand all | Expand 10 after
6844 static const int kFunctionOffset = JSObject::kHeaderSize; 6847 static const int kFunctionOffset = JSObject::kHeaderSize;
6845 static const int kContextOffset = kFunctionOffset + kPointerSize; 6848 static const int kContextOffset = kFunctionOffset + kPointerSize;
6846 static const int kReceiverOffset = kContextOffset + kPointerSize; 6849 static const int kReceiverOffset = kContextOffset + kPointerSize;
6847 static const int kContinuationOffset = kReceiverOffset + kPointerSize; 6850 static const int kContinuationOffset = kReceiverOffset + kPointerSize;
6848 static const int kOperandStackOffset = kContinuationOffset + kPointerSize; 6851 static const int kOperandStackOffset = kContinuationOffset + kPointerSize;
6849 static const int kSize = kOperandStackOffset + kPointerSize; 6852 static const int kSize = kOperandStackOffset + kPointerSize;
6850 6853
6851 // Resume mode, for use by runtime functions. 6854 // Resume mode, for use by runtime functions.
6852 enum ResumeMode { NEXT, THROW }; 6855 enum ResumeMode { NEXT, THROW };
6853 6856
6854 // Yielding from a generator returns an object with the following inobject
6855 // properties. See Context::iterator_result_map() for the map.
6856 static const int kResultValuePropertyIndex = 0;
6857 static const int kResultDonePropertyIndex = 1;
6858 static const int kResultPropertyCount = 2;
6859
6860 static const int kResultValuePropertyOffset = JSObject::kHeaderSize;
6861 static const int kResultDonePropertyOffset =
6862 kResultValuePropertyOffset + kPointerSize;
6863 static const int kResultSize = kResultDonePropertyOffset + kPointerSize;
6864
6865 private: 6857 private:
6866 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); 6858 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
6867 }; 6859 };
6868 6860
6869 6861
6870 // Representation for module instance objects. 6862 // Representation for module instance objects.
6871 class JSModule: public JSObject { 6863 class JSModule: public JSObject {
6872 public: 6864 public:
6873 // [context]: the context holding the module's locals, or undefined if none. 6865 // [context]: the context holding the module's locals, or undefined if none.
6874 DECL_ACCESSORS(context, Object) 6866 DECL_ACCESSORS(context, Object)
(...skipping 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after
9473 9465
9474 private: 9466 private:
9475 // Returns the current value of the iterator. This should only be called when 9467 // Returns the current value of the iterator. This should only be called when
9476 // |HasMore| returns true. 9468 // |HasMore| returns true.
9477 inline Object* CurrentValue(); 9469 inline Object* CurrentValue();
9478 9470
9479 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator); 9471 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMapIterator);
9480 }; 9472 };
9481 9473
9482 9474
9475 // ES6 section 25.1.1.3 The IteratorResult Interface
9476 class JSIteratorResult final : public JSObject {
9477 public:
9478 // [done]: This is the result status of an iterator next method call. If the
9479 // end of the iterator was reached done is true. If the end was not reached
9480 // done is false and a [value] is available.
9481 DECL_ACCESSORS(done, Object)
9482
9483 // [value]: If [done] is false, this is the current iteration element value.
9484 // If [done] is true, this is the return value of the iterator, if it supplied
9485 // one. If the iterator does not have a return value, value is undefined.
9486 // In that case, the value property may be absent from the conforming object
9487 // if it does not inherit an explicit value property.
9488 DECL_ACCESSORS(value, Object)
9489
9490 // Dispatched behavior.
9491 DECLARE_PRINTER(JSIteratorResult)
9492 DECLARE_VERIFIER(JSIteratorResult)
9493
9494 DECLARE_CAST(JSIteratorResult)
9495
9496 static const int kValueOffset = JSObject::kHeaderSize;
9497 static const int kDoneOffset = kValueOffset + kPointerSize;
9498 static const int kSize = kDoneOffset + kPointerSize;
9499
9500 // Indices of in-object properties.
9501 static const int kValueIndex = 0;
9502 static const int kDoneIndex = 1;
9503
9504 private:
9505 DISALLOW_IMPLICIT_CONSTRUCTORS(JSIteratorResult);
9506 };
9507
9508
9483 // Base class for both JSWeakMap and JSWeakSet 9509 // Base class for both JSWeakMap and JSWeakSet
9484 class JSWeakCollection: public JSObject { 9510 class JSWeakCollection: public JSObject {
9485 public: 9511 public:
9486 // [table]: the backing hash table mapping keys to values. 9512 // [table]: the backing hash table mapping keys to values.
9487 DECL_ACCESSORS(table, Object) 9513 DECL_ACCESSORS(table, Object)
9488 9514
9489 // [next]: linked list of encountered weak maps during GC. 9515 // [next]: linked list of encountered weak maps during GC.
9490 DECL_ACCESSORS(next, Object) 9516 DECL_ACCESSORS(next, Object)
9491 9517
9492 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); 9518 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate);
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
10379 } else { 10405 } else {
10380 value &= ~(1 << bit_position); 10406 value &= ~(1 << bit_position);
10381 } 10407 }
10382 return value; 10408 return value;
10383 } 10409 }
10384 }; 10410 };
10385 10411
10386 } } // namespace v8::internal 10412 } } // namespace v8::internal
10387 10413
10388 #endif // V8_OBJECTS_H_ 10414 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698