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 7152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7163 static const int kIsTopLevelBit = 1; | 7163 static const int kIsTopLevelBit = 1; |
7164 static const int kStartPositionShift = 2; | 7164 static const int kStartPositionShift = 2; |
7165 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7165 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
7166 | 7166 |
7167 // Bit positions in compiler_hints. | 7167 // Bit positions in compiler_hints. |
7168 enum CompilerHints { | 7168 enum CompilerHints { |
7169 // byte 0 | 7169 // byte 0 |
7170 kAllowLazyCompilation, | 7170 kAllowLazyCompilation, |
7171 kAllowLazyCompilationWithoutContext, | 7171 kAllowLazyCompilationWithoutContext, |
7172 kOptimizationDisabled, | 7172 kOptimizationDisabled, |
| 7173 kNeverCompiled, |
7173 kNative, | 7174 kNative, |
7174 kStrictModeFunction, | 7175 kStrictModeFunction, |
7175 kStrongModeFunction, | |
7176 kUsesArguments, | 7176 kUsesArguments, |
7177 kNeedsHomeObject, | 7177 kNeedsHomeObject, |
7178 // byte 1 | 7178 // byte 1 |
7179 kHasDuplicateParameters, | 7179 kHasDuplicateParameters, |
7180 kForceInline, | 7180 kForceInline, |
7181 kIsAsmFunction, | 7181 kIsAsmFunction, |
7182 kIsAnonymousExpression, | 7182 kIsAnonymousExpression, |
7183 kNameShouldPrintAsAnonymous, | 7183 kNameShouldPrintAsAnonymous, |
7184 kIsFunction, | 7184 kIsFunction, |
7185 kDontCrankshaft, | 7185 kDontCrankshaft, |
7186 kDontFlush, | 7186 kDontFlush, |
7187 // byte 2 | 7187 // byte 2 |
7188 kFunctionKind, | 7188 kFunctionKind, |
7189 kIsArrow = kFunctionKind, | 7189 kIsArrow = kFunctionKind, |
7190 kIsGenerator, | 7190 kIsGenerator, |
7191 kIsConciseMethod, | 7191 kIsConciseMethod, |
7192 kIsDefaultConstructor, | 7192 kIsDefaultConstructor, |
7193 kIsSubclassConstructor, | 7193 kIsSubclassConstructor, |
7194 kIsBaseConstructor, | 7194 kIsBaseConstructor, |
7195 kIsGetterFunction, | 7195 kIsGetterFunction, |
7196 kIsSetterFunction, | 7196 kIsSetterFunction, |
7197 // byte 3 | 7197 // byte 3 |
7198 kDeserialized, | 7198 kDeserialized, |
7199 kNeverCompiled, | |
7200 kIsDeclaration, | 7199 kIsDeclaration, |
7201 kCompilerHintsCount, // Pseudo entry | 7200 kCompilerHintsCount, // Pseudo entry |
7202 }; | 7201 }; |
7203 // Add hints for other modes when they're added. | 7202 // Add hints for other modes when they're added. |
7204 STATIC_ASSERT(LANGUAGE_END == 3); | 7203 STATIC_ASSERT(LANGUAGE_END == 3); |
7205 // kFunctionKind has to be byte-aligned | 7204 // kFunctionKind has to be byte-aligned |
7206 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 7205 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
7207 // Make sure that FunctionKind and byte 2 are in sync: | 7206 // Make sure that FunctionKind and byte 2 are in sync: |
7208 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ | 7207 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ |
7209 STATIC_ASSERT(FunctionKind::functionKind == \ | 7208 STATIC_ASSERT(FunctionKind::functionKind == \ |
(...skipping 29 matching lines...) Expand all Loading... |
7239 #endif | 7238 #endif |
7240 | 7239 |
7241 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= | 7240 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
7242 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 7241 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
7243 | 7242 |
7244 public: | 7243 public: |
7245 // Constants for optimizing codegen for strict mode function and | 7244 // Constants for optimizing codegen for strict mode function and |
7246 // native tests when using integer-width instructions. | 7245 // native tests when using integer-width instructions. |
7247 static const int kStrictModeBit = | 7246 static const int kStrictModeBit = |
7248 kStrictModeFunction + kCompilerHintsSmiTagSize; | 7247 kStrictModeFunction + kCompilerHintsSmiTagSize; |
7249 static const int kStrongModeBit = | |
7250 kStrongModeFunction + kCompilerHintsSmiTagSize; | |
7251 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; | 7248 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; |
7252 | 7249 |
7253 static const int kClassConstructorBits = | 7250 static const int kClassConstructorBits = |
7254 FunctionKind::kClassConstructor | 7251 FunctionKind::kClassConstructor |
7255 << (kFunctionKind + kCompilerHintsSmiTagSize); | 7252 << (kFunctionKind + kCompilerHintsSmiTagSize); |
7256 | 7253 |
7257 // Constants for optimizing codegen for strict mode function and | 7254 // Constants for optimizing codegen for strict mode function and |
7258 // native tests. | 7255 // native tests. |
7259 // Allows to use byte-width instructions. | 7256 // Allows to use byte-width instructions. |
7260 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; | 7257 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; |
7261 static const int kStrongModeBitWithinByte = kStrongModeBit % kBitsPerByte; | |
7262 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; | 7258 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; |
7263 | 7259 |
7264 static const int kClassConstructorBitsWithinByte = | 7260 static const int kClassConstructorBitsWithinByte = |
7265 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; | 7261 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; |
7266 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); | 7262 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); |
7267 | 7263 |
7268 #if defined(V8_TARGET_LITTLE_ENDIAN) | 7264 #if defined(V8_TARGET_LITTLE_ENDIAN) |
7269 #define BYTE_OFFSET(compiler_hint) \ | 7265 #define BYTE_OFFSET(compiler_hint) \ |
7270 kCompilerHintsOffset + \ | 7266 kCompilerHintsOffset + \ |
7271 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte | 7267 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte |
7272 #elif defined(V8_TARGET_BIG_ENDIAN) | 7268 #elif defined(V8_TARGET_BIG_ENDIAN) |
7273 #define BYTE_OFFSET(compiler_hint) \ | 7269 #define BYTE_OFFSET(compiler_hint) \ |
7274 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ | 7270 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ |
7275 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) | 7271 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) |
7276 #else | 7272 #else |
7277 #error Unknown byte ordering | 7273 #error Unknown byte ordering |
7278 #endif | 7274 #endif |
7279 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7275 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
7280 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); | |
7281 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7276 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
7282 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7277 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
7283 #undef BYTE_OFFSET | 7278 #undef BYTE_OFFSET |
7284 | 7279 |
7285 private: | 7280 private: |
7286 // Returns entry from optimized code map for specified context and OSR entry. | 7281 // Returns entry from optimized code map for specified context and OSR entry. |
7287 // The result is either kNotFound, kSharedCodeIndex for context-independent | 7282 // The result is either kNotFound, kSharedCodeIndex for context-independent |
7288 // entry or a start index of the context-dependent entry. | 7283 // entry or a start index of the context-dependent entry. |
7289 int SearchOptimizedCodeMapEntry(Context* native_context, | 7284 int SearchOptimizedCodeMapEntry(Context* native_context, |
7290 BailoutId osr_ast_id); | 7285 BailoutId osr_ast_id); |
(...skipping 3577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10868 } | 10863 } |
10869 return value; | 10864 return value; |
10870 } | 10865 } |
10871 }; | 10866 }; |
10872 | 10867 |
10873 | 10868 |
10874 } // NOLINT, false-positive due to second-order macros. | 10869 } // NOLINT, false-positive due to second-order macros. |
10875 } // NOLINT, false-positive due to second-order macros. | 10870 } // NOLINT, false-positive due to second-order macros. |
10876 | 10871 |
10877 #endif // V8_OBJECTS_H_ | 10872 #endif // V8_OBJECTS_H_ |
OLD | NEW |