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) {
set_compiler_hints(hints);
}
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints,
name_should_print_as_anonymous, kNameShouldPrintAsAnonymous)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, is_anonymous_expression,
kIsAnonymousExpression)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, deserialized, kDeserialized)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, has_no_side_effect,
kHasNoSideEffect)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, computed_has_no_side_effect,
kComputedHasNoSideEffect)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, debug_is_blackboxed,
kDebugIsBlackboxed)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, computed_debug_is_blackboxed,
kComputedDebugIsBlackboxed)
BOOL_ACCESSORS(SharedFunctionInfo, debugger_hints, has_reported_binary_coverage,
kHasReportedBinaryCoverage)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
name_should_print_as_anonymous,
SharedFunctionInfo::NameShouldPrintAsAnonymousBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, is_anonymous_expression,
SharedFunctionInfo::IsAnonymousExpressionBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, deserialized,
SharedFunctionInfo::IsDeserializedBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, has_no_side_effect,
SharedFunctionInfo::HasNoSideEffectBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints,
computed_has_no_side_effect,
SharedFunctionInfo::ComputedHasNoSideEffectBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, debugger_hints, debug_is_blackboxed,
SharedFunctionInfo::DebugIsBlackboxedBit)
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() {
DCHECK(code()->kind() == Code::BUILTIN || code()->kind() == Code::STUB);
......
......@@ -507,6 +507,7 @@ class SharedFunctionInfo : public HeapObject {
V(StartPositionBits, int, 30, _)
DEFINE_BIT_FIELDS(START_POSITION_AND_TYPE_BIT_FIELDS)
#undef START_POSITION_AND_TYPE_BIT_FIELDS
// Bit positions in |compiler_hints|.
#define COMPILER_HINTS_BIT_FIELDS(V, _) \
......@@ -533,6 +534,7 @@ class SharedFunctionInfo : public HeapObject {
/* Bits 27-31 are unused. */
DEFINE_BIT_FIELDS(COMPILER_HINTS_BIT_FIELDS)
#undef COMPILER_HINTS_BIT_FIELDS
// Masks for checking if certain FunctionKind bits are set without fully
// decoding of the FunctionKind bit field.
......@@ -541,27 +543,36 @@ class SharedFunctionInfo : public HeapObject {
static const int kDerivedConstructorMask = FunctionKind::kDerivedConstructor
<< FunctionKindBits::kShift;
// Bit positions in |debugger_hints|.
enum DebuggerHints {
kIsAnonymousExpression,
kNameShouldPrintAsAnonymous,
kDeserialized,
kHasNoSideEffect,
kComputedHasNoSideEffect,
kDebugIsBlackboxed,
kComputedDebugIsBlackboxed,
kHasReportedBinaryCoverage
};
// Bit fields in |counters|.
typedef BitField<int, 0, 4> DeoptCountBits;
typedef BitField<int, DeoptCountBits::kNext, 18> OptReenableTriesBits;
typedef BitField<int, OptReenableTriesBits::kNext, 8> ICAgeBits;
// Bit fields in |opt_count_and_bailout_reason|.
typedef BitField<int, 0, 22> OptCountBits;
typedef BitField<BailoutReason, OptCountBits::kNext, 8>
DisabledOptimizationReasonBits;
// Bit positions in |debugger_hints|.
#define DEBUGGER_HINTS_BIT_FIELDS(V, _) \
V(IsAnonymousExpressionBit, bool, 1, _) \
V(NameShouldPrintAsAnonymousBit, bool, 1, _) \
V(IsDeserializedBit, bool, 1, _) \
V(HasNoSideEffectBit, bool, 1, _) \
V(ComputedHasNoSideEffectBit, bool, 1, _) \
V(DebugIsBlackboxedBit, bool, 1, _) \
V(ComputedDebugIsBlackboxedBit, bool, 1, _) \
V(HasReportedBinaryCoverageBit, bool, 1, _)
DEFINE_BIT_FIELDS(DEBUGGER_HINTS_BIT_FIELDS)
#undef DEBUGGER_HINTS_BIT_FIELDS
// Bit fields in |counters|.
#define COUNTERS_BIT_FIELDS(V, _) \
V(DeoptCountBits, int, 4, _) \
V(OptReenableTriesBits, int, 18, _) \
V(ICAgeBits, int, 8, _)
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:
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