| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 Object* GetHash(); | 1396 Object* GetHash(); |
| 1397 | 1397 |
| 1398 // Returns the permanent hash code associated with this object depending on | 1398 // Returns the permanent hash code associated with this object depending on |
| 1399 // the actual object type. May create and store a hash code if needed and none | 1399 // the actual object type. May create and store a hash code if needed and none |
| 1400 // exists. | 1400 // exists. |
| 1401 static Smi* GetOrCreateHash(Isolate* isolate, Handle<Object> object); | 1401 static Smi* GetOrCreateHash(Isolate* isolate, Handle<Object> object); |
| 1402 | 1402 |
| 1403 // Checks whether this object has the same value as the given one. This | 1403 // Checks whether this object has the same value as the given one. This |
| 1404 // function is implemented according to ES5, section 9.12 and can be used | 1404 // function is implemented according to ES5, section 9.12 and can be used |
| 1405 // to implement the Harmony "egal" function. | 1405 // to implement the Harmony "egal" function. |
| 1406 bool SameValue(Object* other); | 1406 V8_EXPORT_PRIVATE bool SameValue(Object* other); |
| 1407 | 1407 |
| 1408 // Checks whether this object has the same value as the given one. | 1408 // Checks whether this object has the same value as the given one. |
| 1409 // +0 and -0 are treated equal. Everything else is the same as SameValue. | 1409 // +0 and -0 are treated equal. Everything else is the same as SameValue. |
| 1410 // This function is implemented according to ES6, section 7.2.4 and is used | 1410 // This function is implemented according to ES6, section 7.2.4 and is used |
| 1411 // by ES6 Map and Set. | 1411 // by ES6 Map and Set. |
| 1412 bool SameValueZero(Object* other); | 1412 bool SameValueZero(Object* other); |
| 1413 | 1413 |
| 1414 // ES6 section 9.4.2.3 ArraySpeciesCreate (part of it) | 1414 // ES6 section 9.4.2.3 ArraySpeciesCreate (part of it) |
| 1415 MUST_USE_RESULT static MaybeHandle<Object> ArraySpeciesConstructor( | 1415 MUST_USE_RESULT static MaybeHandle<Object> ArraySpeciesConstructor( |
| 1416 Isolate* isolate, Handle<Object> original_array); | 1416 Isolate* isolate, Handle<Object> original_array); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 // In objects.h to be usable without objects-inl.h inclusion. | 1483 // In objects.h to be usable without objects-inl.h inclusion. |
| 1484 bool Object::IsSmi() const { return HAS_SMI_TAG(this); } | 1484 bool Object::IsSmi() const { return HAS_SMI_TAG(this); } |
| 1485 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); } | 1485 bool Object::IsHeapObject() const { return Internals::HasHeapObjectTag(this); } |
| 1486 | 1486 |
| 1487 | 1487 |
| 1488 struct Brief { | 1488 struct Brief { |
| 1489 explicit Brief(const Object* const v) : value(v) {} | 1489 explicit Brief(const Object* const v) : value(v) {} |
| 1490 const Object* value; | 1490 const Object* value; |
| 1491 }; | 1491 }; |
| 1492 | 1492 |
| 1493 | 1493 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const Brief& v); |
| 1494 std::ostream& operator<<(std::ostream& os, const Brief& v); | |
| 1495 | |
| 1496 | 1494 |
| 1497 // Smi represents integer Numbers that can be stored in 31 bits. | 1495 // Smi represents integer Numbers that can be stored in 31 bits. |
| 1498 // Smis are immediate which means they are NOT allocated in the heap. | 1496 // Smis are immediate which means they are NOT allocated in the heap. |
| 1499 // The this pointer has the following format: [31 bit signed int] 0 | 1497 // The this pointer has the following format: [31 bit signed int] 0 |
| 1500 // For long smis it has the following format: | 1498 // For long smis it has the following format: |
| 1501 // [32 bit signed int] [31 bits zero padding] 0 | 1499 // [32 bit signed int] [31 bits zero padding] 0 |
| 1502 // Smi stands for small integer. | 1500 // Smi stands for small integer. |
| 1503 class Smi: public Object { | 1501 class Smi: public Object { |
| 1504 public: | 1502 public: |
| 1505 // Returns the integer value. | 1503 // Returns the integer value. |
| (...skipping 2992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4498 bool Equals(ScopeInfo* other) const; | 4496 bool Equals(ScopeInfo* other) const; |
| 4499 #endif | 4497 #endif |
| 4500 | 4498 |
| 4501 static Handle<ScopeInfo> Create(Isolate* isolate, Zone* zone, Scope* scope, | 4499 static Handle<ScopeInfo> Create(Isolate* isolate, Zone* zone, Scope* scope, |
| 4502 MaybeHandle<ScopeInfo> outer_scope); | 4500 MaybeHandle<ScopeInfo> outer_scope); |
| 4503 static Handle<ScopeInfo> CreateForWithScope( | 4501 static Handle<ScopeInfo> CreateForWithScope( |
| 4504 Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope); | 4502 Isolate* isolate, MaybeHandle<ScopeInfo> outer_scope); |
| 4505 static Handle<ScopeInfo> CreateGlobalThisBinding(Isolate* isolate); | 4503 static Handle<ScopeInfo> CreateGlobalThisBinding(Isolate* isolate); |
| 4506 | 4504 |
| 4507 // Serializes empty scope info. | 4505 // Serializes empty scope info. |
| 4508 static ScopeInfo* Empty(Isolate* isolate); | 4506 V8_EXPORT_PRIVATE static ScopeInfo* Empty(Isolate* isolate); |
| 4509 | 4507 |
| 4510 #ifdef DEBUG | 4508 #ifdef DEBUG |
| 4511 void Print(); | 4509 void Print(); |
| 4512 #endif | 4510 #endif |
| 4513 | 4511 |
| 4514 // The layout of the static part of a ScopeInfo is as follows. Each entry is | 4512 // The layout of the static part of a ScopeInfo is as follows. Each entry is |
| 4515 // numeric and occupies one array slot. | 4513 // numeric and occupies one array slot. |
| 4516 // 1. A set of properties of the scope. | 4514 // 1. A set of properties of the scope. |
| 4517 // 2. The number of parameters. For non-function scopes this is 0. | 4515 // 2. The number of parameters. For non-function scopes this is 0. |
| 4518 // 3. The number of non-parameter variables allocated on the stack. | 4516 // 3. The number of non-parameter variables allocated on the stack. |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5197 #endif | 5195 #endif |
| 5198 }; | 5196 }; |
| 5199 | 5197 |
| 5200 | 5198 |
| 5201 // A literals array contains the literals for a JSFunction. It also holds | 5199 // A literals array contains the literals for a JSFunction. It also holds |
| 5202 // the type feedback vector. | 5200 // the type feedback vector. |
| 5203 class LiteralsArray : public FixedArray { | 5201 class LiteralsArray : public FixedArray { |
| 5204 public: | 5202 public: |
| 5205 static const int kVectorIndex = 0; | 5203 static const int kVectorIndex = 0; |
| 5206 static const int kFirstLiteralIndex = 1; | 5204 static const int kFirstLiteralIndex = 1; |
| 5207 static const int kFeedbackVectorOffset; | 5205 V8_EXPORT_PRIVATE static const int kFeedbackVectorOffset; |
| 5208 static const int kOffsetToFirstLiteral; | 5206 static const int kOffsetToFirstLiteral; |
| 5209 | 5207 |
| 5210 static int OffsetOfLiteralAt(int index) { | 5208 static int OffsetOfLiteralAt(int index) { |
| 5211 return OffsetOfElementAt(index + kFirstLiteralIndex); | 5209 return OffsetOfElementAt(index + kFirstLiteralIndex); |
| 5212 } | 5210 } |
| 5213 | 5211 |
| 5214 inline TypeFeedbackVector* feedback_vector() const; | 5212 inline TypeFeedbackVector* feedback_vector() const; |
| 5215 inline void set_feedback_vector(TypeFeedbackVector* vector); | 5213 inline void set_feedback_vector(TypeFeedbackVector* vector); |
| 5216 inline Object* literal(int literal_index) const; | 5214 inline Object* literal(int literal_index) const; |
| 5217 inline void set_literal(int literal_index, Object* literal); | 5215 inline void set_literal(int literal_index, Object* literal); |
| (...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7296 // Add or update entry in the optimized code map for context-dependent code. | 7294 // Add or update entry in the optimized code map for context-dependent code. |
| 7297 // If {code} is not given, then an existing entry's code won't be overwritten. | 7295 // If {code} is not given, then an existing entry's code won't be overwritten. |
| 7298 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, | 7296 static void AddToOptimizedCodeMap(Handle<SharedFunctionInfo> shared, |
| 7299 Handle<Context> native_context, | 7297 Handle<Context> native_context, |
| 7300 MaybeHandle<Code> code, | 7298 MaybeHandle<Code> code, |
| 7301 Handle<LiteralsArray> literals, | 7299 Handle<LiteralsArray> literals, |
| 7302 BailoutId osr_ast_id); | 7300 BailoutId osr_ast_id); |
| 7303 | 7301 |
| 7304 // Set up the link between shared function info and the script. The shared | 7302 // Set up the link between shared function info and the script. The shared |
| 7305 // function info is added to the list on the script. | 7303 // function info is added to the list on the script. |
| 7306 static void SetScript(Handle<SharedFunctionInfo> shared, | 7304 V8_EXPORT_PRIVATE static void SetScript(Handle<SharedFunctionInfo> shared, |
| 7307 Handle<Object> script_object); | 7305 Handle<Object> script_object); |
| 7308 | 7306 |
| 7309 // Layout description of the optimized code map. | 7307 // Layout description of the optimized code map. |
| 7310 static const int kEntriesStart = 0; | 7308 static const int kEntriesStart = 0; |
| 7311 static const int kContextOffset = 0; | 7309 static const int kContextOffset = 0; |
| 7312 static const int kCachedCodeOffset = 1; | 7310 static const int kCachedCodeOffset = 1; |
| 7313 static const int kLiteralsOffset = 2; | 7311 static const int kLiteralsOffset = 2; |
| 7314 static const int kOsrAstIdOffset = 3; | 7312 static const int kOsrAstIdOffset = 3; |
| 7315 static const int kEntryLength = 4; | 7313 static const int kEntryLength = 4; |
| 7316 static const int kInitialLength = kEntriesStart + kEntryLength; | 7314 static const int kInitialLength = kEntriesStart + kEntryLength; |
| 7317 | 7315 |
| (...skipping 3448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10766 inline bool was_neutered(); | 10764 inline bool was_neutered(); |
| 10767 inline void set_was_neutered(bool value); | 10765 inline void set_was_neutered(bool value); |
| 10768 | 10766 |
| 10769 inline bool is_shared(); | 10767 inline bool is_shared(); |
| 10770 inline void set_is_shared(bool value); | 10768 inline void set_is_shared(bool value); |
| 10771 | 10769 |
| 10772 DECLARE_CAST(JSArrayBuffer) | 10770 DECLARE_CAST(JSArrayBuffer) |
| 10773 | 10771 |
| 10774 void Neuter(); | 10772 void Neuter(); |
| 10775 | 10773 |
| 10776 static void Setup(Handle<JSArrayBuffer> array_buffer, Isolate* isolate, | 10774 V8_EXPORT_PRIVATE static void Setup( |
| 10777 bool is_external, void* data, size_t allocated_length, | 10775 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, bool is_external, |
| 10778 SharedFlag shared = SharedFlag::kNotShared); | 10776 void* data, size_t allocated_length, |
| 10777 SharedFlag shared = SharedFlag::kNotShared); |
| 10779 | 10778 |
| 10780 static bool SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, | 10779 static bool SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, |
| 10781 Isolate* isolate, size_t allocated_length, | 10780 Isolate* isolate, size_t allocated_length, |
| 10782 bool initialize = true, | 10781 bool initialize = true, |
| 10783 SharedFlag shared = SharedFlag::kNotShared); | 10782 SharedFlag shared = SharedFlag::kNotShared); |
| 10784 | 10783 |
| 10785 // Dispatched behavior. | 10784 // Dispatched behavior. |
| 10786 DECLARE_PRINTER(JSArrayBuffer) | 10785 DECLARE_PRINTER(JSArrayBuffer) |
| 10787 DECLARE_VERIFIER(JSArrayBuffer) | 10786 DECLARE_VERIFIER(JSArrayBuffer) |
| 10788 | 10787 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10847 | 10846 |
| 10848 class JSTypedArray: public JSArrayBufferView { | 10847 class JSTypedArray: public JSArrayBufferView { |
| 10849 public: | 10848 public: |
| 10850 // [length]: length of typed array in elements. | 10849 // [length]: length of typed array in elements. |
| 10851 DECL_ACCESSORS(length, Object) | 10850 DECL_ACCESSORS(length, Object) |
| 10852 inline uint32_t length_value() const; | 10851 inline uint32_t length_value() const; |
| 10853 | 10852 |
| 10854 DECLARE_CAST(JSTypedArray) | 10853 DECLARE_CAST(JSTypedArray) |
| 10855 | 10854 |
| 10856 ExternalArrayType type(); | 10855 ExternalArrayType type(); |
| 10857 size_t element_size(); | 10856 V8_EXPORT_PRIVATE size_t element_size(); |
| 10858 | 10857 |
| 10859 Handle<JSArrayBuffer> GetBuffer(); | 10858 Handle<JSArrayBuffer> GetBuffer(); |
| 10860 | 10859 |
| 10861 // Dispatched behavior. | 10860 // Dispatched behavior. |
| 10862 DECLARE_PRINTER(JSTypedArray) | 10861 DECLARE_PRINTER(JSTypedArray) |
| 10863 DECLARE_VERIFIER(JSTypedArray) | 10862 DECLARE_VERIFIER(JSTypedArray) |
| 10864 | 10863 |
| 10865 static const int kLengthOffset = kViewSize + kPointerSize; | 10864 static const int kLengthOffset = kViewSize + kPointerSize; |
| 10866 static const int kSize = kLengthOffset + kPointerSize; | 10865 static const int kSize = kLengthOffset + kPointerSize; |
| 10867 | 10866 |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11607 } | 11606 } |
| 11608 return value; | 11607 return value; |
| 11609 } | 11608 } |
| 11610 }; | 11609 }; |
| 11611 | 11610 |
| 11612 | 11611 |
| 11613 } // NOLINT, false-positive due to second-order macros. | 11612 } // NOLINT, false-positive due to second-order macros. |
| 11614 } // NOLINT, false-positive due to second-order macros. | 11613 } // NOLINT, false-positive due to second-order macros. |
| 11615 | 11614 |
| 11616 #endif // V8_OBJECTS_H_ | 11615 #endif // V8_OBJECTS_H_ |
| OLD | NEW |