OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
838 enum CompareResult { | 838 enum CompareResult { |
839 LESS = -1, | 839 LESS = -1, |
840 EQUAL = 0, | 840 EQUAL = 0, |
841 GREATER = 1, | 841 GREATER = 1, |
842 | 842 |
843 NOT_EQUAL = GREATER | 843 NOT_EQUAL = GREATER |
844 }; | 844 }; |
845 | 845 |
846 | 846 |
847 #define DECL_BOOLEAN_ACCESSORS(name) \ | 847 #define DECL_BOOLEAN_ACCESSORS(name) \ |
848 inline bool name(); \ | 848 inline bool name() const; \ |
849 inline void set_##name(bool value); \ | 849 inline void set_##name(bool value); \ |
850 | 850 |
851 | 851 |
852 #define DECL_ACCESSORS(name, type) \ | 852 #define DECL_ACCESSORS(name, type) \ |
853 inline type* name(); \ | 853 inline type* name() const; \ |
854 inline void set_##name(type* value, \ | 854 inline void set_##name(type* value, \ |
Benedikt Meurer
2014/06/20 09:45:20
I guess it's not yet possible to say "const type*
Sven Panne
2014/06/20 10:21:58
Nope, you would need const-correct IsFOO for that
| |
855 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ | 855 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ |
856 | 856 |
857 class AccessorPair; | 857 class AccessorPair; |
858 class AllocationSite; | 858 class AllocationSite; |
859 class AllocationSiteCreationContext; | 859 class AllocationSiteCreationContext; |
860 class AllocationSiteUsageContext; | 860 class AllocationSiteUsageContext; |
861 class DictionaryElementsAccessor; | 861 class DictionaryElementsAccessor; |
862 class ElementsAccessor; | 862 class ElementsAccessor; |
863 class FixedArrayBase; | 863 class FixedArrayBase; |
864 class GlobalObject; | 864 class GlobalObject; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1569 | 1569 |
1570 // Smi represents integer Numbers that can be stored in 31 bits. | 1570 // Smi represents integer Numbers that can be stored in 31 bits. |
1571 // Smis are immediate which means they are NOT allocated in the heap. | 1571 // Smis are immediate which means they are NOT allocated in the heap. |
1572 // The this pointer has the following format: [31 bit signed int] 0 | 1572 // The this pointer has the following format: [31 bit signed int] 0 |
1573 // For long smis it has the following format: | 1573 // For long smis it has the following format: |
1574 // [32 bit signed int] [31 bits zero padding] 0 | 1574 // [32 bit signed int] [31 bits zero padding] 0 |
1575 // Smi stands for small integer. | 1575 // Smi stands for small integer. |
1576 class Smi: public Object { | 1576 class Smi: public Object { |
1577 public: | 1577 public: |
1578 // Returns the integer value. | 1578 // Returns the integer value. |
1579 inline int value(); | 1579 inline int value() const; |
1580 | 1580 |
1581 // Convert a value to a Smi object. | 1581 // Convert a value to a Smi object. |
1582 static inline Smi* FromInt(int value); | 1582 static inline Smi* FromInt(int value); |
1583 | 1583 |
1584 static inline Smi* FromIntptr(intptr_t value); | 1584 static inline Smi* FromIntptr(intptr_t value); |
1585 | 1585 |
1586 // Returns whether value can be represented in a Smi. | 1586 // Returns whether value can be represented in a Smi. |
1587 static inline bool IsValid(intptr_t value); | 1587 static inline bool IsValid(intptr_t value); |
1588 | 1588 |
1589 // Casting. | 1589 // Casting. |
(...skipping 16 matching lines...) Expand all Loading... | |
1606 | 1606 |
1607 // Heap objects typically have a map pointer in their first word. However, | 1607 // Heap objects typically have a map pointer in their first word. However, |
1608 // during GC other data (e.g. mark bits, forwarding addresses) is sometimes | 1608 // during GC other data (e.g. mark bits, forwarding addresses) is sometimes |
1609 // encoded in the first word. The class MapWord is an abstraction of the | 1609 // encoded in the first word. The class MapWord is an abstraction of the |
1610 // value in a heap object's first word. | 1610 // value in a heap object's first word. |
1611 class MapWord BASE_EMBEDDED { | 1611 class MapWord BASE_EMBEDDED { |
1612 public: | 1612 public: |
1613 // Normal state: the map word contains a map pointer. | 1613 // Normal state: the map word contains a map pointer. |
1614 | 1614 |
1615 // Create a map word from a map pointer. | 1615 // Create a map word from a map pointer. |
1616 static inline MapWord FromMap(Map* map); | 1616 static inline MapWord FromMap(const Map* map); |
1617 | 1617 |
1618 // View this map word as a map pointer. | 1618 // View this map word as a map pointer. |
1619 inline Map* ToMap(); | 1619 inline Map* ToMap(); |
1620 | 1620 |
1621 | 1621 |
1622 // Scavenge collection: the map word of live objects in the from space | 1622 // Scavenge collection: the map word of live objects in the from space |
1623 // contains a forwarding address (a heap object pointer in the to space). | 1623 // contains a forwarding address (a heap object pointer in the to space). |
1624 | 1624 |
1625 // True if this map word is a forwarding address for a scavenge | 1625 // True if this map word is a forwarding address for a scavenge |
1626 // collection. Only valid during a scavenge collection (specifically, | 1626 // collection. Only valid during a scavenge collection (specifically, |
(...skipping 23 matching lines...) Expand all Loading... | |
1650 uintptr_t value_; | 1650 uintptr_t value_; |
1651 }; | 1651 }; |
1652 | 1652 |
1653 | 1653 |
1654 // HeapObject is the superclass for all classes describing heap allocated | 1654 // HeapObject is the superclass for all classes describing heap allocated |
1655 // objects. | 1655 // objects. |
1656 class HeapObject: public Object { | 1656 class HeapObject: public Object { |
1657 public: | 1657 public: |
1658 // [map]: Contains a map which contains the object's reflective | 1658 // [map]: Contains a map which contains the object's reflective |
1659 // information. | 1659 // information. |
1660 inline Map* map(); | 1660 inline Map* map() const; |
1661 inline void set_map(Map* value); | 1661 inline void set_map(Map* value); |
1662 // The no-write-barrier version. This is OK if the object is white and in | 1662 // The no-write-barrier version. This is OK if the object is white and in |
1663 // new space, or if the value is an immortal immutable object, like the maps | 1663 // new space, or if the value is an immortal immutable object, like the maps |
1664 // of primitive (non-JS) objects like strings, heap numbers etc. | 1664 // of primitive (non-JS) objects like strings, heap numbers etc. |
1665 inline void set_map_no_write_barrier(Map* value); | 1665 inline void set_map_no_write_barrier(Map* value); |
1666 | 1666 |
1667 // Get the map using acquire load. | 1667 // Get the map using acquire load. |
1668 inline Map* synchronized_map(); | 1668 inline Map* synchronized_map(); |
1669 inline MapWord synchronized_map_word(); | 1669 inline MapWord synchronized_map_word() const; |
1670 | 1670 |
1671 // Set the map using release store | 1671 // Set the map using release store |
1672 inline void synchronized_set_map(Map* value); | 1672 inline void synchronized_set_map(Map* value); |
1673 inline void synchronized_set_map_no_write_barrier(Map* value); | 1673 inline void synchronized_set_map_no_write_barrier(Map* value); |
1674 inline void synchronized_set_map_word(MapWord map_word); | 1674 inline void synchronized_set_map_word(MapWord map_word); |
1675 | 1675 |
1676 // During garbage collection, the map word of a heap object does not | 1676 // During garbage collection, the map word of a heap object does not |
1677 // necessarily contain a map pointer. | 1677 // necessarily contain a map pointer. |
1678 inline MapWord map_word(); | 1678 inline MapWord map_word() const; |
1679 inline void set_map_word(MapWord map_word); | 1679 inline void set_map_word(MapWord map_word); |
1680 | 1680 |
1681 // The Heap the object was allocated in. Used also to access Isolate. | 1681 // The Heap the object was allocated in. Used also to access Isolate. |
1682 inline Heap* GetHeap(); | 1682 inline Heap* GetHeap() const; |
1683 | 1683 |
1684 // Convenience method to get current isolate. | 1684 // Convenience method to get current isolate. |
1685 inline Isolate* GetIsolate(); | 1685 inline Isolate* GetIsolate(); |
1686 | 1686 |
1687 // Converts an address to a HeapObject pointer. | 1687 // Converts an address to a HeapObject pointer. |
1688 static inline HeapObject* FromAddress(Address address); | 1688 static inline HeapObject* FromAddress(Address address); |
1689 | 1689 |
1690 // Returns the address of this HeapObject. | 1690 // Returns the address of this HeapObject. |
1691 inline Address address(); | 1691 inline Address address(); |
1692 | 1692 |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2863 | 2863 |
2864 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2864 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
2865 }; | 2865 }; |
2866 | 2866 |
2867 | 2867 |
2868 // Common superclass for FixedArrays that allow implementations to share | 2868 // Common superclass for FixedArrays that allow implementations to share |
2869 // common accessors and some code paths. | 2869 // common accessors and some code paths. |
2870 class FixedArrayBase: public HeapObject { | 2870 class FixedArrayBase: public HeapObject { |
2871 public: | 2871 public: |
2872 // [length]: length of the array. | 2872 // [length]: length of the array. |
2873 inline int length(); | 2873 inline int length() const; |
2874 inline void set_length(int value); | 2874 inline void set_length(int value); |
2875 | 2875 |
2876 // Get and set the length using acquire loads and release stores. | 2876 // Get and set the length using acquire loads and release stores. |
2877 inline int synchronized_length(); | 2877 inline int synchronized_length() const; |
2878 inline void synchronized_set_length(int value); | 2878 inline void synchronized_set_length(int value); |
2879 | 2879 |
2880 inline static FixedArrayBase* cast(Object* object); | 2880 inline static FixedArrayBase* cast(Object* object); |
2881 | 2881 |
2882 // Layout description. | 2882 // Layout description. |
2883 // Length is smi tagged when it is stored. | 2883 // Length is smi tagged when it is stored. |
2884 static const int kLengthOffset = HeapObject::kHeaderSize; | 2884 static const int kLengthOffset = HeapObject::kHeaderSize; |
2885 static const int kHeaderSize = kLengthOffset + kPointerSize; | 2885 static const int kHeaderSize = kLengthOffset + kPointerSize; |
2886 }; | 2886 }; |
2887 | 2887 |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4886 private: | 4886 private: |
4887 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); | 4887 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); |
4888 }; | 4888 }; |
4889 | 4889 |
4890 | 4890 |
4891 // FreeSpace represents fixed sized areas of the heap that are not currently in | 4891 // FreeSpace represents fixed sized areas of the heap that are not currently in |
4892 // use. Used by the heap and GC. | 4892 // use. Used by the heap and GC. |
4893 class FreeSpace: public HeapObject { | 4893 class FreeSpace: public HeapObject { |
4894 public: | 4894 public: |
4895 // [size]: size of the free space including the header. | 4895 // [size]: size of the free space including the header. |
4896 inline int size(); | 4896 inline int size() const; |
4897 inline void set_size(int value); | 4897 inline void set_size(int value); |
4898 | 4898 |
4899 inline int nobarrier_size(); | 4899 inline int nobarrier_size() const; |
4900 inline void nobarrier_set_size(int value); | 4900 inline void nobarrier_set_size(int value); |
4901 | 4901 |
4902 inline int Size() { return size(); } | 4902 inline int Size() { return size(); } |
4903 | 4903 |
4904 // Casting. | 4904 // Casting. |
4905 static inline FreeSpace* cast(Object* obj); | 4905 static inline FreeSpace* cast(Object* obj); |
4906 | 4906 |
4907 // Dispatched behavior. | 4907 // Dispatched behavior. |
4908 DECLARE_PRINTER(FreeSpace) | 4908 DECLARE_PRINTER(FreeSpace) |
4909 DECLARE_VERIFIER(FreeSpace) | 4909 DECLARE_VERIFIER(FreeSpace) |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5480 | 5480 |
5481 #ifdef ENABLE_DISASSEMBLER | 5481 #ifdef ENABLE_DISASSEMBLER |
5482 // Printing | 5482 // Printing |
5483 static const char* ICState2String(InlineCacheState state); | 5483 static const char* ICState2String(InlineCacheState state); |
5484 static const char* StubType2String(StubType type); | 5484 static const char* StubType2String(StubType type); |
5485 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); | 5485 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); |
5486 void Disassemble(const char* name, FILE* out = stdout); | 5486 void Disassemble(const char* name, FILE* out = stdout); |
5487 #endif // ENABLE_DISASSEMBLER | 5487 #endif // ENABLE_DISASSEMBLER |
5488 | 5488 |
5489 // [instruction_size]: Size of the native instructions | 5489 // [instruction_size]: Size of the native instructions |
5490 inline int instruction_size(); | 5490 inline int instruction_size() const; |
5491 inline void set_instruction_size(int value); | 5491 inline void set_instruction_size(int value); |
5492 | 5492 |
5493 // [relocation_info]: Code relocation information | 5493 // [relocation_info]: Code relocation information |
5494 DECL_ACCESSORS(relocation_info, ByteArray) | 5494 DECL_ACCESSORS(relocation_info, ByteArray) |
5495 void InvalidateRelocation(); | 5495 void InvalidateRelocation(); |
5496 void InvalidateEmbeddedObjects(); | 5496 void InvalidateEmbeddedObjects(); |
5497 | 5497 |
5498 // [handler_table]: Fixed array containing offsets of exception handlers. | 5498 // [handler_table]: Fixed array containing offsets of exception handlers. |
5499 DECL_ACCESSORS(handler_table, FixedArray) | 5499 DECL_ACCESSORS(handler_table, FixedArray) |
5500 | 5500 |
(...skipping 16 matching lines...) Expand all Loading... | |
5517 DECL_ACCESSORS(next_code_link, Object) | 5517 DECL_ACCESSORS(next_code_link, Object) |
5518 | 5518 |
5519 // [gc_metadata]: Field used to hold GC related metadata. The contents of this | 5519 // [gc_metadata]: Field used to hold GC related metadata. The contents of this |
5520 // field does not have to be traced during garbage collection since | 5520 // field does not have to be traced during garbage collection since |
5521 // it is only used by the garbage collector itself. | 5521 // it is only used by the garbage collector itself. |
5522 DECL_ACCESSORS(gc_metadata, Object) | 5522 DECL_ACCESSORS(gc_metadata, Object) |
5523 | 5523 |
5524 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age | 5524 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age |
5525 // at the moment when this object was created. | 5525 // at the moment when this object was created. |
5526 inline void set_ic_age(int count); | 5526 inline void set_ic_age(int count); |
5527 inline int ic_age(); | 5527 inline int ic_age() const; |
5528 | 5528 |
5529 // [prologue_offset]: Offset of the function prologue, used for aging | 5529 // [prologue_offset]: Offset of the function prologue, used for aging |
5530 // FUNCTIONs and OPTIMIZED_FUNCTIONs. | 5530 // FUNCTIONs and OPTIMIZED_FUNCTIONs. |
5531 inline int prologue_offset(); | 5531 inline int prologue_offset() const; |
5532 inline void set_prologue_offset(int offset); | 5532 inline void set_prologue_offset(int offset); |
5533 | 5533 |
5534 // Unchecked accessors to be used during GC. | 5534 // Unchecked accessors to be used during GC. |
5535 inline ByteArray* unchecked_relocation_info(); | 5535 inline ByteArray* unchecked_relocation_info(); |
5536 | 5536 |
5537 inline int relocation_size(); | 5537 inline int relocation_size(); |
5538 | 5538 |
5539 // [flags]: Various code flags. | 5539 // [flags]: Various code flags. |
5540 inline Flags flags(); | 5540 inline Flags flags(); |
5541 inline void set_flags(Flags flags); | 5541 inline void set_flags(Flags flags); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6282 || elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; | 6282 || elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS; |
6283 } | 6283 } |
6284 | 6284 |
6285 static bool IsValidElementsTransition(ElementsKind from_kind, | 6285 static bool IsValidElementsTransition(ElementsKind from_kind, |
6286 ElementsKind to_kind); | 6286 ElementsKind to_kind); |
6287 | 6287 |
6288 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 6288 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
6289 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 6289 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
6290 bool DictionaryElementsInPrototypeChainOnly(); | 6290 bool DictionaryElementsInPrototypeChainOnly(); |
6291 | 6291 |
6292 inline bool HasTransitionArray(); | 6292 inline bool HasTransitionArray() const; |
6293 inline bool HasElementsTransition(); | 6293 inline bool HasElementsTransition(); |
6294 inline Map* elements_transition_map(); | 6294 inline Map* elements_transition_map(); |
6295 static Handle<TransitionArray> SetElementsTransitionMap( | 6295 static Handle<TransitionArray> SetElementsTransitionMap( |
6296 Handle<Map> map, Handle<Map> transitioned_map); | 6296 Handle<Map> map, Handle<Map> transitioned_map); |
6297 inline Map* GetTransition(int transition_index); | 6297 inline Map* GetTransition(int transition_index); |
6298 inline int SearchTransition(Name* name); | 6298 inline int SearchTransition(Name* name); |
6299 inline FixedArrayBase* GetInitialElements(); | 6299 inline FixedArrayBase* GetInitialElements(); |
6300 | 6300 |
6301 DECL_ACCESSORS(transitions, TransitionArray) | 6301 DECL_ACCESSORS(transitions, TransitionArray) |
6302 | 6302 |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7101 DECL_ACCESSORS(scope_info, ScopeInfo) | 7101 DECL_ACCESSORS(scope_info, ScopeInfo) |
7102 | 7102 |
7103 // [construct stub]: Code stub for constructing instances of this function. | 7103 // [construct stub]: Code stub for constructing instances of this function. |
7104 DECL_ACCESSORS(construct_stub, Code) | 7104 DECL_ACCESSORS(construct_stub, Code) |
7105 | 7105 |
7106 // Returns if this function has been compiled to native code yet. | 7106 // Returns if this function has been compiled to native code yet. |
7107 inline bool is_compiled(); | 7107 inline bool is_compiled(); |
7108 | 7108 |
7109 // [length]: The function length - usually the number of declared parameters. | 7109 // [length]: The function length - usually the number of declared parameters. |
7110 // Use up to 2^30 parameters. | 7110 // Use up to 2^30 parameters. |
7111 inline int length(); | 7111 inline int length() const; |
7112 inline void set_length(int value); | 7112 inline void set_length(int value); |
7113 | 7113 |
7114 // [formal parameter count]: The declared number of parameters. | 7114 // [formal parameter count]: The declared number of parameters. |
7115 inline int formal_parameter_count(); | 7115 inline int formal_parameter_count() const; |
7116 inline void set_formal_parameter_count(int value); | 7116 inline void set_formal_parameter_count(int value); |
7117 | 7117 |
7118 // Set the formal parameter count so the function code will be | 7118 // Set the formal parameter count so the function code will be |
7119 // called without using argument adaptor frames. | 7119 // called without using argument adaptor frames. |
7120 inline void DontAdaptArguments(); | 7120 inline void DontAdaptArguments(); |
7121 | 7121 |
7122 // [expected_nof_properties]: Expected number of properties for the function. | 7122 // [expected_nof_properties]: Expected number of properties for the function. |
7123 inline int expected_nof_properties(); | 7123 inline int expected_nof_properties() const; |
7124 inline void set_expected_nof_properties(int value); | 7124 inline void set_expected_nof_properties(int value); |
7125 | 7125 |
7126 // [feedback_vector] - accumulates ast node feedback from full-codegen and | 7126 // [feedback_vector] - accumulates ast node feedback from full-codegen and |
7127 // (increasingly) from crankshafted code where sufficient feedback isn't | 7127 // (increasingly) from crankshafted code where sufficient feedback isn't |
7128 // available. Currently the field is duplicated in | 7128 // available. Currently the field is duplicated in |
7129 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. | 7129 // TypeFeedbackInfo::feedback_vector, but the allocation is done here. |
7130 DECL_ACCESSORS(feedback_vector, FixedArray) | 7130 DECL_ACCESSORS(feedback_vector, FixedArray) |
7131 | 7131 |
7132 // [instance class name]: class name for instances. | 7132 // [instance class name]: class name for instances. |
7133 DECL_ACCESSORS(instance_class_name, Object) | 7133 DECL_ACCESSORS(instance_class_name, Object) |
7134 | 7134 |
7135 // [function data]: This field holds some additional data for function. | 7135 // [function data]: This field holds some additional data for function. |
7136 // Currently it either has FunctionTemplateInfo to make benefit the API | 7136 // Currently it either has FunctionTemplateInfo to make benefit the API |
7137 // or Smi identifying a builtin function. | 7137 // or Smi identifying a builtin function. |
7138 // In the long run we don't want all functions to have this field but | 7138 // In the long run we don't want all functions to have this field but |
7139 // we can fix that when we have a better model for storing hidden data | 7139 // we can fix that when we have a better model for storing hidden data |
7140 // on objects. | 7140 // on objects. |
7141 DECL_ACCESSORS(function_data, Object) | 7141 DECL_ACCESSORS(function_data, Object) |
7142 | 7142 |
7143 inline bool IsApiFunction(); | 7143 inline bool IsApiFunction(); |
7144 inline FunctionTemplateInfo* get_api_func_data(); | 7144 inline FunctionTemplateInfo* get_api_func_data(); |
7145 inline bool HasBuiltinFunctionId(); | 7145 inline bool HasBuiltinFunctionId(); |
7146 inline BuiltinFunctionId builtin_function_id(); | 7146 inline BuiltinFunctionId builtin_function_id(); |
7147 | 7147 |
7148 // [script info]: Script from which the function originates. | 7148 // [script info]: Script from which the function originates. |
7149 DECL_ACCESSORS(script, Object) | 7149 DECL_ACCESSORS(script, Object) |
7150 | 7150 |
7151 // [num_literals]: Number of literals used by this function. | 7151 // [num_literals]: Number of literals used by this function. |
7152 inline int num_literals(); | 7152 inline int num_literals() const; |
7153 inline void set_num_literals(int value); | 7153 inline void set_num_literals(int value); |
7154 | 7154 |
7155 // [start_position_and_type]: Field used to store both the source code | 7155 // [start_position_and_type]: Field used to store both the source code |
7156 // position, whether or not the function is a function expression, | 7156 // position, whether or not the function is a function expression, |
7157 // and whether or not the function is a toplevel function. The two | 7157 // and whether or not the function is a toplevel function. The two |
7158 // least significants bit indicates whether the function is an | 7158 // least significants bit indicates whether the function is an |
7159 // expression and the rest contains the source code position. | 7159 // expression and the rest contains the source code position. |
7160 inline int start_position_and_type(); | 7160 inline int start_position_and_type() const; |
7161 inline void set_start_position_and_type(int value); | 7161 inline void set_start_position_and_type(int value); |
7162 | 7162 |
7163 // [debug info]: Debug information. | 7163 // [debug info]: Debug information. |
7164 DECL_ACCESSORS(debug_info, Object) | 7164 DECL_ACCESSORS(debug_info, Object) |
7165 | 7165 |
7166 // [inferred name]: Name inferred from variable or property | 7166 // [inferred name]: Name inferred from variable or property |
7167 // assignment of this function. Used to facilitate debugging and | 7167 // assignment of this function. Used to facilitate debugging and |
7168 // profiling of JavaScript code written in OO style, where almost | 7168 // profiling of JavaScript code written in OO style, where almost |
7169 // all functions are anonymous but are assigned to object | 7169 // all functions are anonymous but are assigned to object |
7170 // properties. | 7170 // properties. |
7171 DECL_ACCESSORS(inferred_name, String) | 7171 DECL_ACCESSORS(inferred_name, String) |
7172 | 7172 |
7173 // The function's name if it is non-empty, otherwise the inferred name. | 7173 // The function's name if it is non-empty, otherwise the inferred name. |
7174 String* DebugName(); | 7174 String* DebugName(); |
7175 | 7175 |
7176 // Position of the 'function' token in the script source. | 7176 // Position of the 'function' token in the script source. |
7177 inline int function_token_position(); | 7177 inline int function_token_position() const; |
7178 inline void set_function_token_position(int function_token_position); | 7178 inline void set_function_token_position(int function_token_position); |
7179 | 7179 |
7180 // Position of this function in the script source. | 7180 // Position of this function in the script source. |
7181 inline int start_position(); | 7181 inline int start_position(); |
7182 inline void set_start_position(int start_position); | 7182 inline void set_start_position(int start_position); |
7183 | 7183 |
7184 // End position of this function in the script source. | 7184 // End position of this function in the script source. |
7185 inline int end_position(); | 7185 inline int end_position() const; |
7186 inline void set_end_position(int end_position); | 7186 inline void set_end_position(int end_position); |
7187 | 7187 |
7188 // Is this function a function expression in the source code. | 7188 // Is this function a function expression in the source code. |
7189 DECL_BOOLEAN_ACCESSORS(is_expression) | 7189 DECL_BOOLEAN_ACCESSORS(is_expression) |
7190 | 7190 |
7191 // Is this function a top-level function (scripts, evals). | 7191 // Is this function a top-level function (scripts, evals). |
7192 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 7192 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
7193 | 7193 |
7194 // Bit field containing various information collected by the compiler to | 7194 // Bit field containing various information collected by the compiler to |
7195 // drive optimization. | 7195 // drive optimization. |
7196 inline int compiler_hints(); | 7196 inline int compiler_hints() const; |
7197 inline void set_compiler_hints(int value); | 7197 inline void set_compiler_hints(int value); |
7198 | 7198 |
7199 inline int ast_node_count(); | 7199 inline int ast_node_count() const; |
7200 inline void set_ast_node_count(int count); | 7200 inline void set_ast_node_count(int count); |
7201 | 7201 |
7202 inline int profiler_ticks(); | 7202 inline int profiler_ticks() const; |
7203 inline void set_profiler_ticks(int ticks); | 7203 inline void set_profiler_ticks(int ticks); |
7204 | 7204 |
7205 // Inline cache age is used to infer whether the function survived a context | 7205 // Inline cache age is used to infer whether the function survived a context |
7206 // disposal or not. In the former case we reset the opt_count. | 7206 // disposal or not. In the former case we reset the opt_count. |
7207 inline int ic_age(); | 7207 inline int ic_age(); |
7208 inline void set_ic_age(int age); | 7208 inline void set_ic_age(int age); |
7209 | 7209 |
7210 // Indicates if this function can be lazy compiled. | 7210 // Indicates if this function can be lazy compiled. |
7211 // This is used to determine if we can safely flush code from a function | 7211 // This is used to determine if we can safely flush code from a function |
7212 // when doing GC if we expect that the function will no longer be used. | 7212 // when doing GC if we expect that the function will no longer be used. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7308 | 7308 |
7309 // Number of time we tried to re-enable optimization after it | 7309 // Number of time we tried to re-enable optimization after it |
7310 // was disabled due to high number of deoptimizations. | 7310 // was disabled due to high number of deoptimizations. |
7311 inline void set_opt_reenable_tries(int value); | 7311 inline void set_opt_reenable_tries(int value); |
7312 inline int opt_reenable_tries(); | 7312 inline int opt_reenable_tries(); |
7313 | 7313 |
7314 inline void TryReenableOptimization(); | 7314 inline void TryReenableOptimization(); |
7315 | 7315 |
7316 // Stores deopt_count, opt_reenable_tries and ic_age as bit-fields. | 7316 // Stores deopt_count, opt_reenable_tries and ic_age as bit-fields. |
7317 inline void set_counters(int value); | 7317 inline void set_counters(int value); |
7318 inline int counters(); | 7318 inline int counters() const; |
7319 | 7319 |
7320 // Stores opt_count and bailout_reason as bit-fields. | 7320 // Stores opt_count and bailout_reason as bit-fields. |
7321 inline void set_opt_count_and_bailout_reason(int value); | 7321 inline void set_opt_count_and_bailout_reason(int value); |
7322 inline int opt_count_and_bailout_reason(); | 7322 inline int opt_count_and_bailout_reason() const; |
7323 | 7323 |
7324 void set_bailout_reason(BailoutReason reason) { | 7324 void set_bailout_reason(BailoutReason reason) { |
7325 set_opt_count_and_bailout_reason( | 7325 set_opt_count_and_bailout_reason( |
7326 DisabledOptimizationReasonBits::update(opt_count_and_bailout_reason(), | 7326 DisabledOptimizationReasonBits::update(opt_count_and_bailout_reason(), |
7327 reason)); | 7327 reason)); |
7328 } | 7328 } |
7329 | 7329 |
7330 void set_dont_optimize_reason(BailoutReason reason) { | 7330 void set_dont_optimize_reason(BailoutReason reason) { |
7331 set_bailout_reason(reason); | 7331 set_bailout_reason(reason); |
7332 set_dont_optimize(reason != kNoReason); | 7332 set_dont_optimize(reason != kNoReason); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7544 DECL_ACCESSORS(context, Context) | 7544 DECL_ACCESSORS(context, Context) |
7545 | 7545 |
7546 // [receiver]: The receiver of the suspended computation. | 7546 // [receiver]: The receiver of the suspended computation. |
7547 DECL_ACCESSORS(receiver, Object) | 7547 DECL_ACCESSORS(receiver, Object) |
7548 | 7548 |
7549 // [continuation]: Offset into code of continuation. | 7549 // [continuation]: Offset into code of continuation. |
7550 // | 7550 // |
7551 // A positive offset indicates a suspended generator. The special | 7551 // A positive offset indicates a suspended generator. The special |
7552 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator | 7552 // kGeneratorExecuting and kGeneratorClosed values indicate that a generator |
7553 // cannot be resumed. | 7553 // cannot be resumed. |
7554 inline int continuation(); | 7554 inline int continuation() const; |
7555 inline void set_continuation(int continuation); | 7555 inline void set_continuation(int continuation); |
7556 inline bool is_closed(); | 7556 inline bool is_closed(); |
7557 inline bool is_executing(); | 7557 inline bool is_executing(); |
7558 inline bool is_suspended(); | 7558 inline bool is_suspended(); |
7559 | 7559 |
7560 // [operand_stack]: Saved operand stack. | 7560 // [operand_stack]: Saved operand stack. |
7561 DECL_ACCESSORS(operand_stack, FixedArray) | 7561 DECL_ACCESSORS(operand_stack, FixedArray) |
7562 | 7562 |
7563 // [stack_handler_index]: Index of first stack handler in operand_stack, or -1 | 7563 // [stack_handler_index]: Index of first stack handler in operand_stack, or -1 |
7564 // if the captured activation had no stack handler. | 7564 // if the captured activation had no stack handler. |
7565 inline int stack_handler_index(); | 7565 inline int stack_handler_index() const; |
7566 inline void set_stack_handler_index(int stack_handler_index); | 7566 inline void set_stack_handler_index(int stack_handler_index); |
7567 | 7567 |
7568 // Casting. | 7568 // Casting. |
7569 static inline JSGeneratorObject* cast(Object* obj); | 7569 static inline JSGeneratorObject* cast(Object* obj); |
7570 | 7570 |
7571 // Dispatched behavior. | 7571 // Dispatched behavior. |
7572 DECLARE_PRINTER(JSGeneratorObject) | 7572 DECLARE_PRINTER(JSGeneratorObject) |
7573 DECLARE_VERIFIER(JSGeneratorObject) | 7573 DECLARE_VERIFIER(JSGeneratorObject) |
7574 | 7574 |
7575 // Magic sentinel values for the continuation. | 7575 // Magic sentinel values for the continuation. |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8116 // [arguments]: the arguments for formatting the error message. | 8116 // [arguments]: the arguments for formatting the error message. |
8117 DECL_ACCESSORS(arguments, JSArray) | 8117 DECL_ACCESSORS(arguments, JSArray) |
8118 | 8118 |
8119 // [script]: the script from which the error message originated. | 8119 // [script]: the script from which the error message originated. |
8120 DECL_ACCESSORS(script, Object) | 8120 DECL_ACCESSORS(script, Object) |
8121 | 8121 |
8122 // [stack_frames]: an array of stack frames for this error object. | 8122 // [stack_frames]: an array of stack frames for this error object. |
8123 DECL_ACCESSORS(stack_frames, Object) | 8123 DECL_ACCESSORS(stack_frames, Object) |
8124 | 8124 |
8125 // [start_position]: the start position in the script for the error message. | 8125 // [start_position]: the start position in the script for the error message. |
8126 inline int start_position(); | 8126 inline int start_position() const; |
8127 inline void set_start_position(int value); | 8127 inline void set_start_position(int value); |
8128 | 8128 |
8129 // [end_position]: the end position in the script for the error message. | 8129 // [end_position]: the end position in the script for the error message. |
8130 inline int end_position(); | 8130 inline int end_position() const; |
8131 inline void set_end_position(int value); | 8131 inline void set_end_position(int value); |
8132 | 8132 |
8133 // Casting. | 8133 // Casting. |
8134 static inline JSMessageObject* cast(Object* obj); | 8134 static inline JSMessageObject* cast(Object* obj); |
8135 | 8135 |
8136 // Dispatched behavior. | 8136 // Dispatched behavior. |
8137 DECLARE_PRINTER(JSMessageObject) | 8137 DECLARE_PRINTER(JSMessageObject) |
8138 DECLARE_VERIFIER(JSMessageObject) | 8138 DECLARE_VERIFIER(JSMessageObject) |
8139 | 8139 |
8140 // Layout description. | 8140 // Layout description. |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8774 // Representation of a slow alias as part of a sloppy arguments objects. | 8774 // Representation of a slow alias as part of a sloppy arguments objects. |
8775 // For fast aliases (if HasSloppyArgumentsElements()): | 8775 // For fast aliases (if HasSloppyArgumentsElements()): |
8776 // - the parameter map contains an index into the context | 8776 // - the parameter map contains an index into the context |
8777 // - all attributes of the element have default values | 8777 // - all attributes of the element have default values |
8778 // For slow aliases (if HasDictionaryArgumentsElements()): | 8778 // For slow aliases (if HasDictionaryArgumentsElements()): |
8779 // - the parameter map contains no fast alias mapping (i.e. the hole) | 8779 // - the parameter map contains no fast alias mapping (i.e. the hole) |
8780 // - this struct (in the slow backing store) contains an index into the context | 8780 // - this struct (in the slow backing store) contains an index into the context |
8781 // - all attributes are available as part if the property details | 8781 // - all attributes are available as part if the property details |
8782 class AliasedArgumentsEntry: public Struct { | 8782 class AliasedArgumentsEntry: public Struct { |
8783 public: | 8783 public: |
8784 inline int aliased_context_slot(); | 8784 inline int aliased_context_slot() const; |
8785 inline void set_aliased_context_slot(int count); | 8785 inline void set_aliased_context_slot(int count); |
8786 | 8786 |
8787 static inline AliasedArgumentsEntry* cast(Object* obj); | 8787 static inline AliasedArgumentsEntry* cast(Object* obj); |
8788 | 8788 |
8789 // Dispatched behavior. | 8789 // Dispatched behavior. |
8790 DECLARE_PRINTER(AliasedArgumentsEntry) | 8790 DECLARE_PRINTER(AliasedArgumentsEntry) |
8791 DECLARE_VERIFIER(AliasedArgumentsEntry) | 8791 DECLARE_VERIFIER(AliasedArgumentsEntry) |
8792 | 8792 |
8793 static const int kAliasedContextSlot = HeapObject::kHeaderSize; | 8793 static const int kAliasedContextSlot = HeapObject::kHeaderSize; |
8794 static const int kSize = kAliasedContextSlot + kPointerSize; | 8794 static const int kSize = kAliasedContextSlot + kPointerSize; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9111 const uint8_t* onebyte_start; | 9111 const uint8_t* onebyte_start; |
9112 const uc16* twobyte_start; | 9112 const uc16* twobyte_start; |
9113 }; | 9113 }; |
9114 int length_; | 9114 int length_; |
9115 State state_; | 9115 State state_; |
9116 | 9116 |
9117 friend class String; | 9117 friend class String; |
9118 }; | 9118 }; |
9119 | 9119 |
9120 // Get and set the length of the string. | 9120 // Get and set the length of the string. |
9121 inline int length(); | 9121 inline int length() const; |
9122 inline void set_length(int value); | 9122 inline void set_length(int value); |
9123 | 9123 |
9124 // Get and set the length of the string using acquire loads and release | 9124 // Get and set the length of the string using acquire loads and release |
9125 // stores. | 9125 // stores. |
9126 inline int synchronized_length(); | 9126 inline int synchronized_length() const; |
9127 inline void synchronized_set_length(int value); | 9127 inline void synchronized_set_length(int value); |
9128 | 9128 |
9129 // Returns whether this string has only ASCII chars, i.e. all of them can | 9129 // Returns whether this string has only ASCII chars, i.e. all of them can |
9130 // be ASCII encoded. This might be the case even if the string is | 9130 // be ASCII encoded. This might be the case even if the string is |
9131 // two-byte. Such strings may appear when the embedder prefers | 9131 // two-byte. Such strings may appear when the embedder prefers |
9132 // two-byte external representations even for ASCII data. | 9132 // two-byte external representations even for ASCII data. |
9133 inline bool IsOneByteRepresentation(); | 9133 inline bool IsOneByteRepresentation(); |
9134 inline bool IsTwoByteRepresentation(); | 9134 inline bool IsTwoByteRepresentation(); |
9135 | 9135 |
9136 // Cons and slices have an encoding flag that may not represent the actual | 9136 // Cons and slices have an encoding flag that may not represent the actual |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9514 // such a substring. | 9514 // such a substring. |
9515 // Currently missing features are: | 9515 // Currently missing features are: |
9516 // - handling externalized parent strings | 9516 // - handling externalized parent strings |
9517 // - external strings as parent | 9517 // - external strings as parent |
9518 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. | 9518 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. |
9519 class SlicedString: public String { | 9519 class SlicedString: public String { |
9520 public: | 9520 public: |
9521 inline String* parent(); | 9521 inline String* parent(); |
9522 inline void set_parent(String* parent, | 9522 inline void set_parent(String* parent, |
9523 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 9523 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
9524 inline int offset(); | 9524 inline int offset() const; |
9525 inline void set_offset(int offset); | 9525 inline void set_offset(int offset); |
9526 | 9526 |
9527 // Dispatched behavior. | 9527 // Dispatched behavior. |
9528 uint16_t SlicedStringGet(int index); | 9528 uint16_t SlicedStringGet(int index); |
9529 | 9529 |
9530 // Casting. | 9530 // Casting. |
9531 static inline SlicedString* cast(Object* obj); | 9531 static inline SlicedString* cast(Object* obj); |
9532 | 9532 |
9533 // Layout description. | 9533 // Layout description. |
9534 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); | 9534 static const int kParentOffset = POINTER_SIZE_ALIGN(String::kSize); |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10896 DECL_ACCESSORS(parent_template, Object) | 10896 DECL_ACCESSORS(parent_template, Object) |
10897 DECL_ACCESSORS(named_property_handler, Object) | 10897 DECL_ACCESSORS(named_property_handler, Object) |
10898 DECL_ACCESSORS(indexed_property_handler, Object) | 10898 DECL_ACCESSORS(indexed_property_handler, Object) |
10899 DECL_ACCESSORS(instance_template, Object) | 10899 DECL_ACCESSORS(instance_template, Object) |
10900 DECL_ACCESSORS(class_name, Object) | 10900 DECL_ACCESSORS(class_name, Object) |
10901 DECL_ACCESSORS(signature, Object) | 10901 DECL_ACCESSORS(signature, Object) |
10902 DECL_ACCESSORS(instance_call_handler, Object) | 10902 DECL_ACCESSORS(instance_call_handler, Object) |
10903 DECL_ACCESSORS(access_check_info, Object) | 10903 DECL_ACCESSORS(access_check_info, Object) |
10904 DECL_ACCESSORS(flag, Smi) | 10904 DECL_ACCESSORS(flag, Smi) |
10905 | 10905 |
10906 inline int length(); | 10906 inline int length() const; |
10907 inline void set_length(int value); | 10907 inline void set_length(int value); |
10908 | 10908 |
10909 // Following properties use flag bits. | 10909 // Following properties use flag bits. |
10910 DECL_BOOLEAN_ACCESSORS(hidden_prototype) | 10910 DECL_BOOLEAN_ACCESSORS(hidden_prototype) |
10911 DECL_BOOLEAN_ACCESSORS(undetectable) | 10911 DECL_BOOLEAN_ACCESSORS(undetectable) |
10912 // If the bit is set, object instances created by this function | 10912 // If the bit is set, object instances created by this function |
10913 // requires access check. | 10913 // requires access check. |
10914 DECL_BOOLEAN_ACCESSORS(needs_access_check) | 10914 DECL_BOOLEAN_ACCESSORS(needs_access_check) |
10915 DECL_BOOLEAN_ACCESSORS(read_only_prototype) | 10915 DECL_BOOLEAN_ACCESSORS(read_only_prototype) |
10916 DECL_BOOLEAN_ACCESSORS(remove_prototype) | 10916 DECL_BOOLEAN_ACCESSORS(remove_prototype) |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11249 } else { | 11249 } else { |
11250 value &= ~(1 << bit_position); | 11250 value &= ~(1 << bit_position); |
11251 } | 11251 } |
11252 return value; | 11252 return value; |
11253 } | 11253 } |
11254 }; | 11254 }; |
11255 | 11255 |
11256 } } // namespace v8::internal | 11256 } } // namespace v8::internal |
11257 | 11257 |
11258 #endif // V8_OBJECTS_H_ | 11258 #endif // V8_OBJECTS_H_ |
OLD | NEW |