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 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 6750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6761 inline int unique_id() const; | 6761 inline int unique_id() const; |
6762 inline void set_unique_id(int value); | 6762 inline void set_unique_id(int value); |
6763 #endif | 6763 #endif |
6764 | 6764 |
6765 // [instance class name]: class name for instances. | 6765 // [instance class name]: class name for instances. |
6766 DECL_ACCESSORS(instance_class_name, Object) | 6766 DECL_ACCESSORS(instance_class_name, Object) |
6767 | 6767 |
6768 // [function data]: This field holds some additional data for function. | 6768 // [function data]: This field holds some additional data for function. |
6769 // Currently it has one of: | 6769 // Currently it has one of: |
6770 // - a FunctionTemplateInfo to make benefit the API [IsApiFunction()]. | 6770 // - a FunctionTemplateInfo to make benefit the API [IsApiFunction()]. |
6771 // - a Smi identifying a builtin function [HasBuiltinFunctionId()]. | |
6772 // - a BytecodeArray for the interpreter [HasBytecodeArray()]. | 6771 // - a BytecodeArray for the interpreter [HasBytecodeArray()]. |
6773 // In the long run we don't want all functions to have this field but | |
6774 // we can fix that when we have a better model for storing hidden data | |
6775 // on objects. | |
6776 DECL_ACCESSORS(function_data, Object) | 6772 DECL_ACCESSORS(function_data, Object) |
6777 | 6773 |
6778 inline bool IsApiFunction(); | 6774 inline bool IsApiFunction(); |
6779 inline FunctionTemplateInfo* get_api_func_data(); | 6775 inline FunctionTemplateInfo* get_api_func_data(); |
6780 inline void set_api_func_data(FunctionTemplateInfo* data); | 6776 inline void set_api_func_data(FunctionTemplateInfo* data); |
6781 inline bool HasBuiltinFunctionId(); | |
6782 inline BuiltinFunctionId builtin_function_id(); | |
6783 inline void set_builtin_function_id(BuiltinFunctionId id); | |
6784 inline bool HasBytecodeArray(); | 6777 inline bool HasBytecodeArray(); |
6785 inline BytecodeArray* bytecode_array(); | 6778 inline BytecodeArray* bytecode_array(); |
6786 inline void set_bytecode_array(BytecodeArray* bytecode); | 6779 inline void set_bytecode_array(BytecodeArray* bytecode); |
6787 inline void ClearBytecodeArray(); | 6780 inline void ClearBytecodeArray(); |
6788 | 6781 |
| 6782 // [function identifier]: This field holds an additional identifier for the |
| 6783 // function. |
| 6784 // - a Smi identifying a builtin function [HasBuiltinFunctionId()]. |
| 6785 // - a String identifying the function's inferred name [HasInferredName()]. |
| 6786 // The inferred_name is inferred from variable or property |
| 6787 // assignment of this function. It is used to facilitate debugging and |
| 6788 // profiling of JavaScript code written in OO style, where almost |
| 6789 // all functions are anonymous but are assigned to object |
| 6790 // properties. |
| 6791 DECL_ACCESSORS(function_identifier, Object) |
| 6792 |
| 6793 inline bool HasBuiltinFunctionId(); |
| 6794 inline BuiltinFunctionId builtin_function_id(); |
| 6795 inline void set_builtin_function_id(BuiltinFunctionId id); |
| 6796 inline bool HasInferredName(); |
| 6797 inline String* inferred_name(); |
| 6798 inline void set_inferred_name(String* inferred_name); |
| 6799 |
6789 // [script info]: Script from which the function originates. | 6800 // [script info]: Script from which the function originates. |
6790 DECL_ACCESSORS(script, Object) | 6801 DECL_ACCESSORS(script, Object) |
6791 | 6802 |
6792 // [num_literals]: Number of literals used by this function. | 6803 // [num_literals]: Number of literals used by this function. |
6793 inline int num_literals() const; | 6804 inline int num_literals() const; |
6794 inline void set_num_literals(int value); | 6805 inline void set_num_literals(int value); |
6795 | 6806 |
6796 // [start_position_and_type]: Field used to store both the source code | 6807 // [start_position_and_type]: Field used to store both the source code |
6797 // position, whether or not the function is a function expression, | 6808 // position, whether or not the function is a function expression, |
6798 // and whether or not the function is a toplevel function. The two | 6809 // and whether or not the function is a toplevel function. The two |
6799 // least significants bit indicates whether the function is an | 6810 // least significants bit indicates whether the function is an |
6800 // expression and the rest contains the source code position. | 6811 // expression and the rest contains the source code position. |
6801 inline int start_position_and_type() const; | 6812 inline int start_position_and_type() const; |
6802 inline void set_start_position_and_type(int value); | 6813 inline void set_start_position_and_type(int value); |
6803 | 6814 |
6804 // The function is subject to debugging if a debug info is attached. | 6815 // The function is subject to debugging if a debug info is attached. |
6805 inline bool HasDebugInfo(); | 6816 inline bool HasDebugInfo(); |
6806 inline DebugInfo* GetDebugInfo(); | 6817 inline DebugInfo* GetDebugInfo(); |
6807 | 6818 |
6808 // A function has debug code if the compiled code has debug break slots. | 6819 // A function has debug code if the compiled code has debug break slots. |
6809 inline bool HasDebugCode(); | 6820 inline bool HasDebugCode(); |
6810 | 6821 |
6811 // [debug info]: Debug information. | 6822 // [debug info]: Debug information. |
6812 DECL_ACCESSORS(debug_info, Object) | 6823 DECL_ACCESSORS(debug_info, Object) |
6813 | 6824 |
6814 // [inferred name]: Name inferred from variable or property | |
6815 // assignment of this function. Used to facilitate debugging and | |
6816 // profiling of JavaScript code written in OO style, where almost | |
6817 // all functions are anonymous but are assigned to object | |
6818 // properties. | |
6819 DECL_ACCESSORS(inferred_name, String) | |
6820 | |
6821 // The function's name if it is non-empty, otherwise the inferred name. | 6825 // The function's name if it is non-empty, otherwise the inferred name. |
6822 String* DebugName(); | 6826 String* DebugName(); |
6823 | 6827 |
6824 // Position of the 'function' token in the script source. | 6828 // Position of the 'function' token in the script source. |
6825 inline int function_token_position() const; | 6829 inline int function_token_position() const; |
6826 inline void set_function_token_position(int function_token_position); | 6830 inline void set_function_token_position(int function_token_position); |
6827 | 6831 |
6828 // Position of this function in the script source. | 6832 // Position of this function in the script source. |
6829 inline int start_position() const; | 6833 inline int start_position() const; |
6830 inline void set_start_position(int start_position); | 6834 inline void set_start_position(int start_position); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7050 static const int kCodeOffset = kNameOffset + kPointerSize; | 7054 static const int kCodeOffset = kNameOffset + kPointerSize; |
7051 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; | 7055 static const int kOptimizedCodeMapOffset = kCodeOffset + kPointerSize; |
7052 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; | 7056 static const int kScopeInfoOffset = kOptimizedCodeMapOffset + kPointerSize; |
7053 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; | 7057 static const int kConstructStubOffset = kScopeInfoOffset + kPointerSize; |
7054 static const int kInstanceClassNameOffset = | 7058 static const int kInstanceClassNameOffset = |
7055 kConstructStubOffset + kPointerSize; | 7059 kConstructStubOffset + kPointerSize; |
7056 static const int kFunctionDataOffset = | 7060 static const int kFunctionDataOffset = |
7057 kInstanceClassNameOffset + kPointerSize; | 7061 kInstanceClassNameOffset + kPointerSize; |
7058 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; | 7062 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
7059 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 7063 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
7060 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 7064 static const int kFunctionIdentifierOffset = kDebugInfoOffset + kPointerSize; |
7061 static const int kFeedbackVectorOffset = | 7065 static const int kFeedbackVectorOffset = |
7062 kInferredNameOffset + kPointerSize; | 7066 kFunctionIdentifierOffset + kPointerSize; |
7063 #if TRACE_MAPS | 7067 #if TRACE_MAPS |
7064 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; | 7068 static const int kUniqueIdOffset = kFeedbackVectorOffset + kPointerSize; |
7065 static const int kLastPointerFieldOffset = kUniqueIdOffset; | 7069 static const int kLastPointerFieldOffset = kUniqueIdOffset; |
7066 #else | 7070 #else |
7067 // Just to not break the postmortrem support with conditional offsets | 7071 // Just to not break the postmortrem support with conditional offsets |
7068 static const int kUniqueIdOffset = kFeedbackVectorOffset; | 7072 static const int kUniqueIdOffset = kFeedbackVectorOffset; |
7069 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; | 7073 static const int kLastPointerFieldOffset = kFeedbackVectorOffset; |
7070 #endif | 7074 #endif |
7071 | 7075 |
7072 #if V8_HOST_ARCH_32_BIT | 7076 #if V8_HOST_ARCH_32_BIT |
(...skipping 3814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10887 } | 10891 } |
10888 return value; | 10892 return value; |
10889 } | 10893 } |
10890 }; | 10894 }; |
10891 | 10895 |
10892 | 10896 |
10893 } // NOLINT, false-positive due to second-order macros. | 10897 } // NOLINT, false-positive due to second-order macros. |
10894 } // NOLINT, false-positive due to second-order macros. | 10898 } // NOLINT, false-positive due to second-order macros. |
10895 | 10899 |
10896 #endif // V8_OBJECTS_H_ | 10900 #endif // V8_OBJECTS_H_ |
OLD | NEW |