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/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6767 inline void set_function_token_position(int function_token_position); | 6767 inline void set_function_token_position(int function_token_position); |
6768 | 6768 |
6769 // Position of this function in the script source. | 6769 // Position of this function in the script source. |
6770 inline int start_position() const; | 6770 inline int start_position() const; |
6771 inline void set_start_position(int start_position); | 6771 inline void set_start_position(int start_position); |
6772 | 6772 |
6773 // End position of this function in the script source. | 6773 // End position of this function in the script source. |
6774 inline int end_position() const; | 6774 inline int end_position() const; |
6775 inline void set_end_position(int end_position); | 6775 inline void set_end_position(int end_position); |
6776 | 6776 |
6777 // Is this function a function expression in the source code. | 6777 // Is this function a named function expression in the source code. |
6778 DECL_BOOLEAN_ACCESSORS(is_expression) | 6778 DECL_BOOLEAN_ACCESSORS(is_named_expression) |
6779 | 6779 |
6780 // Is this function a top-level function (scripts, evals). | 6780 // Is this function a top-level function (scripts, evals). |
6781 DECL_BOOLEAN_ACCESSORS(is_toplevel) | 6781 DECL_BOOLEAN_ACCESSORS(is_toplevel) |
6782 | 6782 |
6783 // Bit field containing various information collected by the compiler to | 6783 // Bit field containing various information collected by the compiler to |
6784 // drive optimization. | 6784 // drive optimization. |
6785 inline int compiler_hints() const; | 6785 inline int compiler_hints() const; |
6786 inline void set_compiler_hints(int value); | 6786 inline void set_compiler_hints(int value); |
6787 | 6787 |
6788 inline int ast_node_count() const; | 6788 inline int ast_node_count() const; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6836 | 6836 |
6837 // Indicate that this function should always be inlined in optimized code. | 6837 // Indicate that this function should always be inlined in optimized code. |
6838 DECL_BOOLEAN_ACCESSORS(force_inline) | 6838 DECL_BOOLEAN_ACCESSORS(force_inline) |
6839 | 6839 |
6840 // Indicates that the function was created by the Function function. | 6840 // Indicates that the function was created by the Function function. |
6841 // Though it's anonymous, toString should treat it as if it had the name | 6841 // Though it's anonymous, toString should treat it as if it had the name |
6842 // "anonymous". We don't set the name itself so that the system does not | 6842 // "anonymous". We don't set the name itself so that the system does not |
6843 // see a binding for it. | 6843 // see a binding for it. |
6844 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 6844 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
6845 | 6845 |
6846 // Indicates that the function is anonymous (the name field can be set | 6846 // Indicates that the function is either an anonymous expression |
6847 // through the API, which does not change this flag). | 6847 // or an arrow function (the name field can be set through the API, |
6848 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 6848 // which does not change this flag). |
| 6849 DECL_BOOLEAN_ACCESSORS(is_anonymous_expression) |
6849 | 6850 |
6850 // Is this a function or top-level/eval code. | 6851 // Is this a function or top-level/eval code. |
6851 DECL_BOOLEAN_ACCESSORS(is_function) | 6852 DECL_BOOLEAN_ACCESSORS(is_function) |
6852 | 6853 |
6853 // Indicates that code for this function cannot be compiled with Crankshaft. | 6854 // Indicates that code for this function cannot be compiled with Crankshaft. |
6854 DECL_BOOLEAN_ACCESSORS(dont_crankshaft) | 6855 DECL_BOOLEAN_ACCESSORS(dont_crankshaft) |
6855 | 6856 |
6856 // Indicates that code for this function cannot be flushed. | 6857 // Indicates that code for this function cannot be flushed. |
6857 DECL_BOOLEAN_ACCESSORS(dont_flush) | 6858 DECL_BOOLEAN_ACCESSORS(dont_flush) |
6858 | 6859 |
(...skipping 14 matching lines...) Expand all Loading... |
6873 | 6874 |
6874 // Indicates that this function is an asm function. | 6875 // Indicates that this function is an asm function. |
6875 DECL_BOOLEAN_ACCESSORS(asm_function) | 6876 DECL_BOOLEAN_ACCESSORS(asm_function) |
6876 | 6877 |
6877 // Indicates that the the shared function info is deserialized from cache. | 6878 // Indicates that the the shared function info is deserialized from cache. |
6878 DECL_BOOLEAN_ACCESSORS(deserialized) | 6879 DECL_BOOLEAN_ACCESSORS(deserialized) |
6879 | 6880 |
6880 // Indicates that the the shared function info has never been compiled before. | 6881 // Indicates that the the shared function info has never been compiled before. |
6881 DECL_BOOLEAN_ACCESSORS(never_compiled) | 6882 DECL_BOOLEAN_ACCESSORS(never_compiled) |
6882 | 6883 |
| 6884 // Whether this function was created from a FunctionDeclaration. |
| 6885 DECL_BOOLEAN_ACCESSORS(is_declaration) |
| 6886 |
6883 inline FunctionKind kind(); | 6887 inline FunctionKind kind(); |
6884 inline void set_kind(FunctionKind kind); | 6888 inline void set_kind(FunctionKind kind); |
6885 | 6889 |
6886 // Indicates whether or not the code in the shared function support | 6890 // Indicates whether or not the code in the shared function support |
6887 // deoptimization. | 6891 // deoptimization. |
6888 inline bool has_deoptimization_support(); | 6892 inline bool has_deoptimization_support(); |
6889 | 6893 |
6890 // Enable deoptimization support through recompiled code. | 6894 // Enable deoptimization support through recompiled code. |
6891 void EnableDeoptimizationSupport(Code* recompiled); | 6895 void EnableDeoptimizationSupport(Code* recompiled); |
6892 | 6896 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7106 | 7110 |
7107 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); | 7111 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); |
7108 | 7112 |
7109 typedef FixedBodyDescriptor<kNameOffset, | 7113 typedef FixedBodyDescriptor<kNameOffset, |
7110 kLastPointerFieldOffset + kPointerSize, | 7114 kLastPointerFieldOffset + kPointerSize, |
7111 kSize> BodyDescriptor; | 7115 kSize> BodyDescriptor; |
7112 | 7116 |
7113 // Bit positions in start_position_and_type. | 7117 // Bit positions in start_position_and_type. |
7114 // The source code start position is in the 30 most significant bits of | 7118 // The source code start position is in the 30 most significant bits of |
7115 // the start_position_and_type field. | 7119 // the start_position_and_type field. |
7116 static const int kIsExpressionBit = 0; | 7120 static const int kIsNamedExpressionBit = 0; |
7117 static const int kIsTopLevelBit = 1; | 7121 static const int kIsTopLevelBit = 1; |
7118 static const int kStartPositionShift = 2; | 7122 static const int kStartPositionShift = 2; |
7119 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7123 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
7120 | 7124 |
7121 // Bit positions in compiler_hints. | 7125 // Bit positions in compiler_hints. |
7122 enum CompilerHints { | 7126 enum CompilerHints { |
7123 // byte 0 | 7127 // byte 0 |
7124 kAllowLazyCompilation, | 7128 kAllowLazyCompilation, |
7125 kAllowLazyCompilationWithoutContext, | 7129 kAllowLazyCompilationWithoutContext, |
7126 kOptimizationDisabled, | 7130 kOptimizationDisabled, |
7127 kNative, | 7131 kNative, |
7128 kStrictModeFunction, | 7132 kStrictModeFunction, |
7129 kStrongModeFunction, | 7133 kStrongModeFunction, |
7130 kUsesArguments, | 7134 kUsesArguments, |
7131 kNeedsHomeObject, | 7135 kNeedsHomeObject, |
7132 // byte 1 | 7136 // byte 1 |
7133 kHasDuplicateParameters, | 7137 kHasDuplicateParameters, |
7134 kForceInline, | 7138 kForceInline, |
7135 kIsAsmFunction, | 7139 kIsAsmFunction, |
7136 kIsAnonymous, | 7140 kIsAnonymousExpression, |
7137 kNameShouldPrintAsAnonymous, | 7141 kNameShouldPrintAsAnonymous, |
7138 kIsFunction, | 7142 kIsFunction, |
7139 kDontCrankshaft, | 7143 kDontCrankshaft, |
7140 kDontFlush, | 7144 kDontFlush, |
7141 // byte 2 | 7145 // byte 2 |
7142 kFunctionKind, | 7146 kFunctionKind, |
7143 kIsArrow = kFunctionKind, | 7147 kIsArrow = kFunctionKind, |
7144 kIsGenerator, | 7148 kIsGenerator, |
7145 kIsConciseMethod, | 7149 kIsConciseMethod, |
7146 kIsAccessorFunction, | 7150 kIsAccessorFunction, |
7147 kIsDefaultConstructor, | 7151 kIsDefaultConstructor, |
7148 kIsSubclassConstructor, | 7152 kIsSubclassConstructor, |
7149 kIsBaseConstructor, | 7153 kIsBaseConstructor, |
7150 // byte 3 | 7154 // byte 3 |
7151 kDeserialized, | 7155 kDeserialized, |
7152 kNeverCompiled, | 7156 kNeverCompiled, |
| 7157 kIsDeclaration, |
7153 kCompilerHintsCount, // Pseudo entry | 7158 kCompilerHintsCount, // Pseudo entry |
7154 }; | 7159 }; |
7155 // Add hints for other modes when they're added. | 7160 // Add hints for other modes when they're added. |
7156 STATIC_ASSERT(LANGUAGE_END == 3); | 7161 STATIC_ASSERT(LANGUAGE_END == 3); |
7157 // kFunctionKind has to be byte-aligned | 7162 // kFunctionKind has to be byte-aligned |
7158 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 7163 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
7159 // Make sure that FunctionKind and byte 2 are in sync: | 7164 // Make sure that FunctionKind and byte 2 are in sync: |
7160 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ | 7165 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ |
7161 STATIC_ASSERT(FunctionKind::functionKind == \ | 7166 STATIC_ASSERT(FunctionKind::functionKind == \ |
7162 1 << (compilerFunctionKind - kFunctionKind)) | 7167 1 << (compilerFunctionKind - kFunctionKind)) |
(...skipping 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10820 } | 10825 } |
10821 return value; | 10826 return value; |
10822 } | 10827 } |
10823 }; | 10828 }; |
10824 | 10829 |
10825 | 10830 |
10826 } // NOLINT, false-positive due to second-order macros. | 10831 } // NOLINT, false-positive due to second-order macros. |
10827 } // NOLINT, false-positive due to second-order macros. | 10832 } // NOLINT, false-positive due to second-order macros. |
10828 | 10833 |
10829 #endif // V8_OBJECTS_H_ | 10834 #endif // V8_OBJECTS_H_ |
OLD | NEW |