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 <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 7089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7100 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 7100 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
7101 static const int kCompilerHintsSmiTagSize = 0; | 7101 static const int kCompilerHintsSmiTagSize = 0; |
7102 static const int kCompilerHintsSize = kIntSize; | 7102 static const int kCompilerHintsSize = kIntSize; |
7103 #endif | 7103 #endif |
7104 | 7104 |
7105 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= | 7105 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= |
7106 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 7106 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
7107 | 7107 |
7108 public: | 7108 public: |
7109 // Constants for optimizing codegen for strict mode function and | 7109 // Constants for optimizing codegen for strict mode function and |
| 7110 // native tests when using integer-width instructions. |
| 7111 static const int kStrictModeBit = |
| 7112 kStrictModeFunction + kCompilerHintsSmiTagSize; |
| 7113 static const int kStrongModeBit = |
| 7114 kStrongModeFunction + kCompilerHintsSmiTagSize; |
| 7115 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; |
| 7116 static const int kBoundBit = kBoundFunction + kCompilerHintsSmiTagSize; |
| 7117 |
| 7118 static const int kClassConstructorBits = |
| 7119 FunctionKind::kClassConstructor |
| 7120 << (kFunctionKind + kCompilerHintsSmiTagSize); |
| 7121 |
| 7122 // Constants for optimizing codegen for strict mode function and |
7110 // native tests. | 7123 // native tests. |
7111 // Allows to use byte-width instructions. | 7124 // Allows to use byte-width instructions. |
7112 static const int kStrictModeBitWithinByte = | 7125 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; |
7113 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 7126 static const int kStrongModeBitWithinByte = kStrongModeBit % kBitsPerByte; |
7114 static const int kStrongModeBitWithinByte = | 7127 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; |
7115 (kStrongModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 7128 static const int kBoundBitWithinByte = kBoundBit % kBitsPerByte; |
7116 | |
7117 static const int kNativeBitWithinByte = | |
7118 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; | |
7119 | |
7120 static const int kBoundBitWithinByte = | |
7121 (kBoundFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | |
7122 | 7129 |
7123 static const int kClassConstructorBitsWithinByte = | 7130 static const int kClassConstructorBitsWithinByte = |
7124 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; | 7131 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; |
7125 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); | 7132 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); |
7126 | 7133 |
7127 #if defined(V8_TARGET_LITTLE_ENDIAN) | 7134 #if defined(V8_TARGET_LITTLE_ENDIAN) |
7128 #define BYTE_OFFSET(compiler_hint) \ | 7135 #define BYTE_OFFSET(compiler_hint) \ |
7129 kCompilerHintsOffset + \ | 7136 kCompilerHintsOffset + \ |
7130 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte | 7137 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte |
7131 #elif defined(V8_TARGET_BIG_ENDIAN) | 7138 #elif defined(V8_TARGET_BIG_ENDIAN) |
7132 #define BYTE_OFFSET(compiler_hint) \ | 7139 #define BYTE_OFFSET(compiler_hint) \ |
7133 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ | 7140 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ |
7134 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) | 7141 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) |
7135 #else | 7142 #else |
7136 #error Unknown byte ordering | 7143 #error Unknown byte ordering |
7137 #endif | 7144 #endif |
7138 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7145 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
7139 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); | 7146 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); |
7140 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7147 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
7141 static const int kBoundByteOffset = BYTE_OFFSET(kBoundFunction); | 7148 static const int kBoundByteOffset = BYTE_OFFSET(kBoundFunction); |
7142 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7149 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
(...skipping 3608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10751 } | 10758 } |
10752 return value; | 10759 return value; |
10753 } | 10760 } |
10754 }; | 10761 }; |
10755 | 10762 |
10756 | 10763 |
10757 } // NOLINT, false-positive due to second-order macros. | 10764 } // NOLINT, false-positive due to second-order macros. |
10758 } // NOLINT, false-positive due to second-order macros. | 10765 } // NOLINT, false-positive due to second-order macros. |
10759 | 10766 |
10760 #endif // V8_OBJECTS_H_ | 10767 #endif // V8_OBJECTS_H_ |
OLD | NEW |