summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/objects.h')
-rw-r--r--deps/v8/src/objects.h1282
1 files changed, 537 insertions, 745 deletions
diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h
index 747a4f0511..f9b696aff5 100644
--- a/deps/v8/src/objects.h
+++ b/deps/v8/src/objects.h
@@ -38,6 +38,8 @@
#include "src/s390/constants-s390.h" // NOLINT
#endif
+// Has to be the last include (doesn't have include guards):
+#include "src/objects/object-macros.h"
//
// Most object types in the V8 JavaScript are described in this file.
@@ -72,7 +74,6 @@
// - JSDate
// - JSMessageObject
// - JSModuleNamespace
-// - JSFixedArrayIterator
// - JSProxy
// - FixedArrayBase
// - ByteArray
@@ -181,10 +182,6 @@ enum KeyedAccessStoreMode {
STORE_NO_TRANSITION_HANDLE_COW
};
-
-enum TypeofMode : int { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF };
-
-
enum MutableMode {
MUTABLE,
IMMUTABLE
@@ -244,10 +241,6 @@ enum WriteBarrierMode {
};
-// Indicates whether a value can be loaded as a constant.
-enum StoreMode { ALLOW_IN_DESCRIPTOR, FORCE_FIELD };
-
-
// PropertyNormalizationMode is used to specify whether to keep
// inobject properties when normalizing properties of a JSObject.
enum PropertyNormalizationMode {
@@ -288,19 +281,6 @@ enum DescriptorFlag {
OWN_DESCRIPTORS
};
-// The GC maintains a bit of information, the MarkingParity, which toggles
-// from odd to even and back every time marking is completed. Incremental
-// marking can visit an object twice during a marking phase, so algorithms that
-// that piggy-back on marking can use the parity to ensure that they only
-// perform an operation on an object once per marking phase: they record the
-// MarkingParity when they visit an object, and only re-visit the object when it
-// is marked again and the MarkingParity changes.
-enum MarkingParity {
- NO_MARKING_PARITY,
- ODD_MARKING_PARITY,
- EVEN_MARKING_PARITY
-};
-
// ICs store extra state in a Code object. The default extra state is
// kNoExtraICState.
typedef int ExtraICState;
@@ -338,38 +318,34 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
// JSObject for GC purposes. The first four entries here have typeof
// 'object', whereas JS_FUNCTION_TYPE has typeof 'function'.
#define INSTANCE_TYPE_LIST(V) \
+ V(INTERNALIZED_STRING_TYPE) \
+ V(EXTERNAL_INTERNALIZED_STRING_TYPE) \
+ V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \
+ V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
+ V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
+ V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
+ V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
+ V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
V(STRING_TYPE) \
- V(ONE_BYTE_STRING_TYPE) \
V(CONS_STRING_TYPE) \
- V(CONS_ONE_BYTE_STRING_TYPE) \
- V(SLICED_STRING_TYPE) \
- V(SLICED_ONE_BYTE_STRING_TYPE) \
V(EXTERNAL_STRING_TYPE) \
+ V(SLICED_STRING_TYPE) \
+ V(ONE_BYTE_STRING_TYPE) \
+ V(CONS_ONE_BYTE_STRING_TYPE) \
V(EXTERNAL_ONE_BYTE_STRING_TYPE) \
+ V(SLICED_ONE_BYTE_STRING_TYPE) \
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
V(SHORT_EXTERNAL_STRING_TYPE) \
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \
V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
\
- V(INTERNALIZED_STRING_TYPE) \
- V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \
- V(EXTERNAL_INTERNALIZED_STRING_TYPE) \
- V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
- V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
- V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
- V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \
- V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
- \
V(SYMBOL_TYPE) \
+ V(HEAP_NUMBER_TYPE) \
V(SIMD128_VALUE_TYPE) \
+ V(ODDBALL_TYPE) \
\
V(MAP_TYPE) \
V(CODE_TYPE) \
- V(ODDBALL_TYPE) \
- V(CELL_TYPE) \
- V(PROPERTY_CELL_TYPE) \
- \
- V(HEAP_NUMBER_TYPE) \
V(MUTABLE_HEAP_NUMBER_TYPE) \
V(FOREIGN_TYPE) \
V(BYTE_ARRAY_TYPE) \
@@ -386,6 +362,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(FIXED_FLOAT64_ARRAY_TYPE) \
V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \
\
+ V(FIXED_DOUBLE_ARRAY_TYPE) \
V(FILLER_TYPE) \
\
V(ACCESSOR_INFO_TYPE) \
@@ -395,53 +372,54 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(CALL_HANDLER_INFO_TYPE) \
V(FUNCTION_TEMPLATE_INFO_TYPE) \
V(OBJECT_TEMPLATE_INFO_TYPE) \
- V(SIGNATURE_INFO_TYPE) \
- V(TYPE_SWITCH_INFO_TYPE) \
- V(ALLOCATION_MEMENTO_TYPE) \
V(ALLOCATION_SITE_TYPE) \
+ V(ALLOCATION_MEMENTO_TYPE) \
V(SCRIPT_TYPE) \
V(TYPE_FEEDBACK_INFO_TYPE) \
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
V(BOX_TYPE) \
V(PROMISE_RESOLVE_THENABLE_JOB_INFO_TYPE) \
V(PROMISE_REACTION_JOB_INFO_TYPE) \
+ V(DEBUG_INFO_TYPE) \
+ V(BREAK_POINT_INFO_TYPE) \
V(PROTOTYPE_INFO_TYPE) \
+ V(TUPLE2_TYPE) \
V(TUPLE3_TYPE) \
V(CONTEXT_EXTENSION_TYPE) \
+ V(CONSTANT_ELEMENTS_PAIR_TYPE) \
V(MODULE_TYPE) \
V(MODULE_INFO_ENTRY_TYPE) \
- \
V(FIXED_ARRAY_TYPE) \
- V(FIXED_DOUBLE_ARRAY_TYPE) \
+ V(TRANSITION_ARRAY_TYPE) \
V(SHARED_FUNCTION_INFO_TYPE) \
+ V(CELL_TYPE) \
V(WEAK_CELL_TYPE) \
- V(TRANSITION_ARRAY_TYPE) \
- \
- V(JS_MESSAGE_OBJECT_TYPE) \
+ V(PROPERTY_CELL_TYPE) \
\
+ V(JS_PROXY_TYPE) \
+ V(JS_GLOBAL_OBJECT_TYPE) \
+ V(JS_GLOBAL_PROXY_TYPE) \
+ V(JS_SPECIAL_API_OBJECT_TYPE) \
V(JS_VALUE_TYPE) \
+ V(JS_MESSAGE_OBJECT_TYPE) \
V(JS_DATE_TYPE) \
+ V(JS_API_OBJECT_TYPE) \
V(JS_OBJECT_TYPE) \
V(JS_ARGUMENTS_TYPE) \
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) \
- V(JS_SPECIAL_API_OBJECT_TYPE) \
V(JS_ARRAY_TYPE) \
V(JS_ARRAY_BUFFER_TYPE) \
V(JS_TYPED_ARRAY_TYPE) \
V(JS_DATA_VIEW_TYPE) \
- V(JS_PROXY_TYPE) \
V(JS_SET_TYPE) \
V(JS_MAP_TYPE) \
V(JS_SET_ITERATOR_TYPE) \
V(JS_MAP_ITERATOR_TYPE) \
V(JS_WEAK_MAP_TYPE) \
V(JS_WEAK_SET_TYPE) \
+ V(JS_PROMISE_CAPABILITY_TYPE) \
V(JS_PROMISE_TYPE) \
V(JS_REGEXP_TYPE) \
V(JS_ERROR_TYPE) \
@@ -451,12 +429,12 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_FAST_ARRAY_KEY_ITERATOR_TYPE) \
V(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE) \
\
- V(JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_UINT8_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
- V(JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT8_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_UINT16_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
- V(JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT16_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_UINT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_FLOAT32_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_FLOAT64_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
@@ -469,12 +447,12 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
V(JS_GENERIC_ARRAY_KEY_VALUE_ITERATOR_TYPE) \
\
- V(JS_INT8_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_UINT8_ARRAY_VALUE_ITERATOR_TYPE) \
- V(JS_INT16_ARRAY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT8_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_UINT16_ARRAY_VALUE_ITERATOR_TYPE) \
- V(JS_INT32_ARRAY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT16_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_UINT32_ARRAY_VALUE_ITERATOR_TYPE) \
+ V(JS_INT32_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_FLOAT32_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE) \
V(JS_UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_TYPE) \
@@ -488,9 +466,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE) \
\
V(JS_BOUND_FUNCTION_TYPE) \
- V(JS_FUNCTION_TYPE) \
- V(DEBUG_INFO_TYPE) \
- V(BREAK_POINT_INFO_TYPE)
+ V(JS_FUNCTION_TYPE)
// Since string types are not consecutive, this macro is used to
// iterate over them.
@@ -553,11 +529,6 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
// type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
// manually.
#define STRUCT_LIST(V) \
- V(BOX, Box, box) \
- V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \
- promise_resolve_thenable_job_info) \
- V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \
- promise_reaction_job_info) \
V(ACCESSOR_INFO, AccessorInfo, accessor_info) \
V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
@@ -565,18 +536,25 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
- V(SCRIPT, Script, script) \
V(ALLOCATION_SITE, AllocationSite, allocation_site) \
V(ALLOCATION_MEMENTO, AllocationMemento, allocation_memento) \
+ V(SCRIPT, Script, script) \
V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \
V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
+ V(BOX, Box, box) \
+ V(PROMISE_RESOLVE_THENABLE_JOB_INFO, PromiseResolveThenableJobInfo, \
+ promise_resolve_thenable_job_info) \
+ V(PROMISE_REACTION_JOB_INFO, PromiseReactionJobInfo, \
+ promise_reaction_job_info) \
V(DEBUG_INFO, DebugInfo, debug_info) \
V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \
V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
+ V(TUPLE2, Tuple2, tuple2) \
V(TUPLE3, Tuple3, tuple3) \
+ V(CONTEXT_EXTENSION, ContextExtension, context_extension) \
+ V(CONSTANT_ELEMENTS_PAIR, ConstantElementsPair, constant_elements_pair) \
V(MODULE, Module, module) \
- V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry) \
- V(CONTEXT_EXTENSION, ContextExtension, context_extension)
+ V(MODULE_INFO_ENTRY, ModuleInfoEntry, module_info_entry)
// We use the full 8 bits of the instance_type field to encode heap object
// instance types. The high-order bit (bit 7) is set if the object is not a
@@ -630,7 +608,6 @@ const uint32_t kOneByteDataHintTag = 0x08;
const uint32_t kShortExternalStringMask = 0x10;
const uint32_t kShortExternalStringTag = 0x10;
-
// A ConsString with an empty string as the right side is a candidate
// for being shortcut by the garbage collector. We don't allocate any
// non-flat internalized strings, so we do not shortcut them thereby
@@ -733,8 +710,6 @@ enum InstanceType {
CALL_HANDLER_INFO_TYPE,
FUNCTION_TEMPLATE_INFO_TYPE,
OBJECT_TEMPLATE_INFO_TYPE,
- SIGNATURE_INFO_TYPE,
- TYPE_SWITCH_INFO_TYPE,
ALLOCATION_SITE_TYPE,
ALLOCATION_MEMENTO_TYPE,
SCRIPT_TYPE,
@@ -745,17 +720,19 @@ enum InstanceType {
PROMISE_REACTION_JOB_INFO_TYPE,
DEBUG_INFO_TYPE,
BREAK_POINT_INFO_TYPE,
- FIXED_ARRAY_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
- CELL_TYPE,
- WEAK_CELL_TYPE,
- TRANSITION_ARRAY_TYPE,
- PROPERTY_CELL_TYPE,
PROTOTYPE_INFO_TYPE,
+ TUPLE2_TYPE,
TUPLE3_TYPE,
CONTEXT_EXTENSION_TYPE,
+ CONSTANT_ELEMENTS_PAIR_TYPE,
MODULE_TYPE,
MODULE_INFO_ENTRY_TYPE,
+ FIXED_ARRAY_TYPE,
+ TRANSITION_ARRAY_TYPE,
+ SHARED_FUNCTION_INFO_TYPE,
+ CELL_TYPE,
+ WEAK_CELL_TYPE,
+ PROPERTY_CELL_TYPE,
// All the following types are subtypes of JSReceiver, which corresponds to
// objects in the JS sense. The first and the last type in this range are
@@ -777,7 +754,6 @@ 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,
@@ -788,6 +764,7 @@ enum InstanceType {
JS_MAP_ITERATOR_TYPE,
JS_WEAK_MAP_TYPE,
JS_WEAK_SET_TYPE,
+ JS_PROMISE_CAPABILITY_TYPE,
JS_PROMISE_TYPE,
JS_REGEXP_TYPE,
JS_ERROR_TYPE,
@@ -965,25 +942,6 @@ enum class ComparisonResult {
};
-#define DECL_BOOLEAN_ACCESSORS(name) \
- inline bool name() const; \
- inline void set_##name(bool value);
-
-#define DECL_INT_ACCESSORS(name) \
- inline int name() const; \
- inline void set_##name(int value);
-
-
-#define DECL_ACCESSORS(name, type) \
- inline type* name() const; \
- inline void set_##name(type* value, \
- WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
-
-
-#define DECLARE_CAST(type) \
- INLINE(static type* cast(Object* object)); \
- INLINE(static const type* cast(const Object* object));
-
class AbstractCode;
class AccessorPair;
class AllocationSite;
@@ -1021,12 +979,6 @@ class TemplateList;
// A template-ized version of the IsXXX functions.
template <class C> inline bool Is(Object* obj);
-#ifdef VERIFY_HEAP
-#define DECLARE_VERIFIER(Name) void Name##Verify();
-#else
-#define DECLARE_VERIFIER(Name)
-#endif
-
#ifdef OBJECT_PRINT
#define DECLARE_PRINTER(Name) void Name##Print(std::ostream& os); // NOLINT
#else
@@ -1083,10 +1035,10 @@ template <class C> inline bool Is(Object* obj);
V(FreeSpace) \
V(JSReceiver) \
V(JSObject) \
+ V(JSArgumentsObject) \
V(JSContextExtensionObject) \
V(JSGeneratorObject) \
V(JSModuleNamespace) \
- V(JSFixedArrayIterator) \
V(Map) \
V(DescriptorArray) \
V(FrameArray) \
@@ -1129,6 +1081,7 @@ template <class C> inline bool Is(Object* obj);
V(JSDataView) \
V(JSProxy) \
V(JSError) \
+ V(JSPromiseCapability) \
V(JSPromise) \
V(JSStringIterator) \
V(JSSet) \
@@ -1199,11 +1152,14 @@ class Object {
OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
#undef IS_TYPE_FUNCTION_DECL
+
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
INLINE(bool Is##Type(Isolate* isolate) const);
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
#undef IS_TYPE_FUNCTION_DECL
+ INLINE(bool IsNullOrUndefined(Isolate* isolate) const);
+
// A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
// a keyed store is of the form a[expression] = foo.
enum StoreFromKeyed {
@@ -1313,37 +1269,38 @@ class Object {
Handle<Object> input, ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
// ES6 section 7.1.3 ToNumber
- MUST_USE_RESULT static MaybeHandle<Object> ToNumber(Handle<Object> input);
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToNumber(
+ Handle<Object> input);
// ES6 section 7.1.4 ToInteger
- MUST_USE_RESULT static MaybeHandle<Object> ToInteger(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToInteger(
+ Isolate* isolate, Handle<Object> input);
// ES6 section 7.1.5 ToInt32
- MUST_USE_RESULT static MaybeHandle<Object> ToInt32(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToInt32(
+ Isolate* isolate, Handle<Object> input);
// ES6 section 7.1.6 ToUint32
- MUST_USE_RESULT static MaybeHandle<Object> ToUint32(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT inline static MaybeHandle<Object> ToUint32(
+ Isolate* isolate, Handle<Object> input);
// ES6 section 7.1.12 ToString
- MUST_USE_RESULT static MaybeHandle<String> ToString(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT static inline MaybeHandle<String> ToString(
+ Isolate* isolate, Handle<Object> input);
static Handle<String> NoSideEffectsToString(Isolate* isolate,
Handle<Object> input);
// ES6 section 7.1.14 ToPropertyKey
- MUST_USE_RESULT static MaybeHandle<Object> ToPropertyKey(
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToPropertyKey(
Isolate* isolate, Handle<Object> value);
// ES6 section 7.1.15 ToLength
- MUST_USE_RESULT static MaybeHandle<Object> ToLength(Isolate* isolate,
- Handle<Object> input);
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToLength(
+ Isolate* isolate, Handle<Object> input);
// ES6 section 7.1.17 ToIndex
- MUST_USE_RESULT static MaybeHandle<Object> ToIndex(
+ MUST_USE_RESULT static inline MaybeHandle<Object> ToIndex(
Isolate* isolate, Handle<Object> input,
MessageTemplate::Template error_index);
@@ -1522,6 +1479,11 @@ class Object {
// allow kMaxUInt32.
inline bool ToArrayIndex(uint32_t* index);
+ // Returns true if the result of iterating over the object is the same
+ // (including observable effects) as simply accessing the properties between 0
+ // and length.
+ bool IterationHasObservableEffects();
+
DECLARE_VERIFIER(Object)
#ifdef VERIFY_HEAP
// Verify a pointer is a valid object pointer.
@@ -1530,10 +1492,6 @@ class Object {
inline void VerifyApiCallResultType();
- // ES6 19.1.3.6 Object.prototype.toString
- MUST_USE_RESULT static MaybeHandle<String> ObjectProtoToString(
- Isolate* isolate, Handle<Object> object);
-
// Prints this object without details.
void ShortPrint(FILE* out = stdout);
@@ -1573,6 +1531,23 @@ class Object {
MUST_USE_RESULT static MaybeHandle<Name> ConvertToName(Isolate* isolate,
Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToPropertyKey(
+ Isolate* isolate, Handle<Object> value);
+ MUST_USE_RESULT static MaybeHandle<String> ConvertToString(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToNumber(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToInteger(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToInt32(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToUint32(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToLength(
+ Isolate* isolate, Handle<Object> input);
+ MUST_USE_RESULT static MaybeHandle<Object> ConvertToIndex(
+ Isolate* isolate, Handle<Object> input,
+ MessageTemplate::Template error_index);
DISALLOW_IMPLICIT_CONSTRUCTORS(Object);
};
@@ -1600,6 +1575,10 @@ class Smi: public Object {
public:
// Returns the integer value.
inline int value() const { return Internals::SmiValue(this); }
+ inline Smi* ToUint32Smi() {
+ if (value() <= 0) return Smi::kZero;
+ return Smi::FromInt(static_cast<uint32_t>(value()));
+ }
// Convert a value to a Smi object.
static inline Smi* FromInt(int value) {
@@ -1626,7 +1605,7 @@ class Smi: public Object {
V8_EXPORT_PRIVATE void SmiPrint(std::ostream& os) const; // NOLINT
DECLARE_VERIFIER(Smi)
- V8_EXPORT_PRIVATE static Smi* const kZero;
+ static constexpr Smi* const kZero = nullptr;
static const int kMinValue =
(static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
static const int kMaxValue = -(kMinValue + 1);
@@ -1725,6 +1704,8 @@ class HeapObject: public Object {
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
#undef IS_TYPE_FUNCTION_DECL
+ INLINE(bool IsNullOrUndefined(Isolate* isolate) const);
+
#define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \
INLINE(bool Is##Name() const);
STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
@@ -2016,6 +1997,12 @@ class JSReceiver: public HeapObject {
MUST_USE_RESULT static Maybe<bool> HasInPrototypeChain(
Isolate* isolate, Handle<JSReceiver> object, Handle<Object> proto);
+ // Reads all enumerable own properties of source and adds them to target,
+ // using either Set or CreateDataProperty depending on the use_set argument.
+ MUST_USE_RESULT static Maybe<bool> SetOrCopyDataProperties(
+ Isolate* isolate, Handle<JSReceiver> target, Handle<Object> source,
+ bool use_set);
+
// Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6.
MUST_USE_RESULT static Maybe<bool> HasProperty(LookupIterator* it);
MUST_USE_RESULT static inline Maybe<bool> HasProperty(
@@ -2570,8 +2557,8 @@ class JSObject: public JSReceiver {
DECLARE_PRINTER(JSObject)
DECLARE_VERIFIER(JSObject)
#ifdef OBJECT_PRINT
- void PrintProperties(std::ostream& os); // NOLINT
- void PrintElements(std::ostream& os); // NOLINT
+ bool PrintProperties(std::ostream& os); // NOLINT
+ bool PrintElements(std::ostream& os); // NOLINT
#endif
#if defined(DEBUG) || defined(OBJECT_PRINT)
void PrintTransitions(std::ostream& os); // NOLINT
@@ -2855,8 +2842,11 @@ class FixedArray: public FixedArrayBase {
// Setters for frequently used oddballs located in old space.
inline void set_undefined(int index);
+ inline void set_undefined(Isolate* isolate, int index);
inline void set_null(int index);
+ inline void set_null(Isolate* isolate, int index);
inline void set_the_hole(int index);
+ inline void set_the_hole(Isolate* isolate, int index);
inline Object** GetFirstElementAddress();
inline bool ContainsOnlySmisOrHoles();
@@ -2898,16 +2888,6 @@ class FixedArray: public FixedArrayBase {
bool IsEqualTo(FixedArray* other);
#endif
- // Swap two elements in a pair of arrays. If this array and the
- // numbers array are the same object, the elements are only swapped
- // once.
- void SwapPairs(FixedArray* numbers, int i, int j);
-
- // Sort prefix of this array and the numbers array as pairs wrt. the
- // numbers. If the numbers array and the this array are the same
- // object, the prefix of this array is sorted.
- void SortPairs(FixedArray* numbers, uint32_t len);
-
typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor;
protected:
@@ -2933,6 +2913,7 @@ class FixedDoubleArray: public FixedArrayBase {
static inline Handle<Object> get(FixedDoubleArray* array, int index,
Isolate* isolate);
inline void set(int index, double value);
+ inline void set_the_hole(Isolate* isolate, int index);
inline void set_the_hole(int index);
// Checking for the hole.
@@ -3147,6 +3128,7 @@ class FrameArray : public FixedArray {
static const int kIsAsmJsWasmFrame = 1 << 1;
static const int kIsStrict = 1 << 2;
static const int kForceConstructor = 1 << 3;
+ static const int kAsmJsAtNumberConversion = 1 << 4;
static Handle<FrameArray> AppendJSFrame(Handle<FrameArray> in,
Handle<Object> receiver,
@@ -3252,24 +3234,23 @@ class DescriptorArray: public FixedArray {
inline Object** GetDescriptorStartSlot(int descriptor_number);
inline Object** GetDescriptorEndSlot(int descriptor_number);
inline PropertyDetails GetDetails(int descriptor_number);
- inline PropertyType GetType(int descriptor_number);
inline int GetFieldIndex(int descriptor_number);
- FieldType* GetFieldType(int descriptor_number);
- inline Object* GetConstant(int descriptor_number);
- inline Object* GetCallbacksObject(int descriptor_number);
- inline AccessorDescriptor* GetCallbacks(int descriptor_number);
+ inline FieldType* GetFieldType(int descriptor_number);
inline Name* GetSortedKey(int descriptor_number);
inline int GetSortedKeyIndex(int descriptor_number);
inline void SetSortedKey(int pointer, int descriptor_number);
- inline void SetRepresentation(int descriptor_number,
- Representation representation);
// Accessor for complete descriptor.
inline void Get(int descriptor_number, Descriptor* desc);
inline void Set(int descriptor_number, Descriptor* desc);
+ inline void Set(int descriptor_number, Name* key, Object* value,
+ PropertyDetails details);
void Replace(int descriptor_number, Descriptor* descriptor);
+ // Generalizes representation and field type of all field descriptors.
+ void GeneralizeAllFields();
+
// Append automatically sets the enumeration index. This should only be used
// to add descriptors in bulk at the end, followed by sorting the descriptor
// array.
@@ -3337,6 +3318,9 @@ class DescriptorArray: public FixedArray {
// Print all the descriptors.
void PrintDescriptors(std::ostream& os); // NOLINT
+
+ void PrintDescriptorDetails(std::ostream& os, int descriptor,
+ PropertyDetails::PrintMode mode);
#endif
#ifdef DEBUG
@@ -3372,26 +3356,10 @@ class DescriptorArray: public FixedArray {
}
private:
- // An entry in a DescriptorArray, represented as an (array, index) pair.
- class Entry {
- public:
- inline explicit Entry(DescriptorArray* descs, int index) :
- descs_(descs), index_(index) { }
-
- inline PropertyType type();
- inline Object* GetCallbackObject();
-
- private:
- DescriptorArray* descs_;
- int index_;
- };
-
// Transfer a complete descriptor from the src descriptor array to this
// descriptor array.
void CopyFrom(int index, DescriptorArray* src);
- inline void SetDescriptor(int descriptor_number, Descriptor* desc);
-
// Swap first and second descriptor.
inline void SwapSortedKeys(int first, int second);
@@ -3593,6 +3561,9 @@ class HashTable : public HashTableBase {
protected:
friend class ObjectHashTable;
+ MUST_USE_RESULT static Handle<Derived> New(Isolate* isolate, int capacity,
+ PretenureFlag pretenure);
+
// Find the entry at which to insert element with the given key that
// has the given hash value.
uint32_t FindInsertionEntry(uint32_t hash);
@@ -3788,6 +3759,10 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
enum SortMode { UNSORTED, SORTED };
+ // Return the key indices sorted by its enumeration index.
+ static Handle<FixedArray> IterationIndices(
+ Handle<Dictionary<Derived, Shape, Key>> dictionary);
+
// Collect the keys into the given KeyAccumulator, in ascending chronological
// order of property creation.
static void CollectKeysTo(Handle<Dictionary<Derived, Shape, Key>> dictionary,
@@ -3814,6 +3789,10 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
PretenureFlag pretenure = NOT_TENURED,
MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY);
+ // Creates an dictionary with minimal possible capacity.
+ MUST_USE_RESULT static Handle<Derived> NewEmpty(
+ Isolate* isolate, PretenureFlag pretenure = NOT_TENURED);
+
// Ensures that a new dictionary is created when the capacity is checked.
void SetRequiresCopyOnCapacityChange();
@@ -3843,14 +3822,11 @@ class Dictionary: public HashTable<Derived, Shape, Key> {
PropertyDetails details,
int* entry_out = nullptr);
- // Returns iteration indices array for the |dictionary|.
- // Values are direct indices in the |HashTable| array.
- static Handle<FixedArray> BuildIterationIndicesArray(
- Handle<Derived> dictionary);
-
static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
+ static const bool kIsEnumerable = Shape::kIsEnumerable;
+
protected:
// Generic at put operation.
MUST_USE_RESULT static Handle<Derived> AtPut(
@@ -4023,18 +3999,20 @@ class SeededNumberDictionary
// Type specific at put (default NONE attributes is used when adding).
MUST_USE_RESULT static Handle<SeededNumberDictionary> AtNumberPut(
Handle<SeededNumberDictionary> dictionary, uint32_t key,
- Handle<Object> value, bool used_as_prototype);
+ Handle<Object> value, Handle<JSObject> dictionary_holder);
MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
Handle<SeededNumberDictionary> dictionary, uint32_t key,
- Handle<Object> value, PropertyDetails details, bool used_as_prototype);
+ Handle<Object> value, PropertyDetails details,
+ Handle<JSObject> dictionary_holder);
// Set an existing entry or add a new one if needed.
// Return the updated dictionary.
MUST_USE_RESULT static Handle<SeededNumberDictionary> Set(
Handle<SeededNumberDictionary> dictionary, uint32_t key,
- Handle<Object> value, PropertyDetails details, bool used_as_prototype);
+ Handle<Object> value, PropertyDetails details,
+ Handle<JSObject> dictionary_holder);
- void UpdateMaxNumberKey(uint32_t key, bool used_as_prototype);
+ void UpdateMaxNumberKey(uint32_t key, Handle<JSObject> dictionary_holder);
// Returns true if the dictionary contains any elements that are non-writable,
// non-configurable, non-enumerable, or have getters/setters.
@@ -4436,314 +4414,6 @@ class WeakHashTable: public HashTable<WeakHashTable,
};
-// ScopeInfo represents information about different scopes of a source
-// program and the allocation of the scope's variables. Scope information
-// is stored in a compressed form in ScopeInfo objects and is used
-// at runtime (stack dumps, deoptimization, etc.).
-
-// This object provides quick access to scope info details for runtime
-// routines.
-class ScopeInfo : public FixedArray {
- public:
- DECLARE_CAST(ScopeInfo)
-
- // Return the type of this scope.
- ScopeType scope_type();
-
- // Does this scope call eval?
- bool CallsEval();
-
- // Return the language mode of this scope.
- LanguageMode language_mode();
-
- // True if this scope is a (var) declaration scope.
- bool is_declaration_scope();
-
- // Does this scope make a sloppy eval call?
- bool CallsSloppyEval() { return CallsEval() && is_sloppy(language_mode()); }
-
- // Return the total number of locals allocated on the stack and in the
- // context. This includes the parameters that are allocated in the context.
- int LocalCount();
-
- // Return the number of stack slots for code. This number consists of two
- // parts:
- // 1. One stack slot per stack allocated local.
- // 2. One stack slot for the function name if it is stack allocated.
- int StackSlotCount();
-
- // Return the number of context slots for code if a context is allocated. This
- // number consists of three parts:
- // 1. Size of fixed header for every context: Context::MIN_CONTEXT_SLOTS
- // 2. One context slot per context allocated local.
- // 3. One context slot for the function name if it is context allocated.
- // Parameters allocated in the context count as context allocated locals. If
- // no contexts are allocated for this scope ContextLength returns 0.
- int ContextLength();
-
- // Does this scope declare a "this" binding?
- bool HasReceiver();
-
- // Does this scope declare a "this" binding, and the "this" binding is stack-
- // or context-allocated?
- bool HasAllocatedReceiver();
-
- // Does this scope declare a "new.target" binding?
- bool HasNewTarget();
-
- // Is this scope the scope of a named function expression?
- bool HasFunctionName();
-
- // Return if this has context allocated locals.
- bool HasHeapAllocatedLocals();
-
- // Return if contexts are allocated for this scope.
- bool HasContext();
-
- // Return if this is a function scope with "use asm".
- inline bool IsAsmModule();
-
- // Return if this is a nested function within an asm module scope.
- inline bool IsAsmFunction();
-
- inline bool HasSimpleParameters();
-
- // Return the function_name if present.
- String* FunctionName();
-
- ModuleInfo* ModuleDescriptorInfo();
-
- // Return the name of the given parameter.
- String* ParameterName(int var);
-
- // Return the name of the given local.
- String* LocalName(int var);
-
- // Return the name of the given stack local.
- String* StackLocalName(int var);
-
- // Return the name of the given stack local.
- int StackLocalIndex(int var);
-
- // Return the name of the given context local.
- String* ContextLocalName(int var);
-
- // Return the mode of the given context local.
- VariableMode ContextLocalMode(int var);
-
- // Return the initialization flag of the given context local.
- InitializationFlag ContextLocalInitFlag(int var);
-
- // Return the initialization flag of the given context local.
- MaybeAssignedFlag ContextLocalMaybeAssignedFlag(int var);
-
- // Return true if this local was introduced by the compiler, and should not be
- // exposed to the user in a debugger.
- static bool VariableIsSynthetic(String* name);
-
- // Lookup support for serialized scope info. Returns the
- // the stack slot index for a given slot name if the slot is
- // present; otherwise returns a value < 0. The name must be an internalized
- // string.
- int StackSlotIndex(String* name);
-
- // Lookup support for serialized scope info. Returns the local context slot
- // index for a given slot name if the slot is present; otherwise
- // returns a value < 0. The name must be an internalized string.
- // If the slot is present and mode != NULL, sets *mode to the corresponding
- // mode for that variable.
- static int ContextSlotIndex(Handle<ScopeInfo> scope_info, Handle<String> name,
- VariableMode* mode, InitializationFlag* init_flag,
- MaybeAssignedFlag* maybe_assigned_flag);
-
- // Lookup metadata of a MODULE-allocated variable. Return 0 if there is no
- // module variable with the given name (the index value of a MODULE variable
- // is never 0).
- int ModuleIndex(Handle<String> name, VariableMode* mode,
- InitializationFlag* init_flag,
- MaybeAssignedFlag* maybe_assigned_flag);
-
- // Lookup the name of a certain context slot by its index.
- String* ContextSlotName(int slot_index);
-
- // Lookup support for serialized scope info. Returns the
- // parameter index for a given parameter name if the parameter is present;
- // otherwise returns a value < 0. The name must be an internalized string.
- int ParameterIndex(String* name);
-
- // Lookup support for serialized scope info. Returns the function context
- // slot index if the function name is present and context-allocated (named
- // function expressions, only), otherwise returns a value < 0. The name
- // must be an internalized string.
- int FunctionContextSlotIndex(String* name);
-
- // Lookup support for serialized scope info. Returns the receiver context
- // slot index if scope has a "this" binding, and the binding is
- // context-allocated. Otherwise returns a value < 0.
- int ReceiverContextSlotIndex();
-
- FunctionKind function_kind();
-
- // Returns true if this ScopeInfo is linked to a outer ScopeInfo.
- bool HasOuterScopeInfo();
-
- // Returns true if this ScopeInfo was created for a debug-evaluate scope.
- bool IsDebugEvaluateScope();
-
- // Can be used to mark a ScopeInfo that looks like a with-scope as actually
- // being a debug-evaluate scope.
- void SetIsDebugEvaluateScope();
-
- // Return the outer ScopeInfo if present.
- ScopeInfo* OuterScopeInfo();
-
-#ifdef DEBUG
- bool Equals(ScopeInfo* other) const;
-#endif
-
- static Handle<ScopeInfo> Create(Isolate* isolate, Zone* zone, Scope* scope,
- MaybeHandle<ScopeInfo> outer_scope);
- static Handle<ScopeInfo> CreateForWithScope(
- Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope);
- static Handle<ScopeInfo> CreateGlobalThisBinding(Isolate* isolate);
-
- // Serializes empty scope info.
- V8_EXPORT_PRIVATE static ScopeInfo* Empty(Isolate* isolate);
-
-#ifdef DEBUG
- void Print();
-#endif
-
- // The layout of the static part of a ScopeInfo is as follows. Each entry is
- // numeric and occupies one array slot.
-// 1. A set of properties of the scope.
-// 2. The number of parameters. For non-function scopes this is 0.
-// 3. The number of non-parameter variables allocated on the stack.
-// 4. The number of non-parameter and parameter variables allocated in the
-// context.
-#define FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(V) \
- V(Flags) \
- V(ParameterCount) \
- V(StackLocalCount) \
- V(ContextLocalCount)
-
-#define FIELD_ACCESSORS(name) \
- inline void Set##name(int value); \
- inline int name();
- FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(FIELD_ACCESSORS)
-#undef FIELD_ACCESSORS
-
- enum {
-#define DECL_INDEX(name) k##name,
- FOR_EACH_SCOPE_INFO_NUMERIC_FIELD(DECL_INDEX)
-#undef DECL_INDEX
- kVariablePartIndex
- };
-
- private:
- // The layout of the variable part of a ScopeInfo is as follows:
- // 1. ParameterNames:
- // This part stores the names of the parameters for function scopes. One
- // slot is used per parameter, so in total this part occupies
- // ParameterCount() slots in the array. For other scopes than function
- // scopes ParameterCount() is 0.
- // 2. StackLocalFirstSlot:
- // Index of a first stack slot for stack local. Stack locals belonging to
- // this scope are located on a stack at slots starting from this index.
- // 3. StackLocalNames:
- // Contains the names of local variables that are allocated on the stack,
- // in increasing order of the stack slot index. First local variable has a
- // stack slot index defined in StackLocalFirstSlot (point 2 above).
- // One slot is used per stack local, so in total this part occupies
- // StackLocalCount() slots in the array.
- // 4. ContextLocalNames:
- // Contains the names of local variables and parameters that are allocated
- // in the context. They are stored in increasing order of the context slot
- // index starting with Context::MIN_CONTEXT_SLOTS. One slot is used per
- // context local, so in total this part occupies ContextLocalCount() slots
- // in the array.
- // 5. ContextLocalInfos:
- // Contains the variable modes and initialization flags corresponding to
- // the context locals in ContextLocalNames. One slot is used per
- // context local, so in total this part occupies ContextLocalCount()
- // slots in the array.
- // 6. ReceiverInfo:
- // If the scope binds a "this" value, one slot is reserved to hold the
- // context or stack slot index for the variable.
- // 7. FunctionNameInfo:
- // If the scope belongs to a named function expression this part contains
- // information about the function variable. It always occupies two array
- // slots: a. The name of the function variable.
- // b. The context or stack slot index for the variable.
- // 8. OuterScopeInfoIndex:
- // The outer scope's ScopeInfo or the hole if there's none.
- // 9. ModuleInfo, ModuleVariableCount, and ModuleVariables:
- // For a module scope, this part contains the ModuleInfo, the number of
- // MODULE-allocated variables, and the metadata of those variables. For
- // non-module scopes it is empty.
- int ParameterNamesIndex();
- int StackLocalFirstSlotIndex();
- int StackLocalNamesIndex();
- int ContextLocalNamesIndex();
- int ContextLocalInfosIndex();
- int ReceiverInfoIndex();
- int FunctionNameInfoIndex();
- int OuterScopeInfoIndex();
- int ModuleInfoIndex();
- int ModuleVariableCountIndex();
- int ModuleVariablesIndex();
-
- int Lookup(Handle<String> name, int start, int end, VariableMode* mode,
- VariableLocation* location, InitializationFlag* init_flag,
- MaybeAssignedFlag* maybe_assigned_flag);
-
- // Get metadata of i-th MODULE-allocated variable, where 0 <= i <
- // ModuleVariableCount. The metadata is returned via out-arguments, which may
- // be nullptr if the corresponding information is not requested
- void ModuleVariable(int i, String** name, int* index,
- VariableMode* mode = nullptr,
- InitializationFlag* init_flag = nullptr,
- MaybeAssignedFlag* maybe_assigned_flag = nullptr);
-
- // Used for the function name variable for named function expressions, and for
- // the receiver.
- enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED };
-
- // Properties of scopes.
- class ScopeTypeField : public BitField<ScopeType, 0, 4> {};
- class CallsEvalField : public BitField<bool, ScopeTypeField::kNext, 1> {};
- STATIC_ASSERT(LANGUAGE_END == 2);
- class LanguageModeField
- : public BitField<LanguageMode, CallsEvalField::kNext, 1> {};
- class DeclarationScopeField
- : public BitField<bool, LanguageModeField::kNext, 1> {};
- class ReceiverVariableField
- : public BitField<VariableAllocationInfo, DeclarationScopeField::kNext,
- 2> {};
- class HasNewTargetField
- : public BitField<bool, ReceiverVariableField::kNext, 1> {};
- class FunctionVariableField
- : public BitField<VariableAllocationInfo, HasNewTargetField::kNext, 2> {};
- class AsmModuleField
- : public BitField<bool, FunctionVariableField::kNext, 1> {};
- class AsmFunctionField : public BitField<bool, AsmModuleField::kNext, 1> {};
- class HasSimpleParametersField
- : public BitField<bool, AsmFunctionField::kNext, 1> {};
- class FunctionKindField
- : public BitField<FunctionKind, HasSimpleParametersField::kNext, 10> {};
- class HasOuterScopeInfoField
- : public BitField<bool, FunctionKindField::kNext, 1> {};
- class IsDebugEvaluateScopeField
- : public BitField<bool, HasOuterScopeInfoField::kNext, 1> {};
-
- // Properties of variables.
- class VariableModeField : public BitField<VariableMode, 0, 3> {};
- class InitFlagField : public BitField<InitializationFlag, 3, 1> {};
- class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {};
-
- friend class ScopeIterator;
-};
-
// The cache for maps used by normalized (dictionary mode) objects.
// Such maps do not have property descriptors, so a typical program
// needs very limited number of distinct normalized maps.
@@ -4815,7 +4485,9 @@ class HandlerTable : public FixedArray {
inline void SetReturnOffset(int index, int value);
inline void SetReturnHandler(int index, int offset);
- // Lookup handler in a table based on ranges.
+ // Lookup handler in a table based on ranges. The {pc_offset} is an offset to
+ // the start of the potentially throwing instruction (using return addresses
+ // for this value would be invalid).
int LookupRange(int pc_offset, int* data, CatchPrediction* prediction);
// Lookup handler in a table based on return addresses.
@@ -4939,6 +4611,17 @@ class PodArray : public ByteArray {
// BytecodeArray represents a sequence of interpreter bytecodes.
class BytecodeArray : public FixedArrayBase {
public:
+#define DECLARE_BYTECODE_AGE_ENUM(X) k##X##BytecodeAge,
+ enum Age {
+ kNoAgeBytecodeAge = 0,
+ CODE_AGE_LIST(DECLARE_BYTECODE_AGE_ENUM) kAfterLastBytecodeAge,
+ kFirstBytecodeAge = kNoAgeBytecodeAge,
+ kLastBytecodeAge = kAfterLastBytecodeAge - 1,
+ kBytecodeAgeCount = kAfterLastBytecodeAge - kFirstBytecodeAge - 1,
+ kIsOldBytecodeAge = kSexagenarianBytecodeAge
+ };
+#undef DECLARE_BYTECODE_AGE_ENUM
+
static int SizeFor(int length) {
return OBJECT_POINTER_ALIGN(kHeaderSize + length);
}
@@ -4969,6 +4652,10 @@ class BytecodeArray : public FixedArrayBase {
inline int osr_loop_nesting_level() const;
inline void set_osr_loop_nesting_level(int depth);
+ // Accessors for bytecode's code age.
+ inline Age bytecode_age() const;
+ inline void set_bytecode_age(Age age);
+
// Accessors for the constant pool.
DECL_ACCESSORS(constant_pool, FixedArray)
@@ -5000,8 +4687,9 @@ class BytecodeArray : public FixedArrayBase {
void CopyBytecodesTo(BytecodeArray* to);
- int LookupRangeInHandlerTable(int code_offset, int* data,
- HandlerTable::CatchPrediction* prediction);
+ // Bytecode aging
+ bool IsOld() const;
+ void MakeOlder();
// Layout description.
static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize;
@@ -5012,7 +4700,8 @@ class BytecodeArray : public FixedArrayBase {
static const int kParameterSizeOffset = kFrameSizeOffset + kIntSize;
static const int kInterruptBudgetOffset = kParameterSizeOffset + kIntSize;
static const int kOSRNestingLevelOffset = kInterruptBudgetOffset + kIntSize;
- static const int kHeaderSize = kOSRNestingLevelOffset + kCharSize;
+ static const int kBytecodeAgeOffset = kOSRNestingLevelOffset + kCharSize;
+ static const int kHeaderSize = kBytecodeAgeOffset + kCharSize;
// Maximal memory consumption for a single BytecodeArray.
static const int kMaxSize = 512 * MB;
@@ -5356,7 +5045,8 @@ class Code: public HeapObject {
V(REGEXP) \
V(WASM_FUNCTION) \
V(WASM_TO_JS_FUNCTION) \
- V(JS_TO_WASM_FUNCTION)
+ V(JS_TO_WASM_FUNCTION) \
+ V(WASM_INTERPRETER_ENTRY)
#define IC_KIND_LIST(V) \
V(LOAD_IC) \
@@ -5413,6 +5103,10 @@ class Code: public HeapObject {
// [source_position_table]: ByteArray for the source positions table.
DECL_ACCESSORS(source_position_table, ByteArray)
+ // [protected_instructions]: Fixed array containing protected instruction and
+ // corresponding landing pad offsets.
+ DECL_ACCESSORS(protected_instructions, FixedArray)
+
// [raw_type_feedback_info]: This field stores various things, depending on
// the kind of the code object.
// FUNCTION => type feedback information.
@@ -5562,6 +5256,16 @@ class Code: public HeapObject {
inline bool marked_for_deoptimization();
inline void set_marked_for_deoptimization(bool flag);
+ // [is_promise_rejection]: For kind BUILTIN tells whether the exception
+ // thrown by the code will lead to promise rejection.
+ inline bool is_promise_rejection();
+ inline void set_is_promise_rejection(bool flag);
+
+ // [is_exception_caught]: For kind BUILTIN tells whether the exception
+ // thrown by the code will be caught internally.
+ inline bool is_exception_caught();
+ inline void set_is_exception_caught(bool flag);
+
// [constant_pool]: The constant pool for this function.
inline Address constant_pool();
@@ -5711,9 +5415,6 @@ class Code: public HeapObject {
BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
- int LookupRangeInHandlerTable(int code_offset, int* data,
- HandlerTable::CatchPrediction* prediction);
-
#define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
enum Age {
kToBeExecutedOnceCodeAge = -3,
@@ -5739,12 +5440,12 @@ class Code: public HeapObject {
void MakeYoung(Isolate* isolate);
void PreAge(Isolate* isolate);
void MarkToBeExecutedOnce(Isolate* isolate);
- void MakeOlder(MarkingParity);
+ void MakeOlder();
static bool IsYoungSequence(Isolate* isolate, byte* sequence);
bool IsOld();
Age GetAge();
static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) {
- return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY);
+ return GetCodeAgeStub(isolate, kNotExecutedCodeAge);
}
void PrintDeoptLocation(FILE* out, Address pc);
@@ -5782,7 +5483,10 @@ class Code: public HeapObject {
// For FUNCTION kind, we store the type feedback info here.
static const int kTypeFeedbackInfoOffset =
kSourcePositionTableOffset + kPointerSize;
- static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize;
+ static const int kProtectedInstructionOffset =
+ kTypeFeedbackInfoOffset + kPointerSize;
+ static const int kNextCodeLinkOffset =
+ kProtectedInstructionOffset + kPointerSize;
static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize;
static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize;
static const int kICAgeOffset = kInstructionSizeOffset + kIntSize;
@@ -5797,6 +5501,9 @@ class Code: public HeapObject {
kConstantPoolOffset + kConstantPoolSize;
static const int kHeaderPaddingStart = kBuiltinIndexOffset + kIntSize;
+ enum TrapFields { kTrapCodeOffset, kTrapLandingOffset, kTrapDataSize };
+
+
// Add padding to align the instruction start following right after
// the Code object header.
static const int kHeaderSize =
@@ -5836,9 +5543,11 @@ class Code: public HeapObject {
static const int kCanHaveWeakObjects = kIsTurbofannedBit + 1;
// Could be moved to overlap previous bits when we need more space.
static const int kIsConstructStub = kCanHaveWeakObjects + 1;
+ static const int kIsPromiseRejection = kIsConstructStub + 1;
+ static const int kIsExceptionCaught = kIsPromiseRejection + 1;
STATIC_ASSERT(kStackSlotsFirstBit + kStackSlotsBitCount <= 32);
- STATIC_ASSERT(kIsConstructStub + 1 <= 32);
+ STATIC_ASSERT(kIsExceptionCaught + 1 <= 32);
class StackSlotsField: public BitField<int,
kStackSlotsFirstBit, kStackSlotsBitCount> {}; // NOLINT
@@ -5850,6 +5559,10 @@ class Code: public HeapObject {
: public BitField<bool, kCanHaveWeakObjects, 1> {}; // NOLINT
class IsConstructStubField : public BitField<bool, kIsConstructStub, 1> {
}; // NOLINT
+ class IsPromiseRejectionField
+ : public BitField<bool, kIsPromiseRejection, 1> {}; // NOLINT
+ class IsExceptionCaughtField : public BitField<bool, kIsExceptionCaught, 1> {
+ }; // NOLINT
// KindSpecificFlags2 layout (ALL)
static const int kIsCrankshaftedBit = 0;
@@ -5886,16 +5599,12 @@ class Code: public HeapObject {
// Code aging
byte* FindCodeAgeSequence();
- static void GetCodeAgeAndParity(Code* code, Age* age,
- MarkingParity* parity);
- static void GetCodeAgeAndParity(Isolate* isolate, byte* sequence, Age* age,
- MarkingParity* parity);
- static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity);
+ static Age GetCodeAge(Isolate* isolate, byte* sequence);
+ static Age GetAgeOfCodeAgeStub(Code* code);
+ static Code* GetCodeAgeStub(Isolate* isolate, Age age);
// Code aging -- platform-specific
- static void PatchPlatformCodeAge(Isolate* isolate,
- byte* sequence, Age age,
- MarkingParity parity);
+ static void PatchPlatformCodeAge(Isolate* isolate, byte* sequence, Age age);
DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
};
@@ -5931,10 +5640,6 @@ class AbstractCode : public HeapObject {
// Set the source position table.
inline void set_source_position_table(ByteArray* source_position_table);
- // Return the exception handler table.
- inline int LookupRangeInHandlerTable(
- int code_offset, int* data, HandlerTable::CatchPrediction* prediction);
-
// Returns the size of instructions and the metadata.
inline int SizeIncludingMetadata();
@@ -6334,21 +6039,22 @@ class Map: public HeapObject {
int target_inobject, int target_unused,
int* old_number_of_fields);
// TODO(ishell): moveit!
- static Handle<Map> GeneralizeAllFieldRepresentations(Handle<Map> map);
+ static Handle<Map> GeneralizeAllFields(Handle<Map> map);
MUST_USE_RESULT static Handle<FieldType> GeneralizeFieldType(
Representation rep1, Handle<FieldType> type1, Representation rep2,
Handle<FieldType> type2, Isolate* isolate);
- static void GeneralizeFieldType(Handle<Map> map, int modify_index,
- Representation new_representation,
- Handle<FieldType> new_field_type);
+ static void GeneralizeField(Handle<Map> map, int modify_index,
+ Representation new_representation,
+ Handle<FieldType> new_field_type);
- static inline Handle<Map> ReconfigureProperty(
- Handle<Map> map, int modify_index, PropertyKind new_kind,
- PropertyAttributes new_attributes, Representation new_representation,
- Handle<FieldType> new_field_type, StoreMode store_mode);
+ static Handle<Map> ReconfigureProperty(Handle<Map> map, int modify_index,
+ PropertyKind new_kind,
+ PropertyAttributes new_attributes,
+ Representation new_representation,
+ Handle<FieldType> new_field_type);
- static inline Handle<Map> ReconfigureElementsKind(
- Handle<Map> map, ElementsKind new_elements_kind);
+ static Handle<Map> ReconfigureElementsKind(Handle<Map> map,
+ ElementsKind new_elements_kind);
static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
int descriptor_number,
@@ -6471,6 +6177,9 @@ class Map: public HeapObject {
Descriptor* descriptor,
TransitionFlag flag);
+ static Handle<Object> WrapFieldType(Handle<FieldType> type);
+ static FieldType* UnwrapFieldType(Object* wrapped_type);
+
MUST_USE_RESULT static MaybeHandle<Map> CopyWithField(
Handle<Map> map, Handle<Name> name, Handle<FieldType> type,
PropertyAttributes attributes, Representation representation,
@@ -6568,6 +6277,8 @@ class Map: public HeapObject {
Code* LookupInCodeCache(Name* name, Code::Flags code);
+ static Handle<Map> GetObjectCreateMap(Handle<HeapObject> prototype);
+
// Computes a hash value for this map, to be used in HashTables and such.
int Hash();
@@ -6592,6 +6303,8 @@ class Map: public HeapObject {
inline bool IsJSTypedArrayMap();
inline bool IsJSDataViewMap();
+ inline bool IsSpecialReceiverMap();
+
inline bool CanOmitMapChecks();
static void AddDependentCode(Handle<Map> map,
@@ -6735,6 +6448,11 @@ class Map: public HeapObject {
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
Handle<LayoutDescriptor> full_layout_descriptor);
+ // Fires when the layout of an object with a leaf map changes.
+ // This includes adding transitions to the leaf map or changing
+ // the descriptor array.
+ inline void NotifyLeafMapLayoutChange();
+
private:
// Returns the map that this (root) map transitions to if its elements_kind
// is changed to |elements_kind|, or |nullptr| if no such map is cached yet.
@@ -6783,23 +6501,10 @@ class Map: public HeapObject {
static Handle<Map> CopyNormalized(Handle<Map> map,
PropertyNormalizationMode mode);
- static Handle<Map> Reconfigure(Handle<Map> map,
- ElementsKind new_elements_kind,
- int modify_index, PropertyKind new_kind,
- PropertyAttributes new_attributes,
- Representation new_representation,
- Handle<FieldType> new_field_type,
- StoreMode store_mode);
-
- static Handle<Map> CopyGeneralizeAllRepresentations(
+ // TODO(ishell): Move to MapUpdater.
+ static Handle<Map> CopyGeneralizeAllFields(
Handle<Map> map, ElementsKind elements_kind, int modify_index,
- StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes,
- const char* reason);
-
- // Fires when the layout of an object with a leaf map changes.
- // This includes adding transitions to the leaf map or changing
- // the descriptor array.
- inline void NotifyLeafMapLayoutChange();
+ PropertyKind kind, PropertyAttributes attributes, const char* reason);
void DeprecateTransitionTree();
@@ -6807,8 +6512,6 @@ class Map: public HeapObject {
LayoutDescriptor* new_layout_descriptor);
- Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors);
-
// Update field type of the given descriptor to new representation and new
// type. The type must be prepared for storing in descriptor array:
// it must be either a simple type or a map wrapped in a weak cell.
@@ -6816,8 +6519,10 @@ class Map: public HeapObject {
Representation new_representation,
Handle<Object> new_wrapped_type);
+ // TODO(ishell): Move to MapUpdater.
void PrintReconfiguration(FILE* file, int modify_index, PropertyKind kind,
PropertyAttributes attributes);
+ // TODO(ishell): Move to MapUpdater.
void PrintGeneralization(FILE* file, const char* reason, int modify_index,
int split, int descriptors, bool constant_to_field,
Representation old_representation,
@@ -6826,10 +6531,11 @@ class Map: public HeapObject {
MaybeHandle<Object> old_value,
MaybeHandle<FieldType> new_field_type,
MaybeHandle<Object> new_value);
-
static const int kFastPropertiesSoftLimit = 12;
static const int kMaxFastProperties = 128;
+ friend class MapUpdater;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
};
@@ -6850,8 +6556,9 @@ class PromiseResolveThenableJobInfo : public Struct {
DECL_ACCESSORS(then, JSReceiver)
DECL_ACCESSORS(resolve, JSFunction)
DECL_ACCESSORS(reject, JSFunction)
- DECL_ACCESSORS(debug_id, Object)
- DECL_ACCESSORS(debug_name, Object)
+
+ DECL_INT_ACCESSORS(debug_id)
+
DECL_ACCESSORS(context, Context)
static const int kThenableOffset = Struct::kHeaderSize;
@@ -6859,8 +6566,7 @@ class PromiseResolveThenableJobInfo : public Struct {
static const int kResolveOffset = kThenOffset + kPointerSize;
static const int kRejectOffset = kResolveOffset + kPointerSize;
static const int kDebugIdOffset = kRejectOffset + kPointerSize;
- static const int kDebugNameOffset = kDebugIdOffset + kPointerSize;
- static const int kContextOffset = kDebugNameOffset + kPointerSize;
+ static const int kContextOffset = kDebugIdOffset + kPointerSize;
static const int kSize = kContextOffset + kPointerSize;
DECLARE_CAST(PromiseResolveThenableJobInfo)
@@ -6871,22 +6577,33 @@ class PromiseResolveThenableJobInfo : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseResolveThenableJobInfo);
};
+class JSPromise;
+
// Struct to hold state required for PromiseReactionJob.
class PromiseReactionJobInfo : public Struct {
public:
DECL_ACCESSORS(value, Object)
DECL_ACCESSORS(tasks, Object)
- DECL_ACCESSORS(deferred, Object)
- DECL_ACCESSORS(debug_id, Object)
- DECL_ACCESSORS(debug_name, Object)
+
+ // Check comment in JSPromise for information on what state these
+ // deferred fields could be in.
+ DECL_ACCESSORS(deferred_promise, Object)
+ DECL_ACCESSORS(deferred_on_resolve, Object)
+ DECL_ACCESSORS(deferred_on_reject, Object)
+
+ DECL_INT_ACCESSORS(debug_id)
+
DECL_ACCESSORS(context, Context)
static const int kValueOffset = Struct::kHeaderSize;
static const int kTasksOffset = kValueOffset + kPointerSize;
- static const int kDeferredOffset = kTasksOffset + kPointerSize;
- static const int kDebugIdOffset = kDeferredOffset + kPointerSize;
- static const int kDebugNameOffset = kDebugIdOffset + kPointerSize;
- static const int kContextOffset = kDebugNameOffset + kPointerSize;
+ static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize;
+ static const int kDeferredOnResolveOffset =
+ kDeferredPromiseOffset + kPointerSize;
+ static const int kDeferredOnRejectOffset =
+ kDeferredOnResolveOffset + kPointerSize;
+ static const int kDebugIdOffset = kDeferredOnRejectOffset + kPointerSize;
+ static const int kContextOffset = kDebugIdOffset + kPointerSize;
static const int kSize = kContextOffset + kPointerSize;
DECLARE_CAST(PromiseReactionJobInfo)
@@ -6975,10 +6692,27 @@ class PrototypeInfo : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
};
-class Tuple3 : public Struct {
+class Tuple2 : public Struct {
public:
DECL_ACCESSORS(value1, Object)
DECL_ACCESSORS(value2, Object)
+
+ DECLARE_CAST(Tuple2)
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(Tuple2)
+ DECLARE_VERIFIER(Tuple2)
+
+ static const int kValue1Offset = HeapObject::kHeaderSize;
+ static const int kValue2Offset = kValue1Offset + kPointerSize;
+ static const int kSize = kValue2Offset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2);
+};
+
+class Tuple3 : public Tuple2 {
+ public:
DECL_ACCESSORS(value3, Object)
DECLARE_CAST(Tuple3)
@@ -6987,9 +6721,7 @@ class Tuple3 : public Struct {
DECLARE_PRINTER(Tuple3)
DECLARE_VERIFIER(Tuple3)
- static const int kValue1Offset = HeapObject::kHeaderSize;
- static const int kValue2Offset = kValue1Offset + kPointerSize;
- static const int kValue3Offset = kValue2Offset + kPointerSize;
+ static const int kValue3Offset = Tuple2::kSize;
static const int kSize = kValue3Offset + kPointerSize;
private:
@@ -7022,6 +6754,27 @@ class ContextExtension : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(ContextExtension);
};
+// Pair of {ElementsKind} and an array of constant values for {ArrayLiteral}
+// expressions. Used to communicate with the runtime for literal boilerplate
+// creation within the {Runtime_CreateArrayLiteral} method.
+class ConstantElementsPair : public Struct {
+ public:
+ DECL_INT_ACCESSORS(elements_kind)
+ DECL_ACCESSORS(constant_values, FixedArrayBase)
+
+ DECLARE_CAST(ConstantElementsPair)
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(ConstantElementsPair)
+ DECLARE_VERIFIER(ConstantElementsPair)
+
+ static const int kElementsKindOffset = HeapObject::kHeaderSize;
+ static const int kConstantValuesOffset = kElementsKindOffset + kPointerSize;
+ static const int kSize = kConstantValuesOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantElementsPair);
+};
// Script describes a script which has been added to the VM.
class Script: public Struct {
@@ -7031,7 +6784,8 @@ class Script: public Struct {
TYPE_NATIVE = 0,
TYPE_EXTENSION = 1,
TYPE_NORMAL = 2,
- TYPE_WASM = 3
+ TYPE_WASM = 3,
+ TYPE_INSPECTOR = 4
};
// Script compilation types.
@@ -7085,7 +6839,7 @@ class Script: public Struct {
// [shared_function_infos]: weak fixed array containing all shared
// function infos created from this script.
- DECL_ACCESSORS(shared_function_infos, Object)
+ DECL_ACCESSORS(shared_function_infos, FixedArray)
// [flags]: Holds an exciting bitfield.
DECL_INT_ACCESSORS(flags)
@@ -7110,11 +6864,6 @@ class Script: public Struct {
inline CompilationState compilation_state();
inline void set_compilation_state(CompilationState state);
- // [hide_source]: determines whether the script source can be exposed as
- // function source. Encoded in the 'flags' field.
- inline bool hide_source();
- inline void set_hide_source(bool value);
-
// [origin_options]: optional attributes set by the embedder via ScriptOrigin,
// and used by the embedder to make decisions about the script. V8 just passes
// this through. Encoded in the 'flags' field.
@@ -7127,7 +6876,7 @@ class Script: public Struct {
// resource is accessible. Otherwise, always return true.
inline bool HasValidSource();
- static Handle<Object> GetNameOrSourceURL(Handle<Script> script);
+ Object* GetNameOrSourceURL();
// Set eval origin for stack trace formatting.
static void SetEvalOrigin(Handle<Script> script,
@@ -7175,7 +6924,8 @@ class Script: public Struct {
// Look through the list of existing shared function infos to find one
// that matches the function literal. Return empty handle if not found.
- MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(FunctionLiteral* fun);
+ MaybeHandle<SharedFunctionInfo> FindSharedFunctionInfo(Isolate* isolate,
+ FunctionLiteral* fun);
// Iterate over all script objects on the heap.
class Iterator {
@@ -7215,8 +6965,7 @@ class Script: public Struct {
// Bit positions in the flags field.
static const int kCompilationTypeBit = 0;
static const int kCompilationStateBit = 1;
- static const int kHideSourceBit = 2;
- static const int kOriginOptionsShift = 3;
+ static const int kOriginOptionsShift = 2;
static const int kOriginOptionsSize = 3;
static const int kOriginOptionsMask = ((1 << kOriginOptionsSize) - 1)
<< kOriginOptionsShift;
@@ -7235,11 +6984,26 @@ class Script: public Struct {
// Installation of ids for the selected builtin functions is handled
// by the bootstrapper.
#define FUNCTIONS_WITH_ID_LIST(V) \
+ V(Array.prototype, concat, ArrayConcat) \
+ V(Array.prototype, every, ArrayEvery) \
+ V(Array.prototype, fill, ArrayFill) \
+ V(Array.prototype, filter, ArrayFilter) \
+ V(Array.prototype, findIndex, ArrayFindIndex) \
+ V(Array.prototype, forEach, ArrayForEach) \
+ V(Array.prototype, includes, ArrayIncludes) \
V(Array.prototype, indexOf, ArrayIndexOf) \
+ V(Array.prototype, join, ArrayJoin) \
V(Array.prototype, lastIndexOf, ArrayLastIndexOf) \
- V(Array.prototype, push, ArrayPush) \
+ V(Array.prototype, map, ArrayMap) \
V(Array.prototype, pop, ArrayPop) \
+ V(Array.prototype, push, ArrayPush) \
+ V(Array.prototype, reverse, ArrayReverse) \
V(Array.prototype, shift, ArrayShift) \
+ V(Array.prototype, slice, ArraySlice) \
+ V(Array.prototype, some, ArraySome) \
+ V(Array.prototype, splice, ArraySplice) \
+ V(Array.prototype, unshift, ArrayUnshift) \
+ V(Date, now, DateNow) \
V(Date.prototype, getDate, DateGetDate) \
V(Date.prototype, getDay, DateGetDay) \
V(Date.prototype, getFullYear, DateGetFullYear) \
@@ -7252,13 +7016,33 @@ class Script: public Struct {
V(Function.prototype, apply, FunctionApply) \
V(Function.prototype, call, FunctionCall) \
V(Object.prototype, hasOwnProperty, ObjectHasOwnProperty) \
+ V(RegExp.prototype, compile, RegExpCompile) \
+ V(RegExp.prototype, exec, RegExpExec) \
+ V(RegExp.prototype, test, RegExpTest) \
+ V(RegExp.prototype, toString, RegExpToString) \
V(String.prototype, charCodeAt, StringCharCodeAt) \
V(String.prototype, charAt, StringCharAt) \
+ V(String.prototype, codePointAt, StringCodePointAt) \
V(String.prototype, concat, StringConcat) \
+ V(String.prototype, endsWith, StringEndsWith) \
+ V(String.prototype, includes, StringIncludes) \
+ V(String.prototype, indexOf, StringIndexOf) \
+ V(String.prototype, lastIndexOf, StringLastIndexOf) \
+ V(String.prototype, repeat, StringRepeat) \
+ V(String.prototype, slice, StringSlice) \
+ V(String.prototype, startsWith, StringStartsWith) \
V(String.prototype, substr, StringSubstr) \
+ V(String.prototype, substring, StringSubstring) \
V(String.prototype, toLowerCase, StringToLowerCase) \
+ V(String.prototype, toString, StringToString) \
V(String.prototype, toUpperCase, StringToUpperCase) \
+ V(String.prototype, trim, StringTrim) \
+ V(String.prototype, trimLeft, StringTrimLeft) \
+ V(String.prototype, trimRight, StringTrimRight) \
+ V(String.prototype, valueOf, StringValueOf) \
V(String, fromCharCode, StringFromCharCode) \
+ V(String, fromCodePoint, StringFromCodePoint) \
+ V(String, raw, StringRaw) \
V(Math, random, MathRandom) \
V(Math, floor, MathFloor) \
V(Math, round, MathRound) \
@@ -7299,7 +7083,8 @@ class Script: public Struct {
V(Number, isSafeInteger, NumberIsSafeInteger) \
V(Number, parseFloat, NumberParseFloat) \
V(Number, parseInt, NumberParseInt) \
- V(Number.prototype, toString, NumberToString)
+ V(Number.prototype, toString, NumberToString) \
+ V(Object, create, ObjectCreate)
#define ATOMIC_FUNCTIONS_WITH_ID_LIST(V) \
V(Atomics, load, AtomicsLoad) \
@@ -7344,15 +7129,13 @@ enum BuiltinFunctionId {
kStringIteratorNext,
};
-
// Result of searching in an optimized code map of a SharedFunctionInfo. Note
// that both {code} and {literals} can be NULL to pass search result status.
struct CodeAndLiterals {
- Code* code; // Cached optimized code.
+ Code* code; // Cached optimized code.
LiteralsArray* literals; // Cached literals array.
};
-
// SharedFunctionInfo describes the JSFunction information that can be
// shared by multiple instances of the function.
class SharedFunctionInfo: public HeapObject {
@@ -7405,9 +7188,6 @@ class SharedFunctionInfo: public HeapObject {
// the entry itself is left in the map in order to proceed sharing literals.
void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
- // Trims the optimized code map after entries have been removed.
- void TrimOptimizedCodeMap(int shrink_by);
-
static Handle<LiteralsArray> FindOrCreateLiterals(
Handle<SharedFunctionInfo> shared, Handle<Context> native_context);
@@ -7429,8 +7209,7 @@ class SharedFunctionInfo: public HeapObject {
static const int kContextOffset = 0;
static const int kCachedCodeOffset = 1;
static const int kLiteralsOffset = 2;
- static const int kOsrAstIdOffset = 3;
- static const int kEntryLength = 4;
+ static const int kEntryLength = 3;
static const int kInitialLength = kEntriesStart + kEntryLength;
static const int kNotFound = -1;
@@ -7444,8 +7223,6 @@ class SharedFunctionInfo: public HeapObject {
kPointerSize * (kCachedCodeOffset - kEntryLength);
static const int kOffsetToPreviousLiterals =
FixedArray::kHeaderSize + kPointerSize * (kLiteralsOffset - kEntryLength);
- static const int kOffsetToPreviousOsrAstId =
- FixedArray::kHeaderSize + kPointerSize * (kOsrAstIdOffset - kEntryLength);
// [scope_info]: Scope info.
DECL_ACCESSORS(scope_info, ScopeInfo)
@@ -7488,6 +7265,12 @@ class SharedFunctionInfo: public HeapObject {
// available.
DECL_ACCESSORS(feedback_metadata, TypeFeedbackMetadata)
+ // [function_literal_id] - uniquely identifies the FunctionLiteral this
+ // SharedFunctionInfo represents within its script, or -1 if this
+ // SharedFunctionInfo object doesn't correspond to a parsed FunctionLiteral.
+ inline int function_literal_id() const;
+ inline void set_function_literal_id(int value);
+
#if TRACE_MAPS
// [unique_id] - For --trace-maps purposes, an identifier that's persistent
// even if the GC moves this SharedFunctionInfo.
@@ -7563,6 +7346,9 @@ class SharedFunctionInfo: public HeapObject {
// The function's name if it is non-empty, otherwise the inferred name.
String* DebugName();
+ // The function cannot cause any side effects.
+ bool HasNoSideEffect();
+
// Used for flags such as --hydrogen-filter.
bool PassesFilter(const char* raw_filter);
@@ -7646,30 +7432,20 @@ class SharedFunctionInfo: public HeapObject {
// which does not change this flag).
DECL_BOOLEAN_ACCESSORS(is_anonymous_expression)
- // Is this a function or top-level/eval code.
- DECL_BOOLEAN_ACCESSORS(is_function)
-
- // Indicates that code for this function cannot be compiled with Crankshaft.
- DECL_BOOLEAN_ACCESSORS(dont_crankshaft)
+ // Indicates that code for this function must be compiled through the
+ // Ignition / TurboFan pipeline, and is unsupported by
+ // FullCodegen / Crankshaft.
+ DECL_BOOLEAN_ACCESSORS(must_use_ignition_turbo)
// Indicates that code for this function cannot be flushed.
DECL_BOOLEAN_ACCESSORS(dont_flush)
- // Indicates that this is a constructor for a base class with instance fields.
- DECL_BOOLEAN_ACCESSORS(requires_class_field_init)
- // Indicates that this is a synthesized function to set up class instance
- // fields.
- DECL_BOOLEAN_ACCESSORS(is_class_field_initializer)
-
// Indicates that this function is an asm function.
DECL_BOOLEAN_ACCESSORS(asm_function)
// Indicates that the the shared function info is deserialized from cache.
DECL_BOOLEAN_ACCESSORS(deserialized)
- // Indicates that the the shared function info has never been compiled before.
- DECL_BOOLEAN_ACCESSORS(never_compiled)
-
// Whether this function was created from a FunctionDeclaration.
DECL_BOOLEAN_ACCESSORS(is_declaration)
@@ -7679,6 +7455,12 @@ class SharedFunctionInfo: public HeapObject {
// Indicates that asm->wasm conversion failed and should not be re-attempted.
DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
+ // Indicates that the function cannot cause side-effects.
+ DECL_BOOLEAN_ACCESSORS(has_no_side_effect)
+
+ // Indicates that |has_no_side_effect| has been computed and set.
+ DECL_BOOLEAN_ACCESSORS(computed_has_no_side_effect)
+
inline FunctionKind kind() const;
inline void set_kind(FunctionKind kind);
@@ -7733,8 +7515,8 @@ class SharedFunctionInfo: public HeapObject {
// Tells whether this function should be subject to debugging.
inline bool IsSubjectToDebugging();
- // Whether this function is defined in native code or extensions.
- inline bool IsBuiltin();
+ // Whether this function is defined in user-provided JavaScript code.
+ inline bool IsUserJavaScript();
// Check whether or not this function is inlineable.
bool IsInlineable();
@@ -7757,19 +7539,35 @@ class SharedFunctionInfo: public HeapObject {
void ResetForNewContext(int new_ic_age);
- // Iterate over all shared function infos.
- class Iterator {
+ // Iterate over all shared function infos in a given script.
+ class ScriptIterator {
public:
- explicit Iterator(Isolate* isolate);
+ explicit ScriptIterator(Handle<Script> script);
+ ScriptIterator(Isolate* isolate, Handle<FixedArray> shared_function_infos);
SharedFunctionInfo* Next();
+ // Reset the iterator to run on |script|.
+ void Reset(Handle<Script> script);
+
private:
- bool NextScript();
+ Isolate* isolate_;
+ Handle<FixedArray> shared_function_infos_;
+ int index_;
+ DISALLOW_COPY_AND_ASSIGN(ScriptIterator);
+ };
+
+ // Iterate over all shared function infos on the heap.
+ class GlobalIterator {
+ public:
+ explicit GlobalIterator(Isolate* isolate);
+ SharedFunctionInfo* Next();
+ private:
Script::Iterator script_iterator_;
- WeakFixedArray::Iterator sfi_iterator_;
+ WeakFixedArray::Iterator noscript_sfi_iterator_;
+ SharedFunctionInfo::ScriptIterator sfi_iterator_;
DisallowHeapAllocation no_gc_;
- DISALLOW_COPY_AND_ASSIGN(Iterator);
+ DISALLOW_COPY_AND_ASSIGN(GlobalIterator);
};
DECLARE_CAST(SharedFunctionInfo)
@@ -7794,13 +7592,15 @@ class SharedFunctionInfo: public HeapObject {
static const int kFunctionIdentifierOffset = kDebugInfoOffset + kPointerSize;
static const int kFeedbackMetadataOffset =
kFunctionIdentifierOffset + kPointerSize;
+ static const int kFunctionLiteralIdOffset =
+ kFeedbackMetadataOffset + kPointerSize;
#if TRACE_MAPS
- static const int kUniqueIdOffset = kFeedbackMetadataOffset + kPointerSize;
+ static const int kUniqueIdOffset = kFunctionLiteralIdOffset + kPointerSize;
static const int kLastPointerFieldOffset = kUniqueIdOffset;
#else
// Just to not break the postmortrem support with conditional offsets
- static const int kUniqueIdOffset = kFeedbackMetadataOffset;
- static const int kLastPointerFieldOffset = kFeedbackMetadataOffset;
+ static const int kUniqueIdOffset = kFunctionLiteralIdOffset;
+ static const int kLastPointerFieldOffset = kFunctionLiteralIdOffset;
#endif
#if V8_HOST_ARCH_32_BIT
@@ -7927,29 +7727,29 @@ class SharedFunctionInfo: public HeapObject {
kAllowLazyCompilation,
kMarkedForTierUp,
kOptimizationDisabled,
- kNeverCompiled,
+ kHasDuplicateParameters,
kNative,
kStrictModeFunction,
kUsesArguments,
kNeedsHomeObject,
// byte 1
- kHasDuplicateParameters,
kForceInline,
kIsAsmFunction,
kIsAnonymousExpression,
kNameShouldPrintAsAnonymous,
- kIsFunction,
- kDontCrankshaft,
+ kMustUseIgnitionTurbo,
kDontFlush,
+ kIsDeclaration,
+
+ kUnused, // unused.
// byte 2
kFunctionKind,
// rest of byte 2 and first two bits of byte 3 are used by FunctionKind
// byte 3
kDeserialized = kFunctionKind + 10,
- kIsDeclaration,
kIsAsmWasmBroken,
- kRequiresClassFieldInit,
- kIsClassFieldInitializer,
+ kHasNoSideEffect,
+ kComputedHasNoSideEffect,
kCompilerHintsCount, // Pseudo entry
};
// kFunctionKind has to be byte-aligned
@@ -8031,11 +7831,10 @@ class SharedFunctionInfo: public HeapObject {
#undef BYTE_OFFSET
private:
- // Returns entry from optimized code map for specified context and OSR entry.
+ // Returns entry from optimized code map for specified context.
// The result is either kNotFound, or a start index of the context-dependent
// entry.
- int SearchOptimizedCodeMapEntry(Context* native_context,
- BailoutId osr_ast_id);
+ int SearchOptimizedCodeMapEntry(Context* native_context);
DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
};
@@ -8066,8 +7865,7 @@ class JSGeneratorObject: public JSObject {
// [input_or_debug_pos]
// For executing generators: the most recent input value.
- // For suspended new-style generators: debug information (bytecode offset).
- // For suspended old-style generators: unused.
+ // For suspended generators: debug information (bytecode offset).
// There is currently no need to remember the most recent input value for a
// suspended generator.
DECL_ACCESSORS(input_or_debug_pos, Object)
@@ -8091,8 +7889,8 @@ class JSGeneratorObject: public JSObject {
// is suspended.
int source_position() const;
- // [operand_stack]: Saved operand stack.
- DECL_ACCESSORS(operand_stack, FixedArray)
+ // [register_file]: Saved interpreter register file.
+ DECL_ACCESSORS(register_file, FixedArray)
DECLARE_CAST(JSGeneratorObject)
@@ -8110,93 +7908,13 @@ class JSGeneratorObject: public JSObject {
static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize;
static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize;
static const int kContinuationOffset = kResumeModeOffset + kPointerSize;
- static const int kOperandStackOffset = kContinuationOffset + kPointerSize;
- static const int kSize = kOperandStackOffset + kPointerSize;
+ static const int kRegisterFileOffset = kContinuationOffset + kPointerSize;
+ static const int kSize = kRegisterFileOffset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
};
-class ModuleInfoEntry : public Struct {
- public:
- DECLARE_CAST(ModuleInfoEntry)
- DECLARE_PRINTER(ModuleInfoEntry)
- DECLARE_VERIFIER(ModuleInfoEntry)
-
- DECL_ACCESSORS(export_name, Object)
- DECL_ACCESSORS(local_name, Object)
- DECL_ACCESSORS(import_name, Object)
- DECL_INT_ACCESSORS(module_request)
- DECL_INT_ACCESSORS(cell_index)
- DECL_INT_ACCESSORS(beg_pos)
- DECL_INT_ACCESSORS(end_pos)
-
- static Handle<ModuleInfoEntry> New(Isolate* isolate,
- Handle<Object> export_name,
- Handle<Object> local_name,
- Handle<Object> import_name,
- int module_request, int cell_index,
- int beg_pos, int end_pos);
-
- static const int kExportNameOffset = HeapObject::kHeaderSize;
- static const int kLocalNameOffset = kExportNameOffset + kPointerSize;
- static const int kImportNameOffset = kLocalNameOffset + kPointerSize;
- static const int kModuleRequestOffset = kImportNameOffset + kPointerSize;
- static const int kCellIndexOffset = kModuleRequestOffset + kPointerSize;
- static const int kBegPosOffset = kCellIndexOffset + kPointerSize;
- static const int kEndPosOffset = kBegPosOffset + kPointerSize;
- static const int kSize = kEndPosOffset + kPointerSize;
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfoEntry);
-};
-
-// ModuleInfo is to ModuleDescriptor what ScopeInfo is to Scope.
-class ModuleInfo : public FixedArray {
- public:
- DECLARE_CAST(ModuleInfo)
-
- static Handle<ModuleInfo> New(Isolate* isolate, Zone* zone,
- ModuleDescriptor* descr);
-
- inline FixedArray* module_requests() const;
- inline FixedArray* special_exports() const;
- inline FixedArray* regular_exports() const;
- inline FixedArray* namespace_imports() const;
- inline FixedArray* regular_imports() const;
-
- // Accessors for [regular_exports].
- int RegularExportCount() const;
- String* RegularExportLocalName(int i) const;
- int RegularExportCellIndex(int i) const;
- FixedArray* RegularExportExportNames(int i) const;
-
- static Handle<ModuleInfoEntry> LookupRegularImport(Handle<ModuleInfo> info,
- Handle<String> local_name);
-
-#ifdef DEBUG
- inline bool Equals(ModuleInfo* other) const;
-#endif
-
- private:
- friend class Factory;
- friend class ModuleDescriptor;
- enum {
- kModuleRequestsIndex,
- kSpecialExportsIndex,
- kRegularExportsIndex,
- kNamespaceImportsIndex,
- kRegularImportsIndex,
- kLength
- };
- enum {
- kRegularExportLocalNameOffset,
- kRegularExportCellIndexOffset,
- kRegularExportExportNamesOffset,
- kRegularExportLength
- };
- DISALLOW_IMPLICIT_CONSTRUCTORS(ModuleInfo);
-};
// When importing a module namespace (import * as foo from "bar"), a
// JSModuleNamespace object (representing module "bar") is created and bound to
// the declared variable (foo). A module can have at most one namespace object.
@@ -8214,8 +7932,16 @@ class JSModuleNamespace : public JSObject {
// schedule an exception and return Nothing.
MUST_USE_RESULT MaybeHandle<Object> GetExport(Handle<String> name);
+ // In-object fields.
+ enum {
+ kToStringTagFieldIndex,
+ kInObjectFieldCount,
+ };
+
static const int kModuleOffset = JSObject::kHeaderSize;
- static const int kSize = kModuleOffset + kPointerSize;
+ static const int kHeaderSize = kModuleOffset + kPointerSize;
+
+ static const int kSize = kHeaderSize + kPointerSize * kInObjectFieldCount;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSModuleNamespace);
@@ -8294,8 +8020,6 @@ class Module : public Struct {
static const int kSize = kRequestedModulesOffset + kPointerSize;
private:
- enum { kEvaluatedBit };
-
static void CreateExport(Handle<Module> module, int cell_index,
Handle<FixedArray> names);
static void CreateIndirectExport(Handle<Module> module, Handle<String> name,
@@ -8713,10 +8437,6 @@ class JSDate: public JSObject {
void SetValue(Object* value, bool is_value_nan);
- // ES6 section 20.3.4.45 Date.prototype [ @@toPrimitive ]
- static MUST_USE_RESULT MaybeHandle<Object> ToPrimitive(
- Handle<JSReceiver> receiver, Handle<Object> hint);
-
// Dispatched behavior.
DECLARE_PRINTER(JSDate)
DECLARE_VERIFIER(JSDate)
@@ -8813,6 +8533,9 @@ class JSMessageObject: public JSObject {
// position, or the empty string if the position is invalid.
Handle<String> GetSourceLine() const;
+ inline int error_level() const;
+ inline void set_error_level(int level);
+
DECLARE_CAST(JSMessageObject)
// Dispatched behavior.
@@ -8826,13 +8549,103 @@ class JSMessageObject: public JSObject {
static const int kStackFramesOffset = kScriptOffset + kPointerSize;
static const int kStartPositionOffset = kStackFramesOffset + kPointerSize;
static const int kEndPositionOffset = kStartPositionOffset + kPointerSize;
- static const int kSize = kEndPositionOffset + kPointerSize;
+ static const int kErrorLevelOffset = kEndPositionOffset + kPointerSize;
+ static const int kSize = kErrorLevelOffset + kPointerSize;
typedef FixedBodyDescriptor<HeapObject::kMapOffset,
kStackFramesOffset + kPointerSize,
kSize> BodyDescriptor;
};
+class JSPromise;
+
+// TODO(caitp): Make this a Struct once properties are no longer accessed from
+// JS
+class JSPromiseCapability : public JSObject {
+ public:
+ DECLARE_CAST(JSPromiseCapability)
+
+ DECLARE_VERIFIER(JSPromiseCapability)
+
+ DECL_ACCESSORS(promise, Object)
+ DECL_ACCESSORS(resolve, Object)
+ DECL_ACCESSORS(reject, Object)
+
+ static const int kPromiseOffset = JSObject::kHeaderSize;
+ static const int kResolveOffset = kPromiseOffset + kPointerSize;
+ static const int kRejectOffset = kResolveOffset + kPointerSize;
+ static const int kSize = kRejectOffset + kPointerSize;
+
+ enum InObjectPropertyIndex {
+ kPromiseIndex,
+ kResolveIndex,
+ kRejectIndex,
+ kInObjectPropertyCount // Dummy.
+ };
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSPromiseCapability);
+};
+
+class JSPromise : public JSObject {
+ public:
+ DECL_INT_ACCESSORS(status)
+ DECL_ACCESSORS(result, Object)
+
+ // There are 3 possible states for these fields --
+ // 1) Undefined -- This is the zero state when there is no callback
+ // or deferred fields registered.
+ //
+ // 2) Object -- There is a single Callable directly attached to the
+ // fulfill_reactions, reject_reactions and the deferred fields are
+ // directly attached to the slots. In this state, deferred_promise
+ // is a JSReceiver and deferred_on_{resolve, reject} are Callables.
+ //
+ // 3) FixedArray -- There is more than one callback and deferred
+ // fields attached to a FixedArray.
+ DECL_ACCESSORS(deferred_promise, Object)
+ DECL_ACCESSORS(deferred_on_resolve, Object)
+ DECL_ACCESSORS(deferred_on_reject, Object)
+ DECL_ACCESSORS(fulfill_reactions, Object)
+ DECL_ACCESSORS(reject_reactions, Object)
+
+ DECL_INT_ACCESSORS(flags)
+
+ // [has_handler]: Whether this promise has a reject handler or not.
+ DECL_BOOLEAN_ACCESSORS(has_handler)
+
+ // [handled_hint]: Whether this promise will be handled by a catch
+ // block in an async function.
+ DECL_BOOLEAN_ACCESSORS(handled_hint)
+
+ static const char* Status(int status);
+
+ DECLARE_CAST(JSPromise)
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(JSPromise)
+ DECLARE_VERIFIER(JSPromise)
+
+ // Layout description.
+ static const int kStatusOffset = JSObject::kHeaderSize;
+ static const int kResultOffset = kStatusOffset + kPointerSize;
+ static const int kDeferredPromiseOffset = kResultOffset + kPointerSize;
+ static const int kDeferredOnResolveOffset =
+ kDeferredPromiseOffset + kPointerSize;
+ static const int kDeferredOnRejectOffset =
+ kDeferredOnResolveOffset + kPointerSize;
+ static const int kFulfillReactionsOffset =
+ kDeferredOnRejectOffset + kPointerSize;
+ static const int kRejectReactionsOffset =
+ kFulfillReactionsOffset + kPointerSize;
+ static const int kFlagsOffset = kRejectReactionsOffset + kPointerSize;
+ static const int kSize = kFlagsOffset + kPointerSize;
+
+ // Flags layout.
+ static const int kHasHandlerBit = 0;
+ static const int kHandledHintBit = 1;
+};
+
// Regular expressions
// The regular expression holds a single reference to a FixedArray in
// the kDataOffset field.
@@ -9142,14 +8955,6 @@ class TypeFeedbackInfo: public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(TypeFeedbackInfo);
};
-
-enum AllocationSiteMode {
- DONT_TRACK_ALLOCATION_SITE,
- TRACK_ALLOCATION_SITE,
- LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE
-};
-
-
class AllocationSite: public Struct {
public:
static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
@@ -9583,6 +9388,10 @@ class Symbol: public Name {
// a load.
DECL_BOOLEAN_ACCESSORS(is_well_known_symbol)
+ // [is_public]: Whether this is a symbol created by Symbol.for. Calling
+ // Symbol.keyFor on such a symbol simply needs to return the attached name.
+ DECL_BOOLEAN_ACCESSORS(is_public)
+
DECLARE_CAST(Symbol)
// Dispatched behavior.
@@ -9594,14 +9403,16 @@ class Symbol: public Name {
static const int kFlagsOffset = kNameOffset + kPointerSize;
static const int kSize = kFlagsOffset + kPointerSize;
+ // Flags layout.
+ static const int kPrivateBit = 0;
+ static const int kWellKnownSymbolBit = 1;
+ static const int kPublicBit = 2;
+
typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor;
void SymbolShortPrint(std::ostream& os);
private:
- static const int kPrivateBit = 0;
- static const int kWellKnownSymbolBit = 1;
-
const char* PrivateSymbolToName() const;
#if TRACE_MAPS
@@ -9840,6 +9651,7 @@ class String: public Name {
// Conversion.
inline bool AsArrayIndex(uint32_t* index);
+ uint32_t inline ToValidIndex(Object* number);
// Trimming.
enum TrimMode { kTrim, kTrimLeft, kTrimRight };
@@ -10791,37 +10603,6 @@ 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 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)
-
- // The initial value of the object's "next" property.
- DECL_ACCESSORS(initial_next, JSFunction)
-
- static const int kArrayOffset = JSObject::kHeaderSize;
- static const int kIndexOffset = kArrayOffset + kPointerSize;
- static const int kNextOffset = kIndexOffset + kPointerSize;
- static const int kHeaderSize = kNextOffset + kPointerSize;
-
- enum InObjectPropertyIndex {
- kNextIndex,
- kInObjectPropertyCount // Dummy.
- };
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(JSFixedArrayIterator);
-};
-
// OrderedHashTableIterator is an iterator that iterates over the keys and
// values of an OrderedHashTable.
//
@@ -11023,6 +10804,9 @@ class JSArrayBuffer: public JSObject {
inline bool is_shared();
inline void set_is_shared(bool value);
+ inline bool has_guard_region();
+ inline void set_has_guard_region(bool value);
+
DECLARE_CAST(JSArrayBuffer)
void Neuter();
@@ -11062,6 +10846,7 @@ class JSArrayBuffer: public JSObject {
class IsNeuterable : public BitField<bool, 2, 1> {};
class WasNeutered : public BitField<bool, 3, 1> {};
class IsShared : public BitField<bool, 4, 1> {};
+ class HasGuardRegion : public BitField<bool, 5, 1> {};
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
@@ -11106,6 +10891,11 @@ class JSTypedArray: public JSArrayBufferView {
DECL_ACCESSORS(length, Object)
inline uint32_t length_value() const;
+ // ES6 9.4.5.3
+ MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
+ Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
+ PropertyDescriptor* desc, ShouldThrow should_throw);
+
DECLARE_CAST(JSTypedArray)
ExternalArrayType type();
@@ -11543,6 +11333,7 @@ class FunctionTemplateInfo: public TemplateInfo {
public:
DECL_ACCESSORS(call_code, Object)
DECL_ACCESSORS(prototype_template, Object)
+ DECL_ACCESSORS(prototype_provider_template, Object)
DECL_ACCESSORS(parent_template, Object)
DECL_ACCESSORS(named_property_handler, Object)
DECL_ACCESSORS(indexed_property_handler, Object)
@@ -11577,11 +11368,15 @@ class FunctionTemplateInfo: public TemplateInfo {
DECLARE_PRINTER(FunctionTemplateInfo)
DECLARE_VERIFIER(FunctionTemplateInfo)
+ static const int kInvalidSerialNumber = 0;
+
static const int kCallCodeOffset = TemplateInfo::kHeaderSize;
static const int kPrototypeTemplateOffset =
kCallCodeOffset + kPointerSize;
- static const int kParentTemplateOffset =
+ static const int kPrototypeProviderTemplateOffset =
kPrototypeTemplateOffset + kPointerSize;
+ static const int kParentTemplateOffset =
+ kPrototypeProviderTemplateOffset + kPointerSize;
static const int kNamedPropertyHandlerOffset =
kParentTemplateOffset + kPointerSize;
static const int kIndexedPropertyHandlerOffset =
@@ -11755,11 +11550,6 @@ class BreakPointInfo: public Struct {
};
-#undef DECL_BOOLEAN_ACCESSORS
-#undef DECL_ACCESSORS
-#undef DECLARE_CAST
-#undef DECLARE_VERIFIER
-
#define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \
V(kStringTable, "string_table", "(Internalized strings)") \
V(kExternalStringsTable, "external_strings_table", "(External strings)") \
@@ -11879,4 +11669,6 @@ class BooleanBit : public AllStatic {
} // NOLINT, false-positive due to second-order macros.
} // NOLINT, false-positive due to second-order macros.
+#include "src/objects/object-macros-undef.h"
+
#endif // V8_OBJECTS_H_