Revert "[utils] Make BitField final"

This reverts commit 658ff20085.

Reason for revert: Fails no-i18n bot: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20-%20noi18n%20-%20debug/27826

Original change's description:
> [utils] Make BitField final
> 
> We have hundreds of classes that derive from {BitField} without adding
> any functionality. This CL switches all such occurrences to 'using'
> declarations instead.
> 
> Before:
>   class MyBitField : public BitField<int, 6, 4, MyEnum> {};
> After:
>   using MyBitField = BitField<int, 6, 4, MyEnum>;
> 
> This might reduce compilation time by reducing the number of existing
> classes.
> 
> The old pattern is forbidden now by making {BitField} final.
> 
> R=​yangguo@chromium.org
> 
> Bug: v8:9396, v8:7629
> Change-Id: I8a8364707e8eae0bb522af2459c160e3293eecbb
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1722565
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#62956}

TBR=yangguo@chromium.org,clemensh@chromium.org

Change-Id: I50234a09c77aa89fdcf1e01c2497cc08d3ac79a8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9396, v8:7629
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1724377
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62958}
This commit is contained in:
Clemens Hammacher 2019-07-29 13:17:33 +00:00 committed by Commit Bot
parent b8a50cf739
commit 753a07db03
35 changed files with 313 additions and 269 deletions

View File

