Commit 1ae0e663 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Cleanup SharedFunctionInfo fields definitions (7).

Use new macros for defining bit fields.

Bug: v8:6470
Change-Id: Ie580ba7fc64f9958a3d4586d54d67e5dc66f1b53
Reviewed-on: https://chromium-review.googlesource.com/529824
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45867}
parent 0cef7f7c
...@@ -131,21 +131,26 @@ void SharedFunctionInfo::set_kind(FunctionKind kind) { ...@@ -131,21 +131,26 @@ void SharedFunctionInfo::set_kind(FunctionKind kind) {
set_compiler_hints(hints); set_compiler_hints(hints);
} }
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
name_should_print_as_anonymous, kNameShouldPrintAsAnonymous) name_should_print_as_anonymous,
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, is_anonymous_expression, SharedFunctionInfo::NameShouldPrintAsAnonymousBit)
kIsAnonymousExpression) BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, is_anonymous_expression,
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, deserialized, kDeserialized) SharedFunctionInfo::IsAnonymousExpressionBit)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, has_no_side_effect, BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, deserialized,
kHasNoSideEffect) SharedFunctionInfo::IsDeserializedBit)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, computed_has_no_side_effect, BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, has_no_side_effect,
kComputedHasNoSideEffect) SharedFunctionInfo::HasNoSideEffectBit)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, debug_is_blackboxed, BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
kDebugIsBlackboxed) computed_has_no_side_effect,
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, computed_debug_is_blackboxed, SharedFunctionInfo::ComputedHasNoSideEffectBit)
kComputedDebugIsBlackboxed) BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, debug_is_blackboxed,
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, has_reported_binary_coverage, SharedFunctionInfo::DebugIsBlackboxedBit)
kHasReportedBinaryCoverage) BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
computed_debug_is_blackboxed,
SharedFunctionInfo::ComputedDebugIsBlackboxedBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
has_reported_binary_coverage,
SharedFunctionInfo::HasReportedBinaryCoverageBit)
void SharedFunctionInfo::DontAdaptArguments() { void SharedFunctionInfo::DontAdaptArguments() {
DCHECK(code()->kind() == Code::BUILTIN || code()->kind() == Code::STUB); DCHECK(code()->kind() == Code::BUILTIN || code()->kind() == Code::STUB);
......
...@@ -507,6 +507,7 @@ class SharedFunctionInfo : public HeapObject { ...@@ -507,6 +507,7 @@ class SharedFunctionInfo : public HeapObject {
V(StartPositionBits, int, 30, _) V(StartPositionBits, int, 30, _)
DEFINE_BIT_FIELDS(START_POSITION_AND_TYPE_BIT_FIELDS) DEFINE_BIT_FIELDS(START_POSITION_AND_TYPE_BIT_FIELDS)
#undef START_POSITION_AND_TYPE_BIT_FIELDS
// Bit positions in |compiler_hints|. // Bit positions in |compiler_hints|.
#define COMPILER_HINTS_BIT_FIELDS(V, _) \ #define COMPILER_HINTS_BIT_FIELDS(V, _) \
...@@ -533,6 +534,7 @@ class SharedFunctionInfo : public HeapObject { ...@@ -533,6 +534,7 @@ class SharedFunctionInfo : public HeapObject {
/* Bits 27-31 are unused. */ /* Bits 27-31 are unused. */
DEFINE_BIT_FIELDS(COMPILER_HINTS_BIT_FIELDS) DEFINE_BIT_FIELDS(COMPILER_HINTS_BIT_FIELDS)
#undef COMPILER_HINTS_BIT_FIELDS
// Masks for checking if certain FunctionKind bits are set without fully // Masks for checking if certain FunctionKind bits are set without fully
// decoding of the FunctionKind bit field. // decoding of the FunctionKind bit field.
...@@ -541,27 +543,36 @@ class SharedFunctionInfo : public HeapObject { ...@@ -541,27 +543,36 @@ class SharedFunctionInfo : public HeapObject {
static const int kDerivedConstructorMask = FunctionKind::kDerivedConstructor static const int kDerivedConstructorMask = FunctionKind::kDerivedConstructor
<< FunctionKindBits::kShift; << FunctionKindBits::kShift;
// Bit positions in |debugger_hints|. // Bit positions in |debugger_hints|.
enum DebuggerHints { #define DEBUGGER_HINTS_BIT_FIELDS(V, _) \
kIsAnonymousExpression, V(IsAnonymousExpressionBit, bool, 1, _) \
kNameShouldPrintAsAnonymous, V(NameShouldPrintAsAnonymousBit, bool, 1, _) \
kDeserialized, V(IsDeserializedBit, bool, 1, _) \
kHasNoSideEffect, V(HasNoSideEffectBit, bool, 1, _) \
kComputedHasNoSideEffect, V(ComputedHasNoSideEffectBit, bool, 1, _) \
kDebugIsBlackboxed, V(DebugIsBlackboxedBit, bool, 1, _) \
kComputedDebugIsBlackboxed, V(ComputedDebugIsBlackboxedBit, bool, 1, _) \
kHasReportedBinaryCoverage V(HasReportedBinaryCoverageBit, bool, 1, _)
};
DEFINE_BIT_FIELDS(DEBUGGER_HINTS_BIT_FIELDS)
// Bit fields in |counters|. #undef DEBUGGER_HINTS_BIT_FIELDS
typedef BitField<int, 0, 4> DeoptCountBits;
typedef BitField<int, DeoptCountBits::kNext, 18> OptReenableTriesBits; // Bit fields in |counters|.
typedef BitField<int, OptReenableTriesBits::kNext, 8> ICAgeBits; #define COUNTERS_BIT_FIELDS(V, _) \
V(DeoptCountBits, int, 4, _) \
// Bit fields in |opt_count_and_bailout_reason|. V(OptReenableTriesBits, int, 18, _) \
typedef BitField<int, 0, 22> OptCountBits; V(ICAgeBits, int, 8, _)
typedef BitField<BailoutReason, OptCountBits::kNext, 8>
DisabledOptimizationReasonBits; DEFINE_BIT_FIELDS(COUNTERS_BIT_FIELDS)
#undef COUNTERS_BIT_FIELDS
// Bit fields in |opt_count_and_bailout_reason|.
#define OPT_COUNT_AND_BAILOUT_REASON_BIT_FIELDS(V, _) \
V(OptCountBits, int, 22, _) \
V(DisabledOptimizationReasonBits, BailoutReason, 8, _)
DEFINE_BIT_FIELDS(OPT_COUNT_AND_BAILOUT_REASON_BIT_FIELDS)
#undef OPT_COUNT_AND_BAILOUT_REASON_BIT_FIELDS
private: private:
FRIEND_TEST(PreParserTest, LazyFunctionLength); FRIEND_TEST(PreParserTest, LazyFunctionLength);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment