Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/objects.h

Issue 2437043002: [compiler] Mark shared functions for optimization (Closed)
Patch Set: Unmark after compiling Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory> 9 #include <memory>
10 10
(...skipping 7637 matching lines...) Expand 10 before | Expand all | Expand 10 after
7648 7648
7649 // Indicates that the the shared function info is deserialized from cache. 7649 // Indicates that the the shared function info is deserialized from cache.
7650 DECL_BOOLEAN_ACCESSORS(deserialized) 7650 DECL_BOOLEAN_ACCESSORS(deserialized)
7651 7651
7652 // Indicates that the the shared function info has never been compiled before. 7652 // Indicates that the the shared function info has never been compiled before.
7653 DECL_BOOLEAN_ACCESSORS(never_compiled) 7653 DECL_BOOLEAN_ACCESSORS(never_compiled)
7654 7654
7655 // Whether this function was created from a FunctionDeclaration. 7655 // Whether this function was created from a FunctionDeclaration.
7656 DECL_BOOLEAN_ACCESSORS(is_declaration) 7656 DECL_BOOLEAN_ACCESSORS(is_declaration)
7657 7657
7658 // Whether this function was marked to be optimized.
7659 DECL_BOOLEAN_ACCESSORS(was_marked_for_optimization)
7660
7658 // Indicates that asm->wasm conversion failed and should not be re-attempted. 7661 // Indicates that asm->wasm conversion failed and should not be re-attempted.
7659 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken) 7662 DECL_BOOLEAN_ACCESSORS(is_asm_wasm_broken)
7660 7663
7661 inline FunctionKind kind() const; 7664 inline FunctionKind kind() const;
7662 inline void set_kind(FunctionKind kind); 7665 inline void set_kind(FunctionKind kind);
7663 7666
7664 // Indicates whether or not the code in the shared function support 7667 // Indicates whether or not the code in the shared function support
7665 // deoptimization. 7668 // deoptimization.
7666 inline bool has_deoptimization_support(); 7669 inline bool has_deoptimization_support();
7667 7670
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
7897 // the start_position_and_type field. 7900 // the start_position_and_type field.
7898 static const int kIsNamedExpressionBit = 0; 7901 static const int kIsNamedExpressionBit = 0;
7899 static const int kIsTopLevelBit = 1; 7902 static const int kIsTopLevelBit = 1;
7900 static const int kStartPositionShift = 2; 7903 static const int kStartPositionShift = 2;
7901 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 7904 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
7902 7905
7903 // Bit positions in compiler_hints. 7906 // Bit positions in compiler_hints.
7904 enum CompilerHints { 7907 enum CompilerHints {
7905 // byte 0 7908 // byte 0
7906 kAllowLazyCompilation, 7909 kAllowLazyCompilation,
7907 kIsDeclaration, 7910 kWasMarkedForOptimization,
7908 kOptimizationDisabled, 7911 kOptimizationDisabled,
7909 kNeverCompiled, 7912 kNeverCompiled,
7910 kNative, 7913 kNative,
7911 kStrictModeFunction, 7914 kStrictModeFunction,
7912 kUsesArguments, 7915 kUsesArguments,
7913 kNeedsHomeObject, 7916 kNeedsHomeObject,
7914 // byte 1 7917 // byte 1
7915 kHasDuplicateParameters, 7918 kHasDuplicateParameters,
7916 kForceInline, 7919 kForceInline,
7917 kIsAsmFunction, 7920 kIsAsmFunction,
7918 kIsAnonymousExpression, 7921 kIsAnonymousExpression,
7919 kNameShouldPrintAsAnonymous, 7922 kNameShouldPrintAsAnonymous,
7920 kIsFunction, 7923 kIsFunction,
7921 kDontCrankshaft, 7924 kDontCrankshaft,
7922 kDontFlush, 7925 kDontFlush,
7923 // byte 2 7926 // byte 2
7924 kFunctionKind, 7927 kFunctionKind,
7925 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind 7928 // rest of byte 2 and first two bits of byte 3 are used by FunctionKind
7926 // byte 3 7929 // byte 3
7927 kDeserialized = kFunctionKind + 10, 7930 kDeserialized = kFunctionKind + 10,
7931 kIsDeclaration,
7928 kIsAsmWasmBroken, 7932 kIsAsmWasmBroken,
7929 kRequiresClassFieldInit, 7933 kRequiresClassFieldInit,
7930 kIsClassFieldInitializer, 7934 kIsClassFieldInitializer,
7931 kCompilerHintsCount, // Pseudo entry 7935 kCompilerHintsCount, // Pseudo entry
7932 }; 7936 };
7933 // kFunctionKind has to be byte-aligned 7937 // kFunctionKind has to be byte-aligned
7934 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); 7938 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0);
7935 7939
7936 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {}; 7940 class FunctionKindBits : public BitField<FunctionKind, kFunctionKind, 10> {};
7937 7941
7938 class DeoptCountBits : public BitField<int, 0, 4> {}; 7942 class DeoptCountBits : public BitField<int, 0, 4> {};
7939 class OptReenableTriesBits : public BitField<int, 4, 18> {}; 7943 class OptReenableTriesBits : public BitField<int, 4, 18> {};
7940 class ICAgeBits : public BitField<int, 22, 8> {}; 7944 class ICAgeBits : public BitField<int, 22, 8> {};
7941 7945
7942 class OptCountBits : public BitField<int, 0, 22> {}; 7946 class OptCountBits : public BitField<int, 0, 22> {};
7943 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {}; 7947 class DisabledOptimizationReasonBits : public BitField<int, 22, 8> {};
7944 7948
7945 private: 7949 private:
7946 #if V8_HOST_ARCH_32_BIT 7950 #if V8_HOST_ARCH_32_BIT
7947 // On 32 bit platforms, compiler hints is a smi. 7951 // On 32 bit platforms, compiler hints is a smi.
7948 static const int kCompilerHintsSmiTagSize = kSmiTagSize; 7952 static const int kCompilerHintsSmiTagSize = kSmiTagSize;
7949 static const int kCompilerHintsSize = kPointerSize; 7953 static const int kCompilerHintsSize = kPointerSize;
7950 #else 7954 #else
7951 // On 64 bit platforms, compiler hints is not a smi, see comment above. 7955 // On 64 bit platforms, compiler hints is not a smi, see comment above.
7952 static const int kCompilerHintsSmiTagSize = 0; 7956 static const int kCompilerHintsSmiTagSize = 0;
7953 static const int kCompilerHintsSize = kIntSize; 7957 static const int kCompilerHintsSize = kIntSize;
7954 #endif 7958 #endif
7955 7959
7956 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount <= 7960 STATIC_ASSERT(SharedFunctionInfo::kCompilerHintsCount +
7961 SharedFunctionInfo::kCompilerHintsSmiTagSize <=
7957 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); 7962 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte);
7958 7963
7959 public: 7964 public:
7960 // Constants for optimizing codegen for strict mode function and 7965 // Constants for optimizing codegen for strict mode function and
7961 // native tests when using integer-width instructions. 7966 // native tests when using integer-width instructions.
7962 static const int kStrictModeBit = 7967 static const int kStrictModeBit =
7963 kStrictModeFunction + kCompilerHintsSmiTagSize; 7968 kStrictModeFunction + kCompilerHintsSmiTagSize;
7964 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; 7969 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize;
7965 static const int kHasDuplicateParametersBit = 7970 static const int kHasDuplicateParametersBit =
7966 kHasDuplicateParameters + kCompilerHintsSmiTagSize; 7971 kHasDuplicateParameters + kCompilerHintsSmiTagSize;
7967 7972
7968 static const int kFunctionKindShift = 7973 static const int kFunctionKindShift =
7969 kFunctionKind + kCompilerHintsSmiTagSize; 7974 kFunctionKind + kCompilerHintsSmiTagSize;
7970 static const int kAllFunctionKindBitsMask = FunctionKindBits::kMask 7975 static const int kAllFunctionKindBitsMask = FunctionKindBits::kMask
7971 << kCompilerHintsSmiTagSize; 7976 << kCompilerHintsSmiTagSize;
7972 7977
7978 static const int kWasMarkedForOptimizationBit =
7979 kWasMarkedForOptimization + kCompilerHintsSmiTagSize;
7980
7973 // Constants for optimizing codegen for strict mode function and 7981 // Constants for optimizing codegen for strict mode function and
7974 // native tests. 7982 // native tests.
7975 // Allows to use byte-width instructions. 7983 // Allows to use byte-width instructions.
7976 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; 7984 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte;
7977 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; 7985 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte;
7978 static const int kHasDuplicateParametersBitWithinByte = 7986 static const int kHasDuplicateParametersBitWithinByte =
7979 kHasDuplicateParametersBit % kBitsPerByte; 7987 kHasDuplicateParametersBit % kBitsPerByte;
7980 7988
7981 static const int kClassConstructorBitsWithinByte = 7989 static const int kClassConstructorBitsWithinByte =
7982 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; 7990 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize;
7983 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); 7991 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte));
7984 7992
7993 static const int kWasMarkedForOptimizationBitWithinByte =
7994 kWasMarkedForOptimizationBit % kBitsPerByte;
7995
7985 #if defined(V8_TARGET_LITTLE_ENDIAN) 7996 #if defined(V8_TARGET_LITTLE_ENDIAN)
7986 #define BYTE_OFFSET(compiler_hint) \ 7997 #define BYTE_OFFSET(compiler_hint) \
7987 kCompilerHintsOffset + \ 7998 kCompilerHintsOffset + \
7988 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte 7999 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte
7989 #elif defined(V8_TARGET_BIG_ENDIAN) 8000 #elif defined(V8_TARGET_BIG_ENDIAN)
7990 #define BYTE_OFFSET(compiler_hint) \ 8001 #define BYTE_OFFSET(compiler_hint) \
7991 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ 8002 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \
7992 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) 8003 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte)
7993 #else 8004 #else
7994 #error Unknown byte ordering 8005 #error Unknown byte ordering
7995 #endif 8006 #endif
7996 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); 8007 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction);
7997 static const int kNativeByteOffset = BYTE_OFFSET(kNative); 8008 static const int kNativeByteOffset = BYTE_OFFSET(kNative);
7998 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); 8009 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind);
7999 static const int kHasDuplicateParametersByteOffset = 8010 static const int kHasDuplicateParametersByteOffset =
8000 BYTE_OFFSET(kHasDuplicateParameters); 8011 BYTE_OFFSET(kHasDuplicateParameters);
8012 static const int kWasMarkedForOptimizationByteOffset =
8013 BYTE_OFFSET(kWasMarkedForOptimization);
8001 #undef BYTE_OFFSET 8014 #undef BYTE_OFFSET
8002 8015
8003 private: 8016 private:
8004 // Returns entry from optimized code map for specified context and OSR entry. 8017 // Returns entry from optimized code map for specified context and OSR entry.
8005 // The result is either kNotFound, or a start index of the context-dependent 8018 // The result is either kNotFound, or a start index of the context-dependent
8006 // entry. 8019 // entry.
8007 int SearchOptimizedCodeMapEntry(Context* native_context, 8020 int SearchOptimizedCodeMapEntry(Context* native_context,
8008 BailoutId osr_ast_id); 8021 BailoutId osr_ast_id);
8009 8022
8010 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 8023 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
(...skipping 3719 matching lines...) Expand 10 before | Expand all | Expand 10 after
11730 } 11743 }
11731 return value; 11744 return value;
11732 } 11745 }
11733 }; 11746 };
11734 11747
11735 11748
11736 } // NOLINT, false-positive due to second-order macros. 11749 } // NOLINT, false-positive due to second-order macros.
11737 } // NOLINT, false-positive due to second-order macros. 11750 } // NOLINT, false-positive due to second-order macros.
11738 11751
11739 #endif // V8_OBJECTS_H_ 11752 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698