@ -168,7 +168,7 @@ class AstNode: public ZoneObject {
void* operator new(size_t size);
int position_;
using NodeTypeField = BitField<NodeType, 0, 6>;
class NodeTypeField : public BitField<NodeType, 0, 6> {};
protected:
uint32_t bit_field_;
@ -265,7 +265,8 @@ class Expression : public AstNode {
}
private:
using IsParenthesizedField = BitField<bool, AstNode::kNextBitFieldIndex, 1>;
class IsParenthesizedField
: public BitField<bool, AstNode::kNextBitFieldIndex, 1> {};
protected:
Expression(int pos, NodeType type) : AstNode(pos, type) {
@ -320,8 +321,8 @@ class BreakableStatement : public Statement {
}
private:
using BreakableTypeField =
BitField<BreakableType, Statement::kNextBitFieldIndex, 1>;
class BreakableTypeField
: public BitField<BreakableType, Statement::kNextBitFieldIndex, 1> {};
protected:
BreakableStatement(BreakableType breakable_type, int position, NodeType type)
@ -356,9 +357,10 @@ class Block : public BreakableStatement {
ZonePtrList<Statement> statements_;
Scope* scope_;
using IgnoreCompletionField =
BitField<bool, BreakableStatement::kNextBitFieldIndex, 1>;
using IsLabeledField = BitField<bool, IgnoreCompletionField::kNext, 1>;
class IgnoreCompletionField
: public BitField<bool, BreakableStatement::kNextBitFieldIndex, 1> {};
class IsLabeledField
: public BitField<bool, IgnoreCompletionField::kNext, 1> {};
protected:
Block(Zone* zone, ZonePtrList<const AstRawString>* labels, int capacity,
@ -446,7 +448,8 @@ class VariableDeclaration : public Declaration {
private:
friend class AstNodeFactory;
using IsNestedField = BitField<bool, Declaration::kNextBitFieldIndex, 1>;
class IsNestedField
: public BitField<bool, Declaration::kNextBitFieldIndex, 1> {};
protected:
explicit VariableDeclaration(int pos, bool is_nested = false)
@ -737,7 +740,8 @@ class ReturnStatement final : public JumpStatement {
Expression* expression_;
int end_position_;
using TypeField = BitField<Type, JumpStatement::kNextBitFieldIndex, 1>;
class TypeField
: public BitField<Type, JumpStatement::kNextBitFieldIndex, 1> {};
};
@ -973,7 +977,8 @@ class SloppyBlockFunctionStatement final : public Statement {
private:
friend class AstNodeFactory;
using TokenField = BitField<Token::Value, Statement::kNextBitFieldIndex, 8>;
class TokenField
: public BitField<Token::Value, Statement::kNextBitFieldIndex, 8> {};
SloppyBlockFunctionStatement(int pos, Variable* var, Token::Value init,
Statement* statement)
@ -1074,7 +1079,7 @@ class Literal final : public Expression {
private:
friend class AstNodeFactory;
using TypeField = BitField<Type, Expression::kNextBitFieldIndex, 4>;
class TypeField : public BitField<Type, Expression::kNextBitFieldIndex, 4> {};
Literal(int smi, int position) : Expression(position, kLiteral), smi_(smi) {
bit_field_ = TypeField::update(bit_field_, kSmi);
@ -1205,10 +1210,10 @@ class AggregateLiteral : public MaterializedLiteral {
private:
int depth_ : 31;
using NeedsInitialAllocationSiteField =
BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1>;
using IsSimpleField =
BitField<bool, NeedsInitialAllocationSiteField::kNext, 1>;
class NeedsInitialAllocationSiteField
: public BitField<bool, MaterializedLiteral::kNextBitFieldIndex, 1> {};
class IsSimpleField
: public BitField<bool, NeedsInitialAllocationSiteField::kNext, 1> {};
protected:
friend class AstNodeFactory;
@ -1408,11 +1413,14 @@ class ObjectLiteral final : public AggregateLiteral {
Handle<ObjectBoilerplateDescription> boilerplate_description_;
ZoneList<Property*> properties_;
using HasElementsField =
BitField<bool, AggregateLiteral::kNextBitFieldIndex, 1>;
using HasRestPropertyField = BitField<bool, HasElementsField::kNext, 1>;
using FastElementsField = BitField<bool, HasRestPropertyField::kNext, 1>;
using HasNullPrototypeField = BitField<bool, FastElementsField::kNext, 1>;
class HasElementsField
: public BitField<bool, AggregateLiteral::kNextBitFieldIndex, 1> {};
class HasRestPropertyField
: public BitField<bool, HasElementsField::kNext, 1> {};
class FastElementsField
: public BitField<bool, HasRestPropertyField::kNext, 1> {};
class HasNullPrototypeField
: public BitField<bool, FastElementsField::kNext, 1> {};
};
// An array literal has a literals object that is used
@ -1578,14 +1586,15 @@ class VariableProxy final : public Expression {
explicit VariableProxy(const VariableProxy* copy_from);
using IsAssignedField = BitField<bool, Expression::kNextBitFieldIndex, 1>;
using IsResolvedField = BitField<bool, IsAssignedField::kNext, 1>;
using IsRemovedFromUnresolvedField =
BitField<bool, IsResolvedField::kNext, 1>;
using IsNewTargetField =
BitField<bool, IsRemovedFromUnresolvedField::kNext, 1>;
using HoleCheckModeField =
BitField<HoleCheckMode, IsNewTargetField::kNext, 1>;
class IsAssignedField
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
class IsResolvedField : public BitField<bool, IsAssignedField::kNext, 1> {};
class IsRemovedFromUnresolvedField
: public BitField<bool, IsResolvedField::kNext, 1> {};
class IsNewTargetField
: public BitField<bool, IsRemovedFromUnresolvedField::kNext, 1> {};
class HoleCheckModeField
: public BitField<HoleCheckMode, IsNewTargetField::kNext, 1> {};
union {
const AstRawString* raw_name_; // if !is_resolved_
@ -1734,8 +1743,10 @@ class Call final : public Expression {
arguments.CopyTo(&arguments_, zone);
}
using IsPossiblyEvalField = BitField<bool, Expression::kNextBitFieldIndex, 1>;
using IsTaggedTemplateField = BitField<bool, IsPossiblyEvalField::kNext, 1>;
class IsPossiblyEvalField
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
class IsTaggedTemplateField
: public BitField<bool, IsPossiblyEvalField::kNext, 1> {};
Expression* expression_;
ZonePtrList<Expression> arguments_;
@ -1827,8 +1838,8 @@ class UnaryOperation final : public Expression {
Expression* expression_;
using OperatorField =
BitField<Token::Value, Expression::kNextBitFieldIndex, 7>;
class OperatorField
: public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {};
};
@ -1854,8 +1865,8 @@ class BinaryOperation final : public Expression {
Expression* left_;
Expression* right_;
using OperatorField =
BitField<Token::Value, Expression::kNextBitFieldIndex, 7>;
class OperatorField
: public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {};
};
class NaryOperation final : public Expression {
@ -1914,8 +1925,8 @@ class NaryOperation final : public Expression {
};
ZoneVector<NaryOperationEntry> subsequent_;
using OperatorField =
BitField<Token::Value, Expression::kNextBitFieldIndex, 7>;
class OperatorField
: public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {};
};
class CountOperation final : public Expression {
@ -1935,8 +1946,9 @@ class CountOperation final : public Expression {
bit_field_ |= IsPrefixField::encode(is_prefix) | TokenField::encode(op);
}
using IsPrefixField = BitField<bool, Expression::kNextBitFieldIndex, 1>;
using TokenField = BitField<Token::Value, IsPrefixField::kNext, 7>;
class IsPrefixField
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
class TokenField : public BitField<Token::Value, IsPrefixField::kNext, 7> {};
Expression* expression_;
};
@ -1966,8 +1978,8 @@ class CompareOperation final : public Expression {
Expression* left_;
Expression* right_;
using OperatorField =
BitField<Token::Value, Expression::kNextBitFieldIndex, 7>;
class OperatorField
: public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {};
};
@ -2059,8 +2071,10 @@ class Assignment : public Expression {
private:
friend class AstNodeFactory;
using TokenField = BitField<Token::Value, Expression::kNextBitFieldIndex, 7>;
using LookupHoistingModeField = BitField<bool, TokenField::kNext, 1>;
class TokenField
: public BitField<Token::Value, Expression::kNextBitFieldIndex, 7> {};
class LookupHoistingModeField : public BitField<bool, TokenField::kNext, 1> {
};
Expression* target_;
Expression* value_;
@ -2118,8 +2132,8 @@ class Suspend : public Expression {
Expression* expression_;
using OnAbruptResumeField =
BitField<OnAbruptResume, Expression::kNextBitFieldIndex, 1>;
class OnAbruptResumeField
: public BitField<OnAbruptResume, Expression::kNextBitFieldIndex, 1> {};
};
class Yield final : public Suspend {
@ -2356,17 +2370,17 @@ class FunctionLiteral final : public Expression {
body.CopyTo(&body_, zone);
}
using FunctionTypeBits =
BitField<FunctionType, Expression::kNextBitFieldIndex, 3>;
using Pretenure = BitField<bool, FunctionTypeBits::kNext, 1>;
using HasDuplicateParameters = BitField<bool, Pretenure::kNext, 1>;
using DontOptimizeReasonField =
BitField<BailoutReason, HasDuplicateParameters::kNext, 8>;
using RequiresInstanceMembersInitializer =
BitField<bool, DontOptimizeReasonField::kNext, 1>;
using HasBracesField =
BitField<bool, RequiresInstanceMembersInitializer::kNext, 1>;
using OneshotIIFEBit = BitField<bool, HasBracesField::kNext, 1>;
class FunctionTypeBits
: public BitField<FunctionType, Expression::kNextBitFieldIndex, 3> {};
class Pretenure : public BitField<bool, FunctionTypeBits::kNext, 1> {};
class HasDuplicateParameters : public BitField<bool, Pretenure::kNext, 1> {};
class DontOptimizeReasonField
: public BitField<BailoutReason, HasDuplicateParameters::kNext, 8> {};
class RequiresInstanceMembersInitializer
: public BitField<bool, DontOptimizeReasonField::kNext, 1> {};
class HasBracesField
: public BitField<bool, RequiresInstanceMembersInitializer::kNext, 1> {};
class OneshotIIFEBit : public BitField<bool, HasBracesField::kNext, 1> {};
// expected_property_count_ is the sum of instance fields and properties.
// It can vary depending on whether a function is lazily or eagerly parsed.
@ -2511,12 +2525,12 @@ class ClassLiteral final : public Expression {
ZonePtrList<Property>* properties_;
FunctionLiteral* static_fields_initializer_;
FunctionLiteral* instance_members_initializer_function_;
using HasNameStaticProperty =
BitField<bool, Expression::kNextBitFieldIndex, 1>;
using HasStaticComputedNames =
BitField<bool, HasNameStaticProperty::kNext, 1>;
using IsAnonymousExpression =
BitField<bool, HasStaticComputedNames::kNext, 1>;
class HasNameStaticProperty
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
class HasStaticComputedNames
: public BitField<bool, HasNameStaticProperty::kNext, 1> {};
class IsAnonymousExpression
: public BitField<bool, HasStaticComputedNames::kNext, 1> {};
};

View File

@ -243,21 +243,25 @@ class Variable final : public ZoneObject {
bit_field_ = MaybeAssignedFlagField::update(bit_field_, kMaybeAssigned);
}
using VariableModeField = BitField16<VariableMode, 0, 3>;
using VariableKindField =
BitField16<VariableKind, VariableModeField::kNext, 3>;
using LocationField =
BitField16<VariableLocation, VariableKindField::kNext, 3>;
using ForceContextAllocationField = BitField16<bool, LocationField::kNext, 1>;
using IsUsedField = BitField16<bool, ForceContextAllocationField::kNext, 1>;
using InitializationFlagField =
BitField16<InitializationFlag, IsUsedField::kNext, 1>;
using ForceHoleInitializationField =
BitField16<bool, InitializationFlagField::kNext, 1>;
using MaybeAssignedFlagField =
BitField16<MaybeAssignedFlag, ForceHoleInitializationField::kNext, 1>;
using RequiresBrandCheckField =
BitField16<RequiresBrandCheckFlag, MaybeAssignedFlagField::kNext, 1>;
class VariableModeField : public BitField16<VariableMode, 0, 3> {};
class VariableKindField
: public BitField16<VariableKind, VariableModeField::kNext, 3> {};
class LocationField
: public BitField16<VariableLocation, VariableKindField::kNext, 3> {};
class ForceContextAllocationField
: public BitField16<bool, LocationField::kNext, 1> {};
class IsUsedField
: public BitField16<bool, ForceContextAllocationField::kNext, 1> {};
class InitializationFlagField
: public BitField16<InitializationFlag, IsUsedField::kNext, 1> {};
class ForceHoleInitializationField
: public BitField16<bool, InitializationFlagField::kNext, 1> {};
class MaybeAssignedFlagField
: public BitField16<MaybeAssignedFlag,
ForceHoleInitializationField::kNext, 1> {};
class RequiresBrandCheckField
: public BitField16<RequiresBrandCheckFlag, MaybeAssignedFlagField::kNext,
1> {};
Variable** next() { return &next_; }
friend List;
friend base::ThreadedListTraits<Variable>;

View File

@ -782,10 +782,10 @@ class ArrayConcatVisitor {
storage_ = isolate_->global_handles()->Create(storage);
}
using FastElementsField = BitField<bool, 0, 1>;
using ExceedsLimitField = BitField<bool, 1, 1>;
using IsFixedArrayField = BitField<bool, 2, 1>;
using HasSimpleElementsField = BitField<bool, 3, 1>;
class FastElementsField : public BitField<bool, 0, 1> {};
class ExceedsLimitField : public BitField<bool, 1, 1> {};
class IsFixedArrayField : public BitField<bool, 2, 1> {};
class HasSimpleElementsField : public BitField<bool, 3, 1> {};
bool fast_elements() const { return FastElementsField::decode(bit_field_); }
void set_fast_elements(bool fast) {

View File

@ -129,8 +129,8 @@ class V8_EXPORT_PRIVATE HandlerTable {
static const int kReturnEntrySize = 2;
// Encoding of the {handler} field.
using HandlerPredictionField = BitField<CatchPrediction, 0, 3>;
using HandlerOffsetField = BitField<int, 3, 29>;
class HandlerPredictionField : public BitField<CatchPrediction, 0, 3> {};
class HandlerOffsetField : public BitField<int, 3, 29> {};
};
} // namespace internal

View File

@ -342,8 +342,8 @@ class Displacement {
private:
int data_;
using TypeField = BitField<Type, 0, 2>;
using NextField = BitField<int, 2, 32 - 2>;
class TypeField : public BitField<Type, 0, 2> {};
class NextField : public BitField<int, 2, 32 - 2> {};
void init(Label* L, Type type);
};

View File

@ -27,8 +27,8 @@ namespace internal {
namespace {
// Each byte is encoded as MoreBit | ValueBits.
using MoreBit = BitField8<bool, 7, 1>;
using ValueBits = BitField8<unsigned, 0, 7>;
class MoreBit : public BitField8<bool, 7, 1> {};
class ValueBits : public BitField8<unsigned, 0, 7> {};
// Helper: Add the offsets from 'other' to 'value'. Also set is_statement.
void AddAndSetEntry(PositionTableEntry& value, // NOLINT(runtime/references)

View File

@ -92,18 +92,16 @@ bool PerThreadAssertScope<kType, kAllow>::IsAllowed() {
return current_data == nullptr || current_data->Get(kType);
}
namespace {
template <PerIsolateAssertType kType>
using DataBit = BitField<bool, kType, 1>;
}
template <PerIsolateAssertType kType, bool kAllow>
class PerIsolateAssertScope<kType, kAllow>::DataBit
: public BitField<bool, kType, 1> {};
template <PerIsolateAssertType kType, bool kAllow>
PerIsolateAssertScope<kType, kAllow>::PerIsolateAssertScope(Isolate* isolate)
: isolate_(isolate), old_data_(isolate->per_isolate_assert_data()) {
DCHECK_NOT_NULL(isolate);
STATIC_ASSERT(kType < 32);
isolate_->set_per_isolate_assert_data(
DataBit<kType>::update(old_data_, kAllow));
isolate_->set_per_isolate_assert_data(DataBit::update(old_data_, kAllow));
}
template <PerIsolateAssertType kType, bool kAllow>
@ -114,7 +112,7 @@ PerIsolateAssertScope<kType, kAllow>::~PerIsolateAssertScope() {
// static
template <PerIsolateAssertType kType, bool kAllow>
bool PerIsolateAssertScope<kType, kAllow>::IsAllowed(Isolate* isolate) {
return DataBit<kType>::decode(isolate->per_isolate_assert_data());
return DataBit::decode(isolate->per_isolate_assert_data());
}
// -----------------------------------------------------------------------------

View File

@ -81,6 +81,8 @@ class PerIsolateAssertScope {
static bool IsAllowed(Isolate* isolate);
private:
class DataBit;
Isolate* isolate_;
uint32_t old_data_;

View File

@ -130,7 +130,7 @@ class V8_EXPORT_PRIVATE InstructionOperand {
inline uint64_t GetCanonicalizedValue() const;
using KindField = BitField64<Kind, 0, 3>;
class KindField : public BitField64<Kind, 0, 3> {};
uint64_t value_;
};
@ -331,20 +331,20 @@ class UnallocatedOperand final : public InstructionOperand {
STATIC_ASSERT(KindField::kSize == 3);
using VirtualRegisterField = BitField64<uint32_t, 3, 32>;
class VirtualRegisterField : public BitField64<uint32_t, 3, 32> {};
// BitFields for all unallocated operands.
using BasicPolicyField = BitField64<BasicPolicy, 35, 1>;
class BasicPolicyField : public BitField64<BasicPolicy, 35, 1> {};
// BitFields specific to BasicPolicy::FIXED_SLOT.
using FixedSlotIndexField = BitField64<int, 36, 28>;
class FixedSlotIndexField : public BitField64<int, 36, 28> {};
// BitFields specific to BasicPolicy::EXTENDED_POLICY.
using ExtendedPolicyField = BitField64<ExtendedPolicy, 36, 3>;
using LifetimeField = BitField64<Lifetime, 39, 1>;
using HasSecondaryStorageField = BitField64<bool, 40, 1>;
using FixedRegisterField = BitField64<int, 41, 6>;
using SecondaryStorageField = BitField64<int, 47, 3>;
class ExtendedPolicyField : public BitField64<ExtendedPolicy, 36, 3> {};
class LifetimeField : public BitField64<Lifetime, 39, 1> {};
class HasSecondaryStorageField : public BitField64<bool, 40, 1> {};
class FixedRegisterField : public BitField64<int, 41, 6> {};
class SecondaryStorageField : public BitField64<int, 47, 3> {};
private:
explicit UnallocatedOperand(int virtual_register)
@ -373,7 +373,7 @@ class ConstantOperand : public InstructionOperand {
INSTRUCTION_OPERAND_CASTS(ConstantOperand, CONSTANT)
STATIC_ASSERT(KindField::kSize == 3);
using VirtualRegisterField = BitField64<uint32_t, 3, 32>;
class VirtualRegisterField : public BitField64<uint32_t, 3, 32> {};
};
class ImmediateOperand : public InstructionOperand {
@ -406,8 +406,8 @@ class ImmediateOperand : public InstructionOperand {
INSTRUCTION_OPERAND_CASTS(ImmediateOperand, IMMEDIATE)
STATIC_ASSERT(KindField::kSize == 3);
using TypeField = BitField64<ImmediateType, 3, 1>;
using ValueField = BitField64<int32_t, 32, 32>;
class TypeField : public BitField64<ImmediateType, 3, 1> {};
class ValueField : public BitField64<int32_t, 32, 32> {};
};
class LocationOperand : public InstructionOperand {
@ -509,9 +509,9 @@ class LocationOperand : public InstructionOperand {
}
STATIC_ASSERT(KindField::kSize == 3);
using LocationKindField = BitField64<LocationKind, 3, 2>;
using RepresentationField = BitField64<MachineRepresentation, 5, 8>;
using IndexField = BitField64<int32_t, 35, 29>;
class LocationKindField : public BitField64<LocationKind, 3, 2> {};
class RepresentationField : public BitField64<MachineRepresentation, 5, 8> {};
class IndexField : public BitField64<int32_t, 35, 29> {};
};
class V8_EXPORT_PRIVATE ExplicitOperand

View File

@ -144,8 +144,8 @@ class LinkageLocation {
private:
enum LocationType { REGISTER, STACK_SLOT };
using TypeField = BitField<LocationType, 0, 1>;
using LocationField = BitField<int32_t, TypeField::kNext, 31>;
class TypeField : public BitField<LocationType, 0, 1> {};
class LocationField : public BitField<int32_t, TypeField::kNext, 31> {};
static constexpr int32_t ANY_REGISTER = -1;
static constexpr int32_t MAX_STACK_SLOT = 32767;

View File

@ -580,9 +580,10 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
// This stores three flags (independent, partially_dependent and
// in_young_list) and a State.
using NodeState = BitField8<State, 0, 3>;
using IsInYoungList = BitField8<bool, NodeState::kNext, 1>;
using NodeWeaknessType = BitField8<WeaknessType, IsInYoungList::kNext, 2>;
class NodeState : public BitField8<State, 0, 3> {};
class IsInYoungList : public BitField8<bool, NodeState::kNext, 1> {};
class NodeWeaknessType
: public BitField8<WeaknessType, IsInYoungList::kNext, 2> {};
// Handle specific callback - might be a weak reference in disguise.
WeakCallbackInfo<void>::Callback weak_callback_;
@ -649,9 +650,9 @@ class GlobalHandles::TracedNode final
}
protected:
using NodeState = BitField8<State, 0, 2>;
using IsInYoungList = BitField8<bool, NodeState::kNext, 1>;
using IsRoot = BitField8<bool, IsInYoungList::kNext, 1>;
class NodeState : public BitField8<State, 0, 2> {};
class IsInYoungList : public BitField8<bool, NodeState::kNext, 1> {};
class IsRoot : public BitField8<bool, IsInYoungList::kNext, 1> {};
void ClearImplFields() {
set_root(true);

View File

@ -411,8 +411,8 @@ class V8_EXPORT_PRIVATE TypedSlots {
void Merge(TypedSlots* other);
protected:
using OffsetField = BitField<int, 0, 29>;
using TypeField = BitField<SlotType, 29, 3>;
class OffsetField : public BitField<int, 0, 29> {};
class TypeField : public BitField<SlotType, 29, 3> {};
struct TypedSlot {
uint32_t type_and_offset;
};

View File

@ -47,60 +47,65 @@ class LoadHandler final : public DataHandler {
kNonExistent,
kModuleExport
};
using KindBits = BitField<Kind, 0, 4>;
class KindBits : public BitField<Kind, 0, 4> {};
// Defines whether access rights check should be done on receiver object.
// Applicable to named property kinds only when loading value from prototype
// chain. Ignored when loading from holder.
using DoAccessCheckOnReceiverBits = BitField<bool, KindBits::kNext, 1>;
class DoAccessCheckOnReceiverBits
: public BitField<bool, KindBits::kNext, 1> {};
// Defines whether a lookup should be done on receiver object before
// proceeding to the prototype chain. Applicable to named property kinds only
// when loading value from prototype chain. Ignored when loading from holder.
using LookupOnReceiverBits =
BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1>;
class LookupOnReceiverBits
: public BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1> {};
//
// Encoding when KindBits contains kForConstants.
//
// Index of a value entry in the descriptor array.
using DescriptorBits =
BitField<unsigned, LookupOnReceiverBits::kNext, kDescriptorIndexBitCount>;
class DescriptorBits : public BitField<unsigned, LookupOnReceiverBits::kNext,
kDescriptorIndexBitCount> {};
// Make sure we don't overflow the smi.
STATIC_ASSERT(DescriptorBits::kNext <= kSmiValueSize);
//
// Encoding when KindBits contains kField.
//
using IsInobjectBits = BitField<bool, LookupOnReceiverBits::kNext, 1>;
using IsDoubleBits = BitField<bool, IsInobjectBits::kNext, 1>;
class IsInobjectBits : public BitField<bool, LookupOnReceiverBits::kNext, 1> {
};
class IsDoubleBits : public BitField<bool, IsInobjectBits::kNext, 1> {};
// +1 here is to cover all possible JSObject header sizes.
using FieldIndexBits =
BitField<unsigned, IsDoubleBits::kNext, kDescriptorIndexBitCount + 1>;
class FieldIndexBits : public BitField<unsigned, IsDoubleBits::kNext,
kDescriptorIndexBitCount + 1> {};
// Make sure we don't overflow the smi.
STATIC_ASSERT(FieldIndexBits::kNext <= kSmiValueSize);
//
// Encoding when KindBits contains kElement or kIndexedString.
//
using AllowOutOfBoundsBits = BitField<bool, LookupOnReceiverBits::kNext, 1>;
class AllowOutOfBoundsBits
: public BitField<bool, LookupOnReceiverBits::kNext, 1> {};
//
// Encoding when KindBits contains kElement.
//
using IsJsArrayBits = BitField<bool, AllowOutOfBoundsBits::kNext, 1>;
using ConvertHoleBits = BitField<bool, IsJsArrayBits::kNext, 1>;
using ElementsKindBits = BitField<ElementsKind, ConvertHoleBits::kNext, 8>;
class IsJsArrayBits : public BitField<bool, AllowOutOfBoundsBits::kNext, 1> {
};
class ConvertHoleBits : public BitField<bool, IsJsArrayBits::kNext, 1> {};
class ElementsKindBits
: public BitField<ElementsKind, ConvertHoleBits::kNext, 8> {};
// Make sure we don't overflow the smi.
STATIC_ASSERT(ElementsKindBits::kNext <= kSmiValueSize);
//
// Encoding when KindBits contains kModuleExport.
//
using ExportsIndexBits =
BitField<unsigned, LookupOnReceiverBits::kNext,
kSmiValueSize - LookupOnReceiverBits::kNext>;
class ExportsIndexBits
: public BitField<unsigned, LookupOnReceiverBits::kNext,
kSmiValueSize - LookupOnReceiverBits::kNext> {};
// Decodes kind from Smi-handler.
static inline Kind GetHandlerKind(Smi smi_handler);
@ -201,27 +206,28 @@ class StoreHandler final : public DataHandler {
kProxy,
kKindsNumber // Keep last
};
using KindBits = BitField<Kind, 0, 4>;
class KindBits : public BitField<Kind, 0, 4> {};
enum FieldRepresentation { kSmi, kDouble, kHeapObject, kTagged };
// Applicable to kGlobalProxy, kProxy kinds.
// Defines whether access rights check should be done on receiver object.
using DoAccessCheckOnReceiverBits = BitField<bool, KindBits::kNext, 1>;
class DoAccessCheckOnReceiverBits
: public BitField<bool, KindBits::kNext, 1> {};
// Defines whether a lookup should be done on receiver object before
// proceeding to the prototype chain. Applicable to named property kinds only
// when storing through prototype chain. Ignored when storing to holder.
using LookupOnReceiverBits =
BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1>;
class LookupOnReceiverBits
: public BitField<bool, DoAccessCheckOnReceiverBits::kNext, 1> {};
// Applicable to kField, kTransitionToField and kTransitionToConstant
// kinds.
// Index of a value entry in the descriptor array.
using DescriptorBits =
BitField<unsigned, LookupOnReceiverBits::kNext, kDescriptorIndexBitCount>;
class DescriptorBits : public BitField<unsigned, LookupOnReceiverBits::kNext,
kDescriptorIndexBitCount> {};
//
// Encoding when KindBits contains kTransitionToConstant.
//
@ -232,12 +238,13 @@ class StoreHandler final : public DataHandler {
//
// Encoding when KindBits contains kField or kTransitionToField.
//
using IsInobjectBits = BitField<bool, DescriptorBits::kNext, 1>;
using FieldRepresentationBits =
BitField<FieldRepresentation, IsInobjectBits::kNext, 2>;
class IsInobjectBits : public BitField<bool, DescriptorBits::kNext, 1> {};
class FieldRepresentationBits
: public BitField<FieldRepresentation, IsInobjectBits::kNext, 2> {};
// +1 here is to cover all possible JSObject header sizes.
using FieldIndexBits = BitField<unsigned, FieldRepresentationBits::kNext,
kDescriptorIndexBitCount + 1>;
class FieldIndexBits
: public BitField<unsigned, FieldRepresentationBits::kNext,
kDescriptorIndexBitCount + 1> {};
// Make sure we don't overflow the smi.
STATIC_ASSERT(FieldIndexBits::kNext <= kSmiValueSize);

View File

@ -18,8 +18,8 @@ namespace interpreter {
class CreateArrayLiteralFlags {
public:
using FlagsBits = BitField8<int, 0, 5>;
using FastCloneSupportedBit = BitField8<bool, FlagsBits::kNext, 1>;
class FlagsBits : public BitField8<int, 0, 5> {};
class FastCloneSupportedBit : public BitField8<bool, FlagsBits::kNext, 1> {};
static uint8_t Encode(bool use_fast_shallow_clone, int runtime_flags);
@ -29,8 +29,8 @@ class CreateArrayLiteralFlags {
class CreateObjectLiteralFlags {
public:
using FlagsBits = BitField8<int, 0, 5>;
using FastCloneSupportedBit = BitField8<bool, FlagsBits::kNext, 1>;
class FlagsBits : public BitField8<int, 0, 5> {};
class FastCloneSupportedBit : public BitField8<bool, FlagsBits::kNext, 1> {};
static uint8_t Encode(int runtime_flags, bool fast_clone_supported);
@ -40,8 +40,8 @@ class CreateObjectLiteralFlags {
class CreateClosureFlags {
public:
using PretenuredBit = BitField8<bool, 0, 1>;
using FastNewClosureBit = BitField8<bool, PretenuredBit::kNext, 1>;
class PretenuredBit : public BitField8<bool, 0, 1> {};
class FastNewClosureBit : public BitField8<bool, PretenuredBit::kNext, 1> {};
static uint8_t Encode(bool pretenure, bool is_function_scope,
bool might_always_opt);
@ -80,8 +80,9 @@ class TestTypeOfFlags {
class StoreLookupSlotFlags {
public:
using LanguageModeBit = BitField8<LanguageMode, 0, 1>;
using LookupHoistingModeBit = BitField8<bool, LanguageModeBit::kNext, 1>;
class LanguageModeBit : public BitField8<LanguageMode, 0, 1> {};
class LookupHoistingModeBit
: public BitField8<bool, LanguageModeBit::kNext, 1> {};
STATIC_ASSERT(LanguageModeSize <= LanguageModeBit::kNumValues);
static uint8_t Encode(LanguageMode language_mode,

View File

@ -66,14 +66,14 @@ class AllocationSite : public Struct {
bool IsNested();
// transition_info bitfields, for constructed array transition info.
using ElementsKindBits = BitField<ElementsKind, 0, 5>;
using DoNotInlineBit = BitField<bool, 5, 1>;
class ElementsKindBits : public BitField<ElementsKind, 0, 5> {};
class DoNotInlineBit : public BitField<bool, 5, 1> {};
// Unused bits 6-30.
// Bitfields for pretenure_data
using MementoFoundCountBits = BitField<int, 0, 26>;
using PretenureDecisionBits = BitField<PretenureDecision, 26, 3>;
using DeoptDependentCodeBit = BitField<bool, 29, 1>;
class MementoFoundCountBits : public BitField<int, 0, 26> {};
class PretenureDecisionBits : public BitField<PretenureDecision, 26, 3> {};
class DeoptDependentCodeBit : public BitField<bool, 29, 1> {};
STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue);
// Increments the mementos found counter and returns true when the first

View File

@ -57,8 +57,8 @@ class BigIntBase : public HeapObject {
// able to read the length concurrently, the getters and setters are atomic.
static const int kLengthFieldBits = 30;
STATIC_ASSERT(kMaxLength <= ((1 << kLengthFieldBits) - 1));
using SignBits = BitField<bool, 0, 1>;
using LengthBits = BitField<int, SignBits::kNext, kLengthFieldBits>;
class SignBits : public BitField<bool, 0, 1> {};
class LengthBits : public BitField<int, SignBits::kNext, kLengthFieldBits> {};
STATIC_ASSERT(LengthBits::kNext <= 32);
// Layout description.

View File

@ -706,8 +706,8 @@ class DependentCode : public WeakFixedArray {
inline int flags();
inline void set_flags(int flags);
using GroupField = BitField<int, 0, 3>;
using CountField = BitField<int, 3, 27>;
class GroupField : public BitField<int, 0, 3> {};
class CountField : public BitField<int, 3, 27> {};
STATIC_ASSERT(kGroupCount <= GroupField::kMax + 1);
OBJECT_CONSTRUCTORS(DependentCode, WeakFixedArray);

View File

@ -107,16 +107,17 @@ class FieldIndex final {
(kDescriptorIndexBitCount + 1 + kTaggedSizeLog2);
// Index from beginning of object.
using OffsetBits = BitField64<int, 0, kOffsetBitsSize>;
using IsInObjectBits = BitField64<bool, OffsetBits::kNext, 1>;
using EncodingBits = BitField64<Encoding, IsInObjectBits::kNext, 2>;
class OffsetBits : public BitField64<int, 0, kOffsetBitsSize> {};
class IsInObjectBits : public BitField64<bool, OffsetBits::kNext, 1> {};
class EncodingBits : public BitField64<Encoding, IsInObjectBits::kNext, 2> {};
// Number of inobject properties.
using InObjectPropertyBits =
BitField64<int, EncodingBits::kNext, kDescriptorIndexBitCount>;
class InObjectPropertyBits
: public BitField64<int, EncodingBits::kNext, kDescriptorIndexBitCount> {
};
// Offset of first inobject property from beginning of object.
using FirstInobjectPropertyOffsetBits =
BitField64<int, InObjectPropertyBits::kNext,
kFirstInobjectPropertyOffsetBitCount>;
class FirstInobjectPropertyOffsetBits
: public BitField64<int, InObjectPropertyBits::kNext,
kFirstInobjectPropertyOffsetBitCount> {};
STATIC_ASSERT(FirstInobjectPropertyOffsetBits::kNext <= 64);
uint64_t bit_field_;

View File

@ -79,7 +79,7 @@ class JSPromise : public JSObject {
static const int kStatusBits = 2;
static const int kHasHandlerBit = 2;
static const int kHandledHintBit = 3;
using AsyncTaskIdField = BitField<int, kHandledHintBit + 1, 22>;
class AsyncTaskIdField : public BitField<int, kHandledHintBit + 1, 22> {};
static const int kStatusShift = 0;
static const int kStatusMask = 0x3;

View File

@ -67,7 +67,7 @@ class JSFinalizationGroup : public JSObject {
TORQUE_GENERATED_JSFINALIZATION_GROUP_FIELDS)
// Bitfields in flags.
using ScheduledForCleanupField = BitField<bool, 0, 1>;
class ScheduledForCleanupField : public BitField<bool, 0, 1> {};
OBJECT_CONSTRUCTORS(JSFinalizationGroup, JSObject);
};

View File

@ -99,11 +99,12 @@ class Name : public TorqueGeneratedName<Name, HeapObject> {
STATIC_ASSERT(kArrayIndexLengthBits > 0);
STATIC_ASSERT(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
using ArrayIndexValueBits =
BitField<unsigned int, kNofHashBitFields, kArrayIndexValueBits>;
using ArrayIndexLengthBits =
BitField<unsigned int, kNofHashBitFields + kArrayIndexValueBits,
kArrayIndexLengthBits>;
class ArrayIndexValueBits
: public BitField<unsigned int, kNofHashBitFields, kArrayIndexValueBits> {
}; // NOLINT
class ArrayIndexLengthBits
: public BitField<unsigned int, kNofHashBitFields + kArrayIndexValueBits,
kArrayIndexLengthBits> {}; // NOLINT
// Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
// could use a mask to test if the length of string is less than or equal to

View File

@ -61,10 +61,10 @@ class PropertyArray : public HeapObject {
using BodyDescriptor = FlexibleBodyDescriptor<kHeaderSize>;
static const int kLengthFieldSize = 10;
using LengthField = BitField<int, 0, kLengthFieldSize>;
class LengthField : public BitField<int, 0, kLengthFieldSize> {};
static const int kMaxLength = LengthField::kMax;
using HashField =
BitField<int, kLengthFieldSize, kSmiValueSize - kLengthFieldSize - 1>;
class HashField : public BitField<int, kLengthFieldSize,
kSmiValueSize - kLengthFieldSize - 1> {};
static const int kNoHashSentinel = 0;

View File

@ -310,11 +310,13 @@ class PropertyDetails {
// Bit fields in value_ (type, shift, size). Must be public so the
// constants can be embedded in generated code.
using KindField = BitField<PropertyKind, 0, 1>;
using LocationField = BitField<PropertyLocation, KindField::kNext, 1>;
using ConstnessField = BitField<PropertyConstness, LocationField::kNext, 1>;
using AttributesField =
BitField<PropertyAttributes, ConstnessField::kNext, 3>;
class KindField : public BitField<PropertyKind, 0, 1> {};
class LocationField : public BitField<PropertyLocation, KindField::kNext, 1> {
};
class ConstnessField
: public BitField<PropertyConstness, LocationField::kNext, 1> {};
class AttributesField
: public BitField<PropertyAttributes, ConstnessField::kNext, 3> {};
static const int kAttributesReadOnlyMask =
(READ_ONLY << AttributesField::kShift);
static const int kAttributesDontDeleteMask =
@ -323,17 +325,20 @@ class PropertyDetails {
(DONT_ENUM << AttributesField::kShift);
// Bit fields for normalized objects.
using PropertyCellTypeField =
BitField<PropertyCellType, AttributesField::kNext, 2>;
using DictionaryStorageField =
BitField<uint32_t, PropertyCellTypeField::kNext, 23>;
class PropertyCellTypeField
: public BitField<PropertyCellType, AttributesField::kNext, 2> {};
class DictionaryStorageField
: public BitField<uint32_t, PropertyCellTypeField::kNext, 23> {};
// Bit fields for fast objects.
using RepresentationField = BitField<uint32_t, AttributesField::kNext, 3>;
using DescriptorPointer =
BitField<uint32_t, RepresentationField::kNext, kDescriptorIndexBitCount>;
using FieldIndexField =
BitField<uint32_t, DescriptorPointer::kNext, kDescriptorIndexBitCount>;
class RepresentationField
: public BitField<uint32_t, AttributesField::kNext, 3> {};
class DescriptorPointer
: public BitField<uint32_t, RepresentationField::kNext,
kDescriptorIndexBitCount> {}; // NOLINT
class FieldIndexField : public BitField<uint32_t, DescriptorPointer::kNext,
kDescriptorIndexBitCount> {
}; // NOLINT
// All bits for both fast and slow objects must fit in a smi.
STATIC_ASSERT(DictionaryStorageField::kNext <= 31);

View File

@ -224,32 +224,39 @@ class ScopeInfo : public FixedArray {
enum VariableAllocationInfo { NONE, STACK, CONTEXT, UNUSED };
// Properties of scopes.
using ScopeTypeField = BitField<ScopeType, 0, 4>;
using CallsSloppyEvalField = BitField<bool, ScopeTypeField::kNext, 1>;
class ScopeTypeField : public BitField<ScopeType, 0, 4> {};
class CallsSloppyEvalField : public BitField<bool, ScopeTypeField::kNext, 1> {
};
STATIC_ASSERT(LanguageModeSize == 2);
using LanguageModeField =
BitField<LanguageMode, CallsSloppyEvalField::kNext, 1>;
using DeclarationScopeField = BitField<bool, LanguageModeField::kNext, 1>;
using ReceiverVariableField =
BitField<VariableAllocationInfo, DeclarationScopeField::kNext, 2>;
using HasClassBrandField = BitField<bool, ReceiverVariableField::kNext, 1>;
using HasNewTargetField = BitField<bool, HasClassBrandField::kNext, 1>;
using FunctionVariableField =
BitField<VariableAllocationInfo, HasNewTargetField::kNext, 2>;
class LanguageModeField
: public BitField<LanguageMode, CallsSloppyEvalField::kNext, 1> {};
class DeclarationScopeField
: public BitField<bool, LanguageModeField::kNext, 1> {};
class ReceiverVariableField
: public BitField<VariableAllocationInfo, DeclarationScopeField::kNext,
2> {};
class HasClassBrandField
: public BitField<bool, ReceiverVariableField::kNext, 1> {};
class HasNewTargetField
: public BitField<bool, HasClassBrandField::kNext, 1> {};
class FunctionVariableField
: public BitField<VariableAllocationInfo, HasNewTargetField::kNext, 2> {};
// TODO(cbruni): Combine with function variable field when only storing the
// function name.
using HasInferredFunctionNameField =
BitField<bool, FunctionVariableField::kNext, 1>;
using IsAsmModuleField =
BitField<bool, HasInferredFunctionNameField::kNext, 1>;
using HasSimpleParametersField = BitField<bool, IsAsmModuleField::kNext, 1>;
using FunctionKindField =
BitField<FunctionKind, HasSimpleParametersField::kNext, 5>;
using HasOuterScopeInfoField = BitField<bool, FunctionKindField::kNext, 1>;
using IsDebugEvaluateScopeField =
BitField<bool, HasOuterScopeInfoField::kNext, 1>;
using ForceContextAllocationField =
BitField<bool, IsDebugEvaluateScopeField::kNext, 1>;
class HasInferredFunctionNameField
: public BitField<bool, FunctionVariableField::kNext, 1> {};
class IsAsmModuleField
: public BitField<bool, HasInferredFunctionNameField::kNext, 1> {};
class HasSimpleParametersField
: public BitField<bool, IsAsmModuleField::kNext, 1> {};
class FunctionKindField
: public BitField<FunctionKind, HasSimpleParametersField::kNext, 5> {};
class HasOuterScopeInfoField
: public BitField<bool, FunctionKindField::kNext, 1> {};
class IsDebugEvaluateScopeField
: public BitField<bool, HasOuterScopeInfoField::kNext, 1> {};
class ForceContextAllocationField
: public BitField<bool, IsDebugEvaluateScopeField::kNext, 1> {};
STATIC_ASSERT(kLastFunctionKind <= FunctionKindField::kMax);
@ -316,13 +323,14 @@ class ScopeInfo : public FixedArray {
static const int kPositionInfoEntries = 2;
// Properties of variables.
using VariableModeField = BitField<VariableMode, 0, 3>;
using InitFlagField = BitField<InitializationFlag, 3, 1>;
using MaybeAssignedFlagField = BitField<MaybeAssignedFlag, 4, 1>;
using RequiresBrandCheckField =
BitField<RequiresBrandCheckFlag, MaybeAssignedFlagField::kNext, 1>;
using ParameterNumberField =
BitField<uint32_t, RequiresBrandCheckField::kNext, 16>;
class VariableModeField : public BitField<VariableMode, 0, 3> {};
class InitFlagField : public BitField<InitializationFlag, 3, 1> {};
class MaybeAssignedFlagField : public BitField<MaybeAssignedFlag, 4, 1> {};
class RequiresBrandCheckField
: public BitField<RequiresBrandCheckFlag, MaybeAssignedFlagField::kNext,
1> {};
class ParameterNumberField
: public BitField<uint32_t, RequiresBrandCheckField::kNext, 16> {};
friend class ScopeIterator;
friend std::ostream& operator<<(std::ostream& os,

View File

@ -227,8 +227,9 @@ class ObjectTemplateInfo : public TemplateInfo {
inline ObjectTemplateInfo GetParent(Isolate* isolate);
private:
using IsImmutablePrototype = BitField<bool, 0, 1>;
using EmbedderFieldCount = BitField<int, IsImmutablePrototype::kNext, 29>;
class IsImmutablePrototype : public BitField<bool, 0, 1> {};
class EmbedderFieldCount
: public BitField<int, IsImmutablePrototype::kNext, 29> {};
OBJECT_CONSTRUCTORS(ObjectTemplateInfo, TemplateInfo);
};

View File

@ -21,21 +21,22 @@ namespace internal {
namespace {
using ScopeCallsSloppyEvalField = BitField8<bool, 0, 1>;
using InnerScopeCallsEvalField =
BitField8<bool, ScopeCallsSloppyEvalField::kNext, 1>;
class ScopeCallsSloppyEvalField : public BitField8<bool, 0, 1> {};
class InnerScopeCallsEvalField
: public BitField8<bool, ScopeCallsSloppyEvalField::kNext, 1> {};
using VariableMaybeAssignedField = BitField8<bool, 0, 1>;
using VariableContextAllocatedField =
BitField8<bool, VariableMaybeAssignedField::kNext, 1>;
class VariableMaybeAssignedField : public BitField8<bool, 0, 1> {};
class VariableContextAllocatedField
: public BitField8<bool, VariableMaybeAssignedField::kNext, 1> {};
using HasDataField = BitField<bool, 0, 1>;
using LengthEqualsParametersField = BitField<bool, HasDataField::kNext, 1>;
using NumberOfParametersField =
BitField<uint16_t, LengthEqualsParametersField::kNext, 16>;
class HasDataField : public BitField<bool, 0, 1> {};
class LengthEqualsParametersField
: public BitField<bool, HasDataField::kNext, 1> {};
class NumberOfParametersField
: public BitField<uint16_t, LengthEqualsParametersField::kNext, 16> {};
using LanguageField = BitField8<LanguageMode, 0, 1>;
using UsesSuperField = BitField8<bool, LanguageField::kNext, 1>;
class LanguageField : public BitField8<LanguageMode, 0, 1> {};
class UsesSuperField : public BitField8<bool, LanguageField::kNext, 1> {};
STATIC_ASSERT(LanguageModeSize <= LanguageField::kNumValues);
} // namespace

View File

@ -215,8 +215,8 @@ class V8_EXPORT_PRIVATE Token {
return name_[token];
}
using IsKeywordBits = BitField8<bool, 0, 1>;
using IsPropertyNameBits = BitField8<bool, IsKeywordBits::kNext, 1>;
class IsKeywordBits : public BitField8<bool, 0, 1> {};
class IsPropertyNameBits : public BitField8<bool, IsKeywordBits::kNext, 1> {};
// Predicates
static bool IsKeyword(Value token) {

View File

@ -82,8 +82,8 @@ class HeapGraphEdge {
V8_INLINE HeapSnapshot* snapshot() const;
int from_index() const { return FromIndexField::decode(bit_field_); }
using TypeField = BitField<Type, 0, 3>;
using FromIndexField = BitField<int, 3, 29>;
class TypeField : public BitField<Type, 0, 3> {};
class FromIndexField : public BitField<int, 3, 29> {};
uint32_t bit_field_;
HeapEntry* to_entry_;
union {

View File

@ -769,11 +769,11 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, Runtime::FunctionId);
//---------------------------------------------------------------------------
// Constants used by interface to runtime functions.
using AllocateDoubleAlignFlag = BitField<bool, 0, 1>;
class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {};
using AllowLargeObjectAllocationFlag = BitField<bool, 1, 1>;
class AllowLargeObjectAllocationFlag : public BitField<bool, 1, 1> {};
using DeclareGlobalsEvalFlag = BitField<bool, 0, 1>;
class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {};
// A set of bits returned by Runtime_GetOptimizationStatus.
// These bits must be in sync with bits defined in test/mjsunit/mjsunit.js

View File

@ -154,11 +154,12 @@ class SerializerReference {
}
private:
using SpaceBits = BitField<SnapshotSpace, 0, kSpaceTagSize>;
using ChunkIndexBits =
BitField<uint32_t, SpaceBits::kNext, 32 - kSpaceTagSize>;
using SpecialValueTypeBits =
BitField<SpecialValueType, SpaceBits::kNext, 32 - kSpaceTagSize>;
class SpaceBits : public BitField<SnapshotSpace, 0, kSpaceTagSize> {};
class ChunkIndexBits
: public BitField<uint32_t, SpaceBits::kNext, 32 - kSpaceTagSize> {};
class SpecialValueTypeBits
: public BitField<SpecialValueType, SpaceBits::kNext,
32 - kSpaceTagSize> {};
// We use two fields to store a reference.
// In case of a normal back reference, the bitfield_ stores the space and

View File

@ -34,8 +34,8 @@ class ExternalReferenceEncoder {
uint32_t index() const { return Index::decode(value_); }
private:
using Index = BitField<uint32_t, 0, 31>;
using IsFromAPI = BitField<bool, 31, 1>;
class Index : public BitField<uint32_t, 0, 31> {};
class IsFromAPI : public BitField<bool, 31, 1> {};
uint32_t value_;
};
@ -328,8 +328,8 @@ class SerializedData {
uint32_t GetMagicNumber() const { return GetHeaderValue(kMagicNumberOffset); }
using ChunkSizeBits = BitField<uint32_t, 0, 31>;
using IsLastChunkBits = BitField<bool, 31, 1>;
class ChunkSizeBits : public BitField<uint32_t, 0, 31> {};
class IsLastChunkBits : public BitField<bool, 31, 1> {};
static constexpr uint32_t kMagicNumberOffset = 0;
static constexpr uint32_t kMagicNumber =

View File

@ -302,12 +302,9 @@ T SaturateSub(T a, T b) {
// ----------------------------------------------------------------------------
// BitField is a help template for encoding and decode bitfield with
// unsigned content.
// Instantiate them via 'using', which is cheaper than deriving a new class:
// using MyBitField = BitField<int, 4, 2, MyEnum>;
// The BitField class is final to enforce this style over derivation.
template <class T, int shift, int size, class U = uint32_t>
class BitField final {
class BitField {
public:
STATIC_ASSERT(std::is_unsigned<U>::value);
STATIC_ASSERT(shift < 8 * sizeof(U)); // Otherwise shifts by {shift} are UB.

View File

@ -524,9 +524,9 @@ class CompilationStateImpl {
//////////////////////////////////////////////////////////////////////////////
// Encoding of fields in the {compilation_progress_} vector.
using RequiredBaselineTierField = BitField8<ExecutionTier, 0, 2>;
using RequiredTopTierField = BitField8<ExecutionTier, 2, 2>;
using ReachedTierField = BitField8<ExecutionTier, 4, 2>;
class RequiredBaselineTierField : public BitField8<ExecutionTier, 0, 2> {};
class RequiredTopTierField : public BitField8<ExecutionTier, 2, 2> {};
class ReachedTierField : public BitField8<ExecutionTier, 4, 2> {};
};
CompilationStateImpl* Impl(CompilationState* compilation_state) {

View File

@ -311,7 +311,7 @@ TEST(DecodeWordFromWord32) {
CodeAssemblerTester asm_tester(isolate);
CodeStubAssembler m(asm_tester.state());
using TestBitField = BitField<unsigned, 3, 3>;
class TestBitField : public BitField<unsigned, 3, 3> {};
m.Return(m.SmiTag(
m.Signed(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2F)))));
FunctionTester ft(asm_tester.GenerateCode());

View File

@ -312,10 +312,11 @@ TEST(ExponentNumberStr) {
CHECK_EQ(1e-106, StringToDouble(".000001e-100", NO_FLAGS));
}
using OneBit1 = BitField<uint32_t, 0, 1>;
using OneBit2 = BitField<uint32_t, 7, 1>;
using EightBit1 = BitField<uint32_t, 0, 8>;
using EightBit2 = BitField<uint32_t, 13, 8>;
class OneBit1: public BitField<uint32_t, 0, 1> {};
class OneBit2: public BitField<uint32_t, 7, 1> {};
class EightBit1: public BitField<uint32_t, 0, 8> {};
class EightBit2: public BitField<uint32_t, 13, 8> {};
TEST(BitField) {
uint32_t x;
@ -350,8 +351,9 @@ TEST(BitField) {
CHECK(!EightBit2::is_valid(256));
}
using UpperBits = BitField64<int, 61, 3>;
using MiddleBits = BitField64<int, 31, 2>;
class UpperBits: public BitField64<int, 61, 3> {};
class MiddleBits: public BitField64<int, 31, 2> {};
TEST(BitField64) {
uint64_t x;