diff options
Diffstat (limited to 'deps/v8/src/objects.h')
-rw-r--r-- | deps/v8/src/objects.h | 134 |
1 files changed, 96 insertions, 38 deletions
diff --git a/deps/v8/src/objects.h b/deps/v8/src/objects.h index 3ca89f08ea..e32c41bb13 100644 --- a/deps/v8/src/objects.h +++ b/deps/v8/src/objects.h @@ -330,10 +330,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; V(SLICED_STRING_TYPE) \ V(EXTERNAL_STRING_TYPE) \ V(EXTERNAL_ASCII_STRING_TYPE) \ - V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ + V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ V(SHORT_EXTERNAL_STRING_TYPE) \ V(SHORT_EXTERNAL_ASCII_STRING_TYPE) \ - V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ + V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ \ V(INTERNALIZED_STRING_TYPE) \ V(ASCII_INTERNALIZED_STRING_TYPE) \ @@ -341,10 +341,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \ V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ - V(EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE) \ + V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ - V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE) \ + V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ \ V(SYMBOL_TYPE) \ V(MAP_TYPE) \ @@ -366,6 +366,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; V(EXTERNAL_INT_ARRAY_TYPE) \ V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ V(EXTERNAL_FLOAT_ARRAY_TYPE) \ + V(EXTERNAL_DOUBLE_ARRAY_TYPE) \ V(EXTERNAL_PIXEL_ARRAY_TYPE) \ V(FILLER_TYPE) \ \ @@ -460,10 +461,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; ExternalAsciiString::kSize, \ external_ascii_string, \ ExternalAsciiString) \ - V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ + V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \ ExternalTwoByteString::kSize, \ - external_string_with_ascii_data, \ - ExternalStringWithAsciiData) \ + external_string_with_one_bytei_data, \ + ExternalStringWithOneByteData) \ V(SHORT_EXTERNAL_STRING_TYPE, \ ExternalTwoByteString::kShortSize, \ short_external_string, \ @@ -472,10 +473,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; ExternalAsciiString::kShortSize, \ short_external_ascii_string, \ ShortExternalAsciiString) \ - V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ + V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \ ExternalTwoByteString::kShortSize, \ - short_external_string_with_ascii_data, \ - ShortExternalStringWithAsciiData) \ + short_external_string_with_one_byte_data, \ + ShortExternalStringWithOneByteData) \ \ V(INTERNALIZED_STRING_TYPE, \ kVariableSizeSentinel, \ @@ -501,10 +502,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; ExternalAsciiString::kSize, \ external_ascii_internalized_string, \ ExternalAsciiInternalizedString) \ - V(EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE, \ + V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ ExternalTwoByteString::kSize, \ - external_internalized_string_with_ascii_data, \ - ExternalInternalizedStringWithAsciiData) \ + external_internalized_string_with_one_byte_data, \ + ExternalInternalizedStringWithOneByteData) \ V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \ ExternalTwoByteString::kShortSize, \ short_external_internalized_string, \ @@ -513,10 +514,10 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; ExternalAsciiString::kShortSize, \ short_external_ascii_internalized_string, \ ShortExternalAsciiInternalizedString) \ - V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE, \ + V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ ExternalTwoByteString::kShortSize, \ - short_external_internalized_string_with_ascii_data, \ - ShortExternalInternalizedStringWithAsciiData) \ + short_external_internalized_string_with_one_byte_data, \ + ShortExternalInternalizedStringWithOneByteData) \ // A struct is a simple object a set of object-valued fields. Including an // object type in this causes the compiler to generate most of the boilerplate @@ -604,9 +605,9 @@ const uint32_t kSlicedNotConsMask = kSlicedStringTag & ~kConsStringTag; STATIC_ASSERT(IS_POWER_OF_TWO(kSlicedNotConsMask) && kSlicedNotConsMask != 0); // If bit 7 is clear, then bit 3 indicates whether this two-byte -// string actually contains ASCII data. -const uint32_t kAsciiDataHintMask = 0x08; -const uint32_t kAsciiDataHintTag = 0x08; +// string actually contains one byte data. +const uint32_t kOneByteDataHintMask = 0x08; +const uint32_t kOneByteDataHintTag = 0x08; // If bit 7 is clear and string representation indicates an external string, // then bit 4 indicates whether the data pointer is cached. @@ -636,13 +637,13 @@ enum InstanceType { SLICED_ASCII_STRING_TYPE = kOneByteStringTag | kSlicedStringTag, EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, EXTERNAL_ASCII_STRING_TYPE = kOneByteStringTag | kExternalStringTag, - EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = - EXTERNAL_STRING_TYPE | kAsciiDataHintTag, + EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = + EXTERNAL_STRING_TYPE | kOneByteDataHintTag, SHORT_EXTERNAL_STRING_TYPE = EXTERNAL_STRING_TYPE | kShortExternalStringTag, SHORT_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE | kShortExternalStringTag, - SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = - EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kShortExternalStringTag, + SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = + EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kShortExternalStringTag, INTERNALIZED_STRING_TYPE = STRING_TYPE | kInternalizedTag, ASCII_INTERNALIZED_STRING_TYPE = ASCII_STRING_TYPE | kInternalizedTag, @@ -652,14 +653,14 @@ enum InstanceType { EXTERNAL_INTERNALIZED_STRING_TYPE = EXTERNAL_STRING_TYPE | kInternalizedTag, EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE | kInternalizedTag, - EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE = - EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kInternalizedTag, + EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = + EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag, SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE = SHORT_EXTERNAL_STRING_TYPE | kInternalizedTag, SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = SHORT_EXTERNAL_ASCII_STRING_TYPE | kInternalizedTag, - SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE = - SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kInternalizedTag, + SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = + SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag, // Non-string names SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE @@ -1096,6 +1097,13 @@ class Object : public MaybeObject { Handle<Name> key, PropertyAttributes* attributes); + MUST_USE_RESULT static MaybeObject* GetPropertyOrFail( + Handle<Object> object, + Handle<Object> receiver, + LookupResult* result, + Handle<Name> key, + PropertyAttributes* attributes); + MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, LookupResult* result, Name* key, @@ -1569,6 +1577,15 @@ class JSReceiver: public HeapObject { Handle<Object> value, PropertyAttributes attributes, StrictModeFlag strict_mode); + + MUST_USE_RESULT static MaybeObject* SetPropertyOrFail( + Handle<JSReceiver> object, + Handle<Name> key, + Handle<Object> value, + PropertyAttributes attributes, + StrictModeFlag strict_mode, + StoreFromKeyed store_from_keyed = MAY_BE_STORE_FROM_KEYED); + // Can cause GC. MUST_USE_RESULT MaybeObject* SetProperty( Name* key, @@ -1721,6 +1738,8 @@ class JSObject: public JSReceiver { bool HasDictionaryArgumentsElements(); inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. + inline bool ShouldTrackAllocationInfo(); + inline void set_map_and_elements( Map* map, FixedArrayBase* value, @@ -4337,6 +4356,7 @@ class Code: public HeapObject { V(UNARY_OP_IC) \ V(BINARY_OP_IC) \ V(COMPARE_IC) \ + V(COMPARE_NIL_IC) \ V(TO_BOOLEAN_IC) enum Kind { @@ -4448,6 +4468,8 @@ class Code: public HeapObject { inline Kind kind(); inline InlineCacheState ic_state(); // Only valid for IC stubs. inline ExtraICState extra_ic_state(); // Only valid for IC stubs. + inline ExtraICState extended_extra_ic_state(); // Only valid for + // non-call IC stubs. inline StubType type(); // Only valid for monomorphic IC stubs. inline int arguments_count(); // Only valid for call IC stubs. @@ -4463,6 +4485,7 @@ class Code: public HeapObject { inline bool is_unary_op_stub() { return kind() == UNARY_OP_IC; } inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } + inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } // [major_key]: For kind STUB or BINARY_OP_IC, the major key. @@ -4541,6 +4564,9 @@ class Code: public HeapObject { inline byte to_boolean_state(); inline void set_to_boolean_state(byte value); + // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in. + byte compare_nil_state(); + // [has_function_cache]: For kind STUB tells whether there is a function // cache is passed to the stub. inline bool has_function_cache(); @@ -4560,6 +4586,7 @@ class Code: public HeapObject { // Find the first map in an IC stub. Map* FindFirstMap(); void FindAllMaps(MapHandleList* maps); + void ReplaceFirstMap(Map* replace); // Find the first code in an IC stub. Code* FindFirstCode(); @@ -4612,6 +4639,7 @@ class Code: public HeapObject { static inline Kind ExtractKindFromFlags(Flags flags); static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); + static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags); static inline int ExtractArgumentsCountFromFlags(Flags flags); static inline Flags RemoveTypeFromFlags(Flags flags); @@ -4751,8 +4779,11 @@ class Code: public HeapObject { class TypeField: public BitField<StubType, 3, 3> {}; class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; class KindField: public BitField<Kind, 7, 4> {}; - class ExtraICStateField: public BitField<ExtraICState, 11, 5> {}; - class IsPregeneratedField: public BitField<bool, 16, 1> {}; + class IsPregeneratedField: public BitField<bool, 11, 1> {}; + class ExtraICStateField: public BitField<ExtraICState, 12, 5> {}; + class ExtendedExtraICStateField: public BitField<ExtraICState, 12, + PlatformSmiTagging::kSmiValueSize - 12 + 1> {}; // NOLINT + STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) static const int kStackSlotsFirstBit = 0; @@ -4825,6 +4856,13 @@ class Code: public HeapObject { PlatformSmiTagging::kSmiValueSize - Code::kArgumentsCountShift + 1; static const int kMaxArguments = (1 << kArgumentsBits) - 1; + // ICs can use either argument count or ExtendedExtraIC, since their storage + // overlaps. + STATIC_ASSERT(ExtraICStateField::kShift + + ExtraICStateField::kSize + kArgumentsBits == + ExtendedExtraICStateField::kShift + + ExtendedExtraICStateField::kSize); + // This constant should be encodable in an ARM instruction. static const int kFlagsNotUsedInLookup = TypeField::kMask | CacheHolderField::kMask; @@ -5641,7 +5679,8 @@ class Script: public Struct { V(Math, pow, MathPow) \ V(Math, random, MathRandom) \ V(Math, max, MathMax) \ - V(Math, min, MathMin) + V(Math, min, MathMin) \ + V(Math, imul, MathImul) enum BuiltinFunctionId { @@ -6281,10 +6320,17 @@ class JSGeneratorObject: public JSObject { // [function]: The function corresponding to this generator object. DECL_ACCESSORS(function, JSFunction) - // [context]: The context of the suspended computation, or undefined. - DECL_ACCESSORS(context, Object) + // [context]: The context of the suspended computation. + DECL_ACCESSORS(context, Context) + + // [receiver]: The receiver of the suspended computation. + DECL_ACCESSORS(receiver, Object) // [continuation]: Offset into code of continuation. + // + // A positive offset indicates a suspended generator. The special + // kGeneratorExecuting and kGeneratorClosed values indicate that a generator + // cannot be resumed. inline int continuation(); inline void set_continuation(int continuation); @@ -6298,13 +6344,21 @@ class JSGeneratorObject: public JSObject { DECLARE_PRINTER(JSGeneratorObject) DECLARE_VERIFIER(JSGeneratorObject) + // Magic sentinel values for the continuation. + static const int kGeneratorExecuting = -1; + static const int kGeneratorClosed = 0; + // Layout description. static const int kFunctionOffset = JSObject::kHeaderSize; static const int kContextOffset = kFunctionOffset + kPointerSize; - static const int kContinuationOffset = kContextOffset + kPointerSize; + static const int kReceiverOffset = kContextOffset + kPointerSize; + static const int kContinuationOffset = kReceiverOffset + kPointerSize; static const int kOperandStackOffset = kContinuationOffset + kPointerSize; static const int kSize = kOperandStackOffset + kPointerSize; + // Resume mode, for use by runtime functions. + enum ResumeMode { SEND, THROW }; + private: DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); }; @@ -7245,9 +7299,9 @@ class AllocationSiteInfo: public Struct { // Returns NULL if no AllocationSiteInfo is available for object. static AllocationSiteInfo* FindForJSObject(JSObject* object); - - static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind); - static AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); + static inline AllocationSiteMode GetMode( + ElementsKind boilerplate_elements_kind); + static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); static const int kPayloadOffset = HeapObject::kHeaderSize; static const int kSize = kPayloadOffset + kPointerSize; @@ -7582,7 +7636,7 @@ class String: public Name { // NOTE: this should be considered only a hint. False negatives are // possible. - inline bool HasOnlyAsciiChars(); + inline bool HasOnlyOneByteChars(); inline bool IsOneByteConvertible(); @@ -8554,7 +8608,7 @@ class JSWeakMap: public JSObject { class JSArrayBuffer: public JSObject { public: - // [backing_store]: backing memory for thsi array + // [backing_store]: backing memory for this array DECL_ACCESSORS(backing_store, void) // [byte_length]: length in bytes @@ -8699,6 +8753,10 @@ class JSArray: public JSObject { }; +Handle<Object> CacheInitialJSArrayMaps(Handle<Context> native_context, + Handle<Map> initial_map); + + // JSRegExpResult is just a JSArray with a specific initial map. // This initial map adds in-object properties for "index" and "input" // properties, as assigned by RegExp.prototype.exec, which allows |