| 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 7163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7174 static const int kIsTopLevelBit = 1; | 7174 static const int kIsTopLevelBit = 1; |
| 7175 static const int kStartPositionShift = 2; | 7175 static const int kStartPositionShift = 2; |
| 7176 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 7176 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 7177 | 7177 |
| 7178 // Bit positions in compiler_hints. | 7178 // Bit positions in compiler_hints. |
| 7179 enum CompilerHints { | 7179 enum CompilerHints { |
| 7180 // byte 0 | 7180 // byte 0 |
| 7181 kAllowLazyCompilation, | 7181 kAllowLazyCompilation, |
| 7182 kAllowLazyCompilationWithoutContext, | 7182 kAllowLazyCompilationWithoutContext, |
| 7183 kOptimizationDisabled, | 7183 kOptimizationDisabled, |
| 7184 kNeverCompiled, |
| 7184 kNative, | 7185 kNative, |
| 7185 kStrictModeFunction, | 7186 kStrictModeFunction, |
| 7186 kStrongModeFunction, | |
| 7187 kUsesArguments, | 7187 kUsesArguments, |
| 7188 kNeedsHomeObject, | 7188 kNeedsHomeObject, |
| 7189 // byte 1 | 7189 // byte 1 |
| 7190 kHasDuplicateParameters, | 7190 kHasDuplicateParameters, |
| 7191 kForceInline, | 7191 kForceInline, |
| 7192 kIsAsmFunction, | 7192 kIsAsmFunction, |
| 7193 kIsAnonymousExpression, | 7193 kIsAnonymousExpression, |
| 7194 kNameShouldPrintAsAnonymous, | 7194 kNameShouldPrintAsAnonymous, |
| 7195 kIsFunction, | 7195 kIsFunction, |
| 7196 kDontCrankshaft, | 7196 kDontCrankshaft, |
| 7197 kDontFlush, | 7197 kDontFlush, |
| 7198 // byte 2 | 7198 // byte 2 |
| 7199 kFunctionKind, | 7199 kFunctionKind, |
| 7200 kIsArrow = kFunctionKind, | 7200 kIsArrow = kFunctionKind, |
| 7201 kIsGenerator, | 7201 kIsGenerator, |
| 7202 kIsConciseMethod, | 7202 kIsConciseMethod, |
| 7203 kIsDefaultConstructor, | 7203 kIsDefaultConstructor, |
| 7204 kIsSubclassConstructor, | 7204 kIsSubclassConstructor, |
| 7205 kIsBaseConstructor, | 7205 kIsBaseConstructor, |
| 7206 kIsGetterFunction, | 7206 kIsGetterFunction, |
| 7207 kIsSetterFunction, | 7207 kIsSetterFunction, |
| 7208 // byte 3 | 7208 // byte 3 |
| 7209 kDeserialized, | 7209 kDeserialized, |
| 7210 kNeverCompiled, | |
| 7211 kIsDeclaration, | 7210 kIsDeclaration, |
| 7212 kCompilerHintsCount, // Pseudo entry | 7211 kCompilerHintsCount, // Pseudo entry |
| 7213 }; | 7212 }; |
| 7214 // Add hints for other modes when they're added. | 7213 // Add hints for other modes when they're added. |
| 7215 STATIC_ASSERT(LANGUAGE_END == 3); | 7214 STATIC_ASSERT(LANGUAGE_END == 3); |
| 7216 // kFunctionKind has to be byte-aligned | 7215 // kFunctionKind has to be byte-aligned |
| 7217 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 7216 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
| 7218 // Make sure that FunctionKind and byte 2 are in sync: | 7217 // Make sure that FunctionKind and byte 2 are in sync: |
| 7219 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ | 7218 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ |
| 7220 STATIC_ASSERT(FunctionKind::functionKind == \ | 7219 STATIC_ASSERT(FunctionKind::functionKind == \ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 7250 #endif | 7249 #endif |
| 7251 | 7250 |
| 7252 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= | 7251 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
| 7253 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 7252 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
| 7254 | 7253 |
| 7255 public: | 7254 public: |
| 7256 // Constants for optimizing codegen for strict mode function and | 7255 // Constants for optimizing codegen for strict mode function and |
| 7257 // native tests when using integer-width instructions. | 7256 // native tests when using integer-width instructions. |
| 7258 static const int kStrictModeBit = | 7257 static const int kStrictModeBit = |
| 7259 kStrictModeFunction + kCompilerHintsSmiTagSize; | 7258 kStrictModeFunction + kCompilerHintsSmiTagSize; |
| 7260 static const int kStrongModeBit = | |
| 7261 kStrongModeFunction + kCompilerHintsSmiTagSize; | |
| 7262 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; | 7259 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; |
| 7263 | 7260 |
| 7264 static const int kClassConstructorBits = | 7261 static const int kClassConstructorBits = |
| 7265 FunctionKind::kClassConstructor | 7262 FunctionKind::kClassConstructor |
| 7266 << (kFunctionKind + kCompilerHintsSmiTagSize); | 7263 << (kFunctionKind + kCompilerHintsSmiTagSize); |
| 7267 | 7264 |
| 7268 // Constants for optimizing codegen for strict mode function and | 7265 // Constants for optimizing codegen for strict mode function and |
| 7269 // native tests. | 7266 // native tests. |
| 7270 // Allows to use byte-width instructions. | 7267 // Allows to use byte-width instructions. |
| 7271 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; | 7268 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; |
| 7272 static const int kStrongModeBitWithinByte = kStrongModeBit % kBitsPerByte; | |
| 7273 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; | 7269 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; |
| 7274 | 7270 |
| 7275 static const int kClassConstructorBitsWithinByte = | 7271 static const int kClassConstructorBitsWithinByte = |
| 7276 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; | 7272 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; |
| 7277 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); | 7273 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); |
| 7278 | 7274 |
| 7279 #if defined(V8_TARGET_LITTLE_ENDIAN) | 7275 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 7280 #define BYTE_OFFSET(compiler_hint) \ | 7276 #define BYTE_OFFSET(compiler_hint) \ |
| 7281 kCompilerHintsOffset + \ | 7277 kCompilerHintsOffset + \ |
| 7282 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte | 7278 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte |
| 7283 #elif defined(V8_TARGET_BIG_ENDIAN) | 7279 #elif defined(V8_TARGET_BIG_ENDIAN) |
| 7284 #define BYTE_OFFSET(compiler_hint) \ | 7280 #define BYTE_OFFSET(compiler_hint) \ |
| 7285 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ | 7281 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ |
| 7286 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) | 7282 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) |
| 7287 #else | 7283 #else |
| 7288 #error Unknown byte ordering | 7284 #error Unknown byte ordering |
| 7289 #endif | 7285 #endif |
| 7290 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7286 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
| 7291 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); | |
| 7292 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7287 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
| 7293 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7288 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
| 7294 #undef BYTE_OFFSET | 7289 #undef BYTE_OFFSET |
| 7295 | 7290 |
| 7296 private: | 7291 private: |
| 7297 // Returns entry from optimized code map for specified context and OSR entry. | 7292 // Returns entry from optimized code map for specified context and OSR entry. |
| 7298 // The result is either kNotFound, kSharedCodeIndex for context-independent | 7293 // The result is either kNotFound, kSharedCodeIndex for context-independent |
| 7299 // entry or a start index of the context-dependent entry. | 7294 // entry or a start index of the context-dependent entry. |
| 7300 int SearchOptimizedCodeMapEntry(Context* native_context, | 7295 int SearchOptimizedCodeMapEntry(Context* native_context, |
| 7301 BailoutId osr_ast_id); | 7296 BailoutId osr_ast_id); |
| (...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10883 } | 10878 } |
| 10884 return value; | 10879 return value; |
| 10885 } | 10880 } |
| 10886 }; | 10881 }; |
| 10887 | 10882 |
| 10888 | 10883 |
| 10889 } // NOLINT, false-positive due to second-order macros. | 10884 } // NOLINT, false-positive due to second-order macros. |
| 10890 } // NOLINT, false-positive due to second-order macros. | 10885 } // NOLINT, false-positive due to second-order macros. |
| 10891 | 10886 |
| 10892 #endif // V8_OBJECTS_H_ | 10887 #endif // V8_OBJECTS_H_ |
| OLD | NEW |