Commit d3ba602f authored by Patrick Thier's avatar Patrick Thier Committed by V8 LUCI CQ

[regexp][interpreter] Extend RegExp-Flags to 2 Bytes

In preparation for the new `v`-flag, extend RegExp flags from 1-byte to
2-byte.

Bug: v8:11935
Change-Id: I2dacb5e8dba889947054aa5c155708b8d315b898
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3857561Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82863}
parent 46d54b02
...@@ -402,8 +402,11 @@ int32_t BaselineCompiler::Int(int operand_index) { ...@@ -402,8 +402,11 @@ int32_t BaselineCompiler::Int(int operand_index) {
uint32_t BaselineCompiler::Index(int operand_index) { uint32_t BaselineCompiler::Index(int operand_index) {
return iterator().GetIndexOperand(operand_index); return iterator().GetIndexOperand(operand_index);
} }
uint32_t BaselineCompiler::Flag(int operand_index) { uint32_t BaselineCompiler::Flag8(int operand_index) {
return iterator().GetFlagOperand(operand_index); return iterator().GetFlag8Operand(operand_index);
}
uint32_t BaselineCompiler::Flag16(int operand_index) {
return iterator().GetFlag16Operand(operand_index);
} }
uint32_t BaselineCompiler::RegisterCount(int operand_index) { uint32_t BaselineCompiler::RegisterCount(int operand_index) {
return iterator().GetRegisterCountOperand(operand_index); return iterator().GetRegisterCountOperand(operand_index);
...@@ -420,8 +423,11 @@ Smi BaselineCompiler::IndexAsSmi(int operand_index) { ...@@ -420,8 +423,11 @@ Smi BaselineCompiler::IndexAsSmi(int operand_index) {
Smi BaselineCompiler::IntAsSmi(int operand_index) { Smi BaselineCompiler::IntAsSmi(int operand_index) {
return Smi::FromInt(Int(operand_index)); return Smi::FromInt(Int(operand_index));
} }
Smi BaselineCompiler::FlagAsSmi(int operand_index) { Smi BaselineCompiler::Flag8AsSmi(int operand_index) {
return Smi::FromInt(Flag(operand_index)); return Smi::FromInt(Flag8(operand_index));
}
Smi BaselineCompiler::Flag16AsSmi(int operand_index) {
return Smi::FromInt(Flag16(operand_index));
} }
MemOperand BaselineCompiler::FeedbackVector() { MemOperand BaselineCompiler::FeedbackVector() {
...@@ -808,7 +814,7 @@ void BaselineCompiler::VisitLdaLookupGlobalSlotInsideTypeof() { ...@@ -808,7 +814,7 @@ void BaselineCompiler::VisitLdaLookupGlobalSlotInsideTypeof() {
} }
void BaselineCompiler::VisitStaLookupSlot() { void BaselineCompiler::VisitStaLookupSlot() {
uint32_t flags = Flag(1); uint32_t flags = Flag8(1);
Runtime::FunctionId function_id; Runtime::FunctionId function_id;
if (flags & interpreter::StoreLookupSlotFlags::LanguageModeBit::kMask) { if (flags & interpreter::StoreLookupSlotFlags::LanguageModeBit::kMask) {
function_id = Runtime::kStoreLookupSlot_Strict; function_id = Runtime::kStoreLookupSlot_Strict;
...@@ -958,7 +964,7 @@ void BaselineCompiler::VisitDefineKeyedOwnPropertyInLiteral() { ...@@ -958,7 +964,7 @@ void BaselineCompiler::VisitDefineKeyedOwnPropertyInLiteral() {
RegisterOperand(0), // object RegisterOperand(0), // object
RegisterOperand(1), // name RegisterOperand(1), // name
kInterpreterAccumulatorRegister, // value kInterpreterAccumulatorRegister, // value
FlagAsSmi(2), // flags Flag8AsSmi(2), // flags
FeedbackVector(), // feedback vector FeedbackVector(), // feedback vector
IndexAsTagged(3)); // slot IndexAsTagged(3)); // slot
} }
...@@ -1551,7 +1557,7 @@ void BaselineCompiler::VisitTestTypeOf() { ...@@ -1551,7 +1557,7 @@ void BaselineCompiler::VisitTestTypeOf() {
BaselineAssembler::ScratchRegisterScope scratch_scope(&basm_); BaselineAssembler::ScratchRegisterScope scratch_scope(&basm_);
auto literal_flag = auto literal_flag =
static_cast<interpreter::TestTypeOfFlags::LiteralFlag>(Flag(0)); static_cast<interpreter::TestTypeOfFlags::LiteralFlag>(Flag8(0));
Label done; Label done;
switch (literal_flag) { switch (literal_flag) {
...@@ -1750,11 +1756,11 @@ void BaselineCompiler::VisitCreateRegExpLiteral() { ...@@ -1750,11 +1756,11 @@ void BaselineCompiler::VisitCreateRegExpLiteral() {
FeedbackVector(), // feedback vector FeedbackVector(), // feedback vector
IndexAsTagged(1), // slot IndexAsTagged(1), // slot
Constant<HeapObject>(0), // pattern Constant<HeapObject>(0), // pattern
FlagAsSmi(2)); // flags Flag16AsSmi(2)); // flags
} }
void BaselineCompiler::VisitCreateArrayLiteral() { void BaselineCompiler::VisitCreateArrayLiteral() {
uint32_t flags = Flag(2); uint32_t flags = Flag8(2);
int32_t flags_raw = static_cast<int32_t>( int32_t flags_raw = static_cast<int32_t>(
interpreter::CreateArrayLiteralFlags::FlagsBits::decode(flags)); interpreter::CreateArrayLiteralFlags::FlagsBits::decode(flags));
if (flags & if (flags &
...@@ -1784,7 +1790,7 @@ void BaselineCompiler::VisitCreateEmptyArrayLiteral() { ...@@ -1784,7 +1790,7 @@ void BaselineCompiler::VisitCreateEmptyArrayLiteral() {
} }
void BaselineCompiler::VisitCreateObjectLiteral() { void BaselineCompiler::VisitCreateObjectLiteral() {
uint32_t flags = Flag(2); uint32_t flags = Flag8(2);
int32_t flags_raw = static_cast<int32_t>( int32_t flags_raw = static_cast<int32_t>(
interpreter::CreateObjectLiteralFlags::FlagsBits::decode(flags)); interpreter::CreateObjectLiteralFlags::FlagsBits::decode(flags));
if (flags & if (flags &
...@@ -1808,7 +1814,7 @@ void BaselineCompiler::VisitCreateEmptyObjectLiteral() { ...@@ -1808,7 +1814,7 @@ void BaselineCompiler::VisitCreateEmptyObjectLiteral() {
} }
void BaselineCompiler::VisitCloneObject() { void BaselineCompiler::VisitCloneObject() {
uint32_t flags = Flag(1); uint32_t flags = Flag8(1);
int32_t raw_flags = int32_t raw_flags =
interpreter::CreateObjectLiteralFlags::FlagsBits::decode(flags); interpreter::CreateObjectLiteralFlags::FlagsBits::decode(flags);
CallBuiltin<Builtin::kCloneObjectICBaseline>( CallBuiltin<Builtin::kCloneObjectICBaseline>(
...@@ -1833,7 +1839,7 @@ void BaselineCompiler::VisitCreateClosure() { ...@@ -1833,7 +1839,7 @@ void BaselineCompiler::VisitCreateClosure() {
LoadClosureFeedbackArray(feedback_cell); LoadClosureFeedbackArray(feedback_cell);
__ LoadFixedArrayElement(feedback_cell, feedback_cell, Index(1)); __ LoadFixedArrayElement(feedback_cell, feedback_cell, Index(1));
uint32_t flags = Flag(2); uint32_t flags = Flag8(2);
if (interpreter::CreateClosureFlags::FastNewClosureBit::decode(flags)) { if (interpreter::CreateClosureFlags::FastNewClosureBit::decode(flags)) {
CallBuiltin<Builtin::kFastNewClosureBaseline>( CallBuiltin<Builtin::kFastNewClosureBaseline>(
Constant<SharedFunctionInfo>(0), feedback_cell); Constant<SharedFunctionInfo>(0), feedback_cell);
......
...@@ -89,13 +89,15 @@ class BaselineCompiler { ...@@ -89,13 +89,15 @@ class BaselineCompiler {
uint32_t Uint(int operand_index); uint32_t Uint(int operand_index);
int32_t Int(int operand_index); int32_t Int(int operand_index);
uint32_t Index(int operand_index); uint32_t Index(int operand_index);
uint32_t Flag(int operand_index); uint32_t Flag8(int operand_index);
uint32_t Flag16(int operand_index);
uint32_t RegisterCount(int operand_index); uint32_t RegisterCount(int operand_index);
TaggedIndex IndexAsTagged(int operand_index); TaggedIndex IndexAsTagged(int operand_index);
TaggedIndex UintAsTagged(int operand_index); TaggedIndex UintAsTagged(int operand_index);
Smi IndexAsSmi(int operand_index); Smi IndexAsSmi(int operand_index);
Smi IntAsSmi(int operand_index); Smi IntAsSmi(int operand_index);
Smi FlagAsSmi(int operand_index); Smi Flag8AsSmi(int operand_index);
Smi Flag16AsSmi(int operand_index);
// Jump helpers. // Jump helpers.
Label* NewLabel(); Label* NewLabel();
......
...@@ -1650,7 +1650,7 @@ void BytecodeGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() { ...@@ -1650,7 +1650,7 @@ void BytecodeGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() {
Node* name = Node* name =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1));
Node* value = environment()->LookupAccumulator(); Node* value = environment()->LookupAccumulator();
int flags = bytecode_iterator().GetFlagOperand(2); int flags = bytecode_iterator().GetFlag8Operand(2);
FeedbackSource feedback = FeedbackSource feedback =
CreateFeedbackSource(bytecode_iterator().GetIndexOperand(3)); CreateFeedbackSource(bytecode_iterator().GetIndexOperand(3));
const Operator* op = javascript()->DefineKeyedOwnPropertyInLiteral(feedback); const Operator* op = javascript()->DefineKeyedOwnPropertyInLiteral(feedback);
...@@ -1974,7 +1974,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlot() { ...@@ -1974,7 +1974,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlot() {
PrepareEagerCheckpoint(); PrepareEagerCheckpoint();
Node* value = environment()->LookupAccumulator(); Node* value = environment()->LookupAccumulator();
Node* name = jsgraph()->Constant(MakeRefForConstantForIndexOperand(0)); Node* name = jsgraph()->Constant(MakeRefForConstantForIndexOperand(0));
int bytecode_flags = bytecode_iterator().GetFlagOperand(1); int bytecode_flags = bytecode_iterator().GetFlag8Operand(1);
LanguageMode language_mode = static_cast<LanguageMode>( LanguageMode language_mode = static_cast<LanguageMode>(
interpreter::StoreLookupSlotFlags::LanguageModeBit::decode( interpreter::StoreLookupSlotFlags::LanguageModeBit::decode(
bytecode_flags)); bytecode_flags));
...@@ -2219,7 +2219,7 @@ void BytecodeGraphBuilder::VisitCreateClosure() { ...@@ -2219,7 +2219,7 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
MakeRefForConstantForIndexOperand<SharedFunctionInfo>(0); MakeRefForConstantForIndexOperand<SharedFunctionInfo>(0);
AllocationType allocation = AllocationType allocation =
interpreter::CreateClosureFlags::PretenuredBit::decode( interpreter::CreateClosureFlags::PretenuredBit::decode(
bytecode_iterator().GetFlagOperand(2)) bytecode_iterator().GetFlag8Operand(2))
? AllocationType::kOld ? AllocationType::kOld
: AllocationType::kYoung; : AllocationType::kYoung;
CodeTRef compile_lazy = CodeTRef compile_lazy =
...@@ -2298,7 +2298,7 @@ void BytecodeGraphBuilder::VisitCreateRegExpLiteral() { ...@@ -2298,7 +2298,7 @@ void BytecodeGraphBuilder::VisitCreateRegExpLiteral() {
StringRef constant_pattern = MakeRefForConstantForIndexOperand<String>(0); StringRef constant_pattern = MakeRefForConstantForIndexOperand<String>(0);
int const slot_id = bytecode_iterator().GetIndexOperand(1); int const slot_id = bytecode_iterator().GetIndexOperand(1);
FeedbackSource pair = CreateFeedbackSource(slot_id); FeedbackSource pair = CreateFeedbackSource(slot_id);
int literal_flags = bytecode_iterator().GetFlagOperand(2); int literal_flags = bytecode_iterator().GetFlag16Operand(2);
static_assert(JSCreateLiteralRegExpNode::FeedbackVectorIndex() == 0); static_assert(JSCreateLiteralRegExpNode::FeedbackVectorIndex() == 0);
const Operator* op = const Operator* op =
javascript()->CreateLiteralRegExp(constant_pattern, pair, literal_flags); javascript()->CreateLiteralRegExp(constant_pattern, pair, literal_flags);
...@@ -2312,7 +2312,7 @@ void BytecodeGraphBuilder::VisitCreateArrayLiteral() { ...@@ -2312,7 +2312,7 @@ void BytecodeGraphBuilder::VisitCreateArrayLiteral() {
MakeRefForConstantForIndexOperand<ArrayBoilerplateDescription>(0); MakeRefForConstantForIndexOperand<ArrayBoilerplateDescription>(0);
int const slot_id = bytecode_iterator().GetIndexOperand(1); int const slot_id = bytecode_iterator().GetIndexOperand(1);
FeedbackSource pair = CreateFeedbackSource(slot_id); FeedbackSource pair = CreateFeedbackSource(slot_id);
int bytecode_flags = bytecode_iterator().GetFlagOperand(2); int bytecode_flags = bytecode_iterator().GetFlag8Operand(2);
int literal_flags = int literal_flags =
interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags);
// Disable allocation site mementos. Only unoptimized code will collect // Disable allocation site mementos. Only unoptimized code will collect
...@@ -2350,7 +2350,7 @@ void BytecodeGraphBuilder::VisitCreateObjectLiteral() { ...@@ -2350,7 +2350,7 @@ void BytecodeGraphBuilder::VisitCreateObjectLiteral() {
MakeRefForConstantForIndexOperand<ObjectBoilerplateDescription>(0); MakeRefForConstantForIndexOperand<ObjectBoilerplateDescription>(0);
int const slot_id = bytecode_iterator().GetIndexOperand(1); int const slot_id = bytecode_iterator().GetIndexOperand(1);
FeedbackSource pair = CreateFeedbackSource(slot_id); FeedbackSource pair = CreateFeedbackSource(slot_id);
int bytecode_flags = bytecode_iterator().GetFlagOperand(2); int bytecode_flags = bytecode_iterator().GetFlag8Operand(2);
int literal_flags = int literal_flags =
interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags); interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags);
int number_of_properties = constant_properties.size(); int number_of_properties = constant_properties.size();
...@@ -2371,7 +2371,7 @@ void BytecodeGraphBuilder::VisitCloneObject() { ...@@ -2371,7 +2371,7 @@ void BytecodeGraphBuilder::VisitCloneObject() {
PrepareEagerCheckpoint(); PrepareEagerCheckpoint();
Node* source = Node* source =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
int flags = bytecode_iterator().GetFlagOperand(1); int flags = bytecode_iterator().GetFlag8Operand(1);
int slot = bytecode_iterator().GetIndexOperand(2); int slot = bytecode_iterator().GetIndexOperand(2);
const Operator* op = const Operator* op =
javascript()->CloneObject(CreateFeedbackSource(slot), flags); javascript()->CloneObject(CreateFeedbackSource(slot), flags);
...@@ -3347,7 +3347,7 @@ void BytecodeGraphBuilder::VisitTestUndefined() { ...@@ -3347,7 +3347,7 @@ void BytecodeGraphBuilder::VisitTestUndefined() {
void BytecodeGraphBuilder::VisitTestTypeOf() { void BytecodeGraphBuilder::VisitTestTypeOf() {
Node* object = environment()->LookupAccumulator(); Node* object = environment()->LookupAccumulator();
auto literal_flag = interpreter::TestTypeOfFlags::Decode( auto literal_flag = interpreter::TestTypeOfFlags::Decode(
bytecode_iterator().GetFlagOperand(0)); bytecode_iterator().GetFlag8Operand(0));
Node* result; Node* result;
switch (literal_flag) { switch (literal_flag) {
case interpreter::TestTypeOfFlags::LiteralFlag::kNumber: case interpreter::TestTypeOfFlags::LiteralFlag::kNumber:
......
...@@ -93,12 +93,18 @@ int32_t BytecodeArrayIterator::GetSignedOperand( ...@@ -93,12 +93,18 @@ int32_t BytecodeArrayIterator::GetSignedOperand(
current_operand_scale()); current_operand_scale());
} }
uint32_t BytecodeArrayIterator::GetFlagOperand(int operand_index) const { uint32_t BytecodeArrayIterator::GetFlag8Operand(int operand_index) const {
DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index), DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index),
OperandType::kFlag8); OperandType::kFlag8);
return GetUnsignedOperand(operand_index, OperandType::kFlag8); return GetUnsignedOperand(operand_index, OperandType::kFlag8);
} }
uint32_t BytecodeArrayIterator::GetFlag16Operand(int operand_index) const {
DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index),
OperandType::kFlag16);
return GetUnsignedOperand(operand_index, OperandType::kFlag16);
}
uint32_t BytecodeArrayIterator::GetUnsignedImmediateOperand( uint32_t BytecodeArrayIterator::GetUnsignedImmediateOperand(
int operand_index) const { int operand_index) const {
DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index), DCHECK_EQ(Bytecodes::GetOperandType(current_bytecode(), operand_index),
......
...@@ -118,7 +118,8 @@ class V8_EXPORT_PRIVATE BytecodeArrayIterator { ...@@ -118,7 +118,8 @@ class V8_EXPORT_PRIVATE BytecodeArrayIterator {
OperandScale current_operand_scale() const { return operand_scale_; } OperandScale current_operand_scale() const { return operand_scale_; }
Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; } Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
uint32_t GetFlagOperand(int operand_index) const; uint32_t GetFlag8Operand(int operand_index) const;
uint32_t GetFlag16Operand(int operand_index) const;
uint32_t GetUnsignedImmediateOperand(int operand_index) const; uint32_t GetUnsignedImmediateOperand(int operand_index) const;
int32_t GetImmediateOperand(int operand_index) const; int32_t GetImmediateOperand(int operand_index) const;
uint32_t GetIndexOperand(int operand_index) const; uint32_t GetIndexOperand(int operand_index) const;
......
...@@ -165,6 +165,7 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os, ...@@ -165,6 +165,7 @@ std::ostream& BytecodeDecoder::Decode(std::ostream& os,
<< "]"; << "]";
break; break;
case interpreter::OperandType::kFlag8: case interpreter::OperandType::kFlag8:
case interpreter::OperandType::kFlag16:
os << "#" os << "#"
<< DecodeUnsignedOperand(operand_start, op_type, operand_scale); << DecodeUnsignedOperand(operand_start, op_type, operand_scale);
break; break;
......
...@@ -35,6 +35,7 @@ namespace interpreter { ...@@ -35,6 +35,7 @@ namespace interpreter {
#define UNSIGNED_FIXED_SCALAR_OPERAND_TYPE_LIST(V) \ #define UNSIGNED_FIXED_SCALAR_OPERAND_TYPE_LIST(V) \
V(Flag8, OperandTypeInfo::kFixedUnsignedByte) \ V(Flag8, OperandTypeInfo::kFixedUnsignedByte) \
V(Flag16, OperandTypeInfo::kFixedUnsignedShort) \
V(IntrinsicId, OperandTypeInfo::kFixedUnsignedByte) \ V(IntrinsicId, OperandTypeInfo::kFixedUnsignedByte) \
V(RuntimeId, OperandTypeInfo::kFixedUnsignedShort) \ V(RuntimeId, OperandTypeInfo::kFixedUnsignedShort) \
V(NativeContextIndex, OperandTypeInfo::kFixedUnsignedByte) V(NativeContextIndex, OperandTypeInfo::kFixedUnsignedByte)
......
...@@ -300,7 +300,7 @@ namespace interpreter { ...@@ -300,7 +300,7 @@ namespace interpreter {
\ \
/* Literals */ \ /* Literals */ \
V(CreateRegExpLiteral, ImplicitRegisterUse::kWriteAccumulator, \ V(CreateRegExpLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \ OperandType::kIdx, OperandType::kIdx, OperandType::kFlag16) \
V(CreateArrayLiteral, ImplicitRegisterUse::kWriteAccumulator, \ V(CreateArrayLiteral, ImplicitRegisterUse::kWriteAccumulator, \
OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \ OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) \
V(CreateArrayFromIterable, ImplicitRegisterUse::kReadWriteAccumulator) \ V(CreateArrayFromIterable, ImplicitRegisterUse::kReadWriteAccumulator) \
......
...@@ -550,6 +550,16 @@ TNode<Uint32T> InterpreterAssembler::BytecodeOperandFlag(int operand_index) { ...@@ -550,6 +550,16 @@ TNode<Uint32T> InterpreterAssembler::BytecodeOperandFlag(int operand_index) {
return BytecodeUnsignedOperand(operand_index, operand_size); return BytecodeUnsignedOperand(operand_index, operand_size);
} }
TNode<Uint32T> InterpreterAssembler::BytecodeOperandWideFlag(
int operand_index) {
DCHECK_EQ(OperandType::kFlag16,
Bytecodes::GetOperandType(bytecode_, operand_index));
OperandSize operand_size =
Bytecodes::GetOperandSize(bytecode_, operand_index, operand_scale());
DCHECK_EQ(operand_size, OperandSize::kShort);
return BytecodeUnsignedOperand(operand_index, operand_size);
}
TNode<Uint32T> InterpreterAssembler::BytecodeOperandUImm(int operand_index) { TNode<Uint32T> InterpreterAssembler::BytecodeOperandUImm(int operand_index) {
DCHECK_EQ(OperandType::kUImm, DCHECK_EQ(OperandType::kUImm,
Bytecodes::GetOperandType(bytecode_, operand_index)); Bytecodes::GetOperandType(bytecode_, operand_index));
......
...@@ -29,6 +29,9 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler { ...@@ -29,6 +29,9 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// Returns the 32-bit unsigned flag for bytecode operand |operand_index| // Returns the 32-bit unsigned flag for bytecode operand |operand_index|
// in the current bytecode. // in the current bytecode.
TNode<Uint32T> BytecodeOperandFlag(int operand_index); TNode<Uint32T> BytecodeOperandFlag(int operand_index);
// Returns the 32-bit unsigned 2-byte flag for bytecode operand
// |operand_index| in the current bytecode.
TNode<Uint32T> BytecodeOperandWideFlag(int operand_index);
// Returns the 32-bit zero-extended index immediate for bytecode operand // Returns the 32-bit zero-extended index immediate for bytecode operand
// |operand_index| in the current bytecode. // |operand_index| in the current bytecode.
TNode<Uint32T> BytecodeOperandIdxInt32(int operand_index); TNode<Uint32T> BytecodeOperandIdxInt32(int operand_index);
......
...@@ -2260,7 +2260,7 @@ IGNITION_HANDLER(CreateRegExpLiteral, InterpreterAssembler) { ...@@ -2260,7 +2260,7 @@ IGNITION_HANDLER(CreateRegExpLiteral, InterpreterAssembler) {
TNode<HeapObject> feedback_vector = LoadFeedbackVector(); TNode<HeapObject> feedback_vector = LoadFeedbackVector();
TNode<TaggedIndex> slot = BytecodeOperandIdxTaggedIndex(1); TNode<TaggedIndex> slot = BytecodeOperandIdxTaggedIndex(1);
TNode<Smi> flags = TNode<Smi> flags =
SmiFromInt32(UncheckedCast<Int32T>(BytecodeOperandFlag(2))); SmiFromInt32(UncheckedCast<Int32T>(BytecodeOperandWideFlag(2)));
TNode<Context> context = GetContext(); TNode<Context> context = GetContext();
TVARIABLE(JSRegExp, result); TVARIABLE(JSRegExp, result);
......
...@@ -710,7 +710,8 @@ void MaglevGraphBuilder::VisitTestTypeOf() { ...@@ -710,7 +710,8 @@ void MaglevGraphBuilder::VisitTestTypeOf() {
using LiteralFlag = interpreter::TestTypeOfFlags::LiteralFlag; using LiteralFlag = interpreter::TestTypeOfFlags::LiteralFlag;
// TODO(v8:7700): Add a branch version of TestTypeOf that does not need to // TODO(v8:7700): Add a branch version of TestTypeOf that does not need to
// materialise the boolean value. // materialise the boolean value.
LiteralFlag literal = interpreter::TestTypeOfFlags::Decode(GetFlagOperand(0)); LiteralFlag literal =
interpreter::TestTypeOfFlags::Decode(GetFlag8Operand(0));
if (literal == LiteralFlag::kOther) { if (literal == LiteralFlag::kOther) {
SetAccumulator(GetRootConstant(RootIndex::kFalseValue)); SetAccumulator(GetRootConstant(RootIndex::kFalseValue));
return; return;
...@@ -875,7 +876,7 @@ void MaglevGraphBuilder::VisitStaLookupSlot() { ...@@ -875,7 +876,7 @@ void MaglevGraphBuilder::VisitStaLookupSlot() {
// StaLookupSlot <name_index> <flags> // StaLookupSlot <name_index> <flags>
ValueNode* value = GetAccumulatorTagged(); ValueNode* value = GetAccumulatorTagged();
ValueNode* name = GetConstant(GetRefOperand<Name>(0)); ValueNode* name = GetConstant(GetRefOperand<Name>(0));
uint32_t flags = GetFlagOperand(1); uint32_t flags = GetFlag8Operand(1);
SetAccumulator(BuildCallRuntime(StaLookupSlotFunction(flags), {name, value})); SetAccumulator(BuildCallRuntime(StaLookupSlotFunction(flags), {name, value}));
} }
...@@ -1410,7 +1411,7 @@ void MaglevGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() { ...@@ -1410,7 +1411,7 @@ void MaglevGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() {
ValueNode* object = LoadRegisterTagged(0); ValueNode* object = LoadRegisterTagged(0);
ValueNode* name = LoadRegisterTagged(1); ValueNode* name = LoadRegisterTagged(1);
ValueNode* value = GetAccumulatorTagged(); ValueNode* value = GetAccumulatorTagged();
ValueNode* flags = GetSmiConstant(GetFlagOperand(2)); ValueNode* flags = GetSmiConstant(GetFlag8Operand(2));
ValueNode* slot = GetSmiConstant(GetSlotOperand(3).ToInt()); ValueNode* slot = GetSmiConstant(GetSlotOperand(3).ToInt());
ValueNode* feedback_vector = GetConstant(feedback()); ValueNode* feedback_vector = GetConstant(feedback());
SetAccumulator( SetAccumulator(
...@@ -1419,7 +1420,7 @@ void MaglevGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() { ...@@ -1419,7 +1420,7 @@ void MaglevGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() {
} }
void MaglevGraphBuilder::VisitCollectTypeProfile() { void MaglevGraphBuilder::VisitCollectTypeProfile() {
ValueNode* position = GetSmiConstant(GetFlagOperand(0)); ValueNode* position = GetSmiConstant(GetFlag8Operand(0));
ValueNode* value = GetAccumulatorTagged(); ValueNode* value = GetAccumulatorTagged();
ValueNode* feedback_vector = GetConstant(feedback()); ValueNode* feedback_vector = GetConstant(feedback());
SetAccumulator(BuildCallRuntime(Runtime::kCollectTypeProfile, SetAccumulator(BuildCallRuntime(Runtime::kCollectTypeProfile,
...@@ -2160,7 +2161,7 @@ void MaglevGraphBuilder::VisitCreateRegExpLiteral() { ...@@ -2160,7 +2161,7 @@ void MaglevGraphBuilder::VisitCreateRegExpLiteral() {
// CreateRegExpLiteral <pattern_idx> <literal_idx> <flags> // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags>
compiler::StringRef pattern = GetRefOperand<String>(0); compiler::StringRef pattern = GetRefOperand<String>(0);
FeedbackSlot slot = GetSlotOperand(1); FeedbackSlot slot = GetSlotOperand(1);
uint32_t flags = GetFlagOperand(2); uint32_t flags = GetFlag16Operand(2);
compiler::FeedbackSource feedback_source{feedback(), slot}; compiler::FeedbackSource feedback_source{feedback(), slot};
// TODO(victorgomes): Inline allocation if feedback has a RegExpLiteral. // TODO(victorgomes): Inline allocation if feedback has a RegExpLiteral.
SetAccumulator( SetAccumulator(
...@@ -2170,7 +2171,7 @@ void MaglevGraphBuilder::VisitCreateRegExpLiteral() { ...@@ -2170,7 +2171,7 @@ void MaglevGraphBuilder::VisitCreateRegExpLiteral() {
void MaglevGraphBuilder::VisitCreateArrayLiteral() { void MaglevGraphBuilder::VisitCreateArrayLiteral() {
compiler::HeapObjectRef constant_elements = GetRefOperand<HeapObject>(0); compiler::HeapObjectRef constant_elements = GetRefOperand<HeapObject>(0);
FeedbackSlot slot_index = GetSlotOperand(1); FeedbackSlot slot_index = GetSlotOperand(1);
int bytecode_flags = GetFlagOperand(2); int bytecode_flags = GetFlag8Operand(2);
int literal_flags = int literal_flags =
interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags); interpreter::CreateArrayLiteralFlags::FlagsBits::decode(bytecode_flags);
ValueNode* result; ValueNode* result;
...@@ -2207,7 +2208,7 @@ void MaglevGraphBuilder::VisitCreateObjectLiteral() { ...@@ -2207,7 +2208,7 @@ void MaglevGraphBuilder::VisitCreateObjectLiteral() {
compiler::ObjectBoilerplateDescriptionRef boilerplate_desc = compiler::ObjectBoilerplateDescriptionRef boilerplate_desc =
GetRefOperand<ObjectBoilerplateDescription>(0); GetRefOperand<ObjectBoilerplateDescription>(0);
FeedbackSlot slot_index = GetSlotOperand(1); FeedbackSlot slot_index = GetSlotOperand(1);
int bytecode_flags = GetFlagOperand(2); int bytecode_flags = GetFlag8Operand(2);
int literal_flags = int literal_flags =
interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags); interpreter::CreateObjectLiteralFlags::FlagsBits::decode(bytecode_flags);
ValueNode* result; ValueNode* result;
...@@ -2241,7 +2242,7 @@ void MaglevGraphBuilder::VisitCloneObject() { ...@@ -2241,7 +2242,7 @@ void MaglevGraphBuilder::VisitCloneObject() {
ValueNode* source = LoadRegisterTagged(0); ValueNode* source = LoadRegisterTagged(0);
ValueNode* flags = ValueNode* flags =
GetSmiConstant(interpreter::CreateObjectLiteralFlags::FlagsBits::decode( GetSmiConstant(interpreter::CreateObjectLiteralFlags::FlagsBits::decode(
GetFlagOperand(1))); GetFlag8Operand(1)));
FeedbackSlot slot = GetSlotOperand(2); FeedbackSlot slot = GetSlotOperand(2);
compiler::FeedbackSource feedback_source{feedback(), slot}; compiler::FeedbackSource feedback_source{feedback(), slot};
SetAccumulator(BuildCallBuiltin<Builtin::kCloneObjectIC>({source, flags}, SetAccumulator(BuildCallBuiltin<Builtin::kCloneObjectIC>({source, flags},
...@@ -2271,7 +2272,7 @@ void MaglevGraphBuilder::VisitCreateClosure() { ...@@ -2271,7 +2272,7 @@ void MaglevGraphBuilder::VisitCreateClosure() {
GetRefOperand<SharedFunctionInfo>(0); GetRefOperand<SharedFunctionInfo>(0);
compiler::FeedbackCellRef feedback_cell = compiler::FeedbackCellRef feedback_cell =
feedback().GetClosureFeedbackCell(iterator_.GetIndexOperand(1)); feedback().GetClosureFeedbackCell(iterator_.GetIndexOperand(1));
uint32_t flags = GetFlagOperand(2); uint32_t flags = GetFlag8Operand(2);
if (interpreter::CreateClosureFlags::FastNewClosureBit::decode(flags)) { if (interpreter::CreateClosureFlags::FastNewClosureBit::decode(flags)) {
SetAccumulator(AddNewNode<FastCreateClosure>( SetAccumulator(AddNewNode<FastCreateClosure>(
...@@ -2843,7 +2844,7 @@ void MaglevGraphBuilder::VisitIncBlockCounter() { ...@@ -2843,7 +2844,7 @@ void MaglevGraphBuilder::VisitIncBlockCounter() {
} }
void MaglevGraphBuilder::VisitAbort() { void MaglevGraphBuilder::VisitAbort() {
AbortReason reason = static_cast<AbortReason>(GetFlagOperand(0)); AbortReason reason = static_cast<AbortReason>(GetFlag8Operand(0));
BuildAbort(reason); BuildAbort(reason);
} }
......
...@@ -432,8 +432,12 @@ class MaglevGraphBuilder { ...@@ -432,8 +432,12 @@ class MaglevGraphBuilder {
return iterator_.GetSlotOperand(operand_index); return iterator_.GetSlotOperand(operand_index);
} }
uint32_t GetFlagOperand(int operand_index) const { uint32_t GetFlag8Operand(int operand_index) const {
return iterator_.GetFlagOperand(operand_index); return iterator_.GetFlag8Operand(operand_index);
}
uint32_t GetFlag16Operand(int operand_index) const {
return iterator_.GetFlag16Operand(operand_index);
} }
template <class T, typename = std::enable_if_t< template <class T, typename = std::enable_if_t<
......
...@@ -196,7 +196,11 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( ...@@ -196,7 +196,11 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand(
switch (op_type) { switch (op_type) {
case OperandType::kFlag8: case OperandType::kFlag8:
*stream << 'U' << size_tag << '('; *stream << 'U' << size_tag << '(';
*stream << bytecode_iterator.GetFlagOperand(op_index); *stream << bytecode_iterator.GetFlag8Operand(op_index);
break;
case OperandType::kFlag16:
*stream << 'U' << size_tag << '(';
*stream << bytecode_iterator.GetFlag16Operand(op_index);
break; break;
case OperandType::kIdx: { case OperandType::kIdx: {
*stream << 'U' << size_tag << '('; *stream << 'U' << size_tag << '(';
......
...@@ -11,9 +11,9 @@ snippet: " ...@@ -11,9 +11,9 @@ snippet: "
" "
frame size: 0 frame size: 0
parameter count: 1 parameter count: 1
bytecode array length: 5 bytecode array length: 6
bytecodes: [ bytecodes: [
/* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U16(0),
/* 48 S> */ B(Return), /* 48 S> */ B(Return),
] ]
constant pool: [ constant pool: [
...@@ -28,9 +28,9 @@ snippet: " ...@@ -28,9 +28,9 @@ snippet: "
" "
frame size: 0 frame size: 0
parameter count: 1 parameter count: 1
bytecode array length: 5 bytecode array length: 6
bytecodes: [ bytecodes: [
/* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(2), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U16(2),
/* 57 S> */ B(Return), /* 57 S> */ B(Return),
] ]
constant pool: [ constant pool: [
...@@ -45,9 +45,9 @@ snippet: " ...@@ -45,9 +45,9 @@ snippet: "
" "
frame size: 3 frame size: 3
parameter count: 1 parameter count: 1
bytecode array length: 19 bytecode array length: 20
bytecodes: [ bytecodes: [
/* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U16(0),
B(Star1), B(Star1),
/* 48 E> */ B(GetNamedProperty), R(1), U8(1), U8(1), /* 48 E> */ B(GetNamedProperty), R(1), U8(1), U8(1),
B(Star0), B(Star0),
......
...@@ -320,6 +320,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { ...@@ -320,6 +320,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) {
EXPECT_THAT(m.BytecodeOperandFlag(i), EXPECT_THAT(m.BytecodeOperandFlag(i),
m.IsUnsignedOperand(offset, operand_size)); m.IsUnsignedOperand(offset, operand_size));
break; break;
case interpreter::OperandType::kFlag16:
EXPECT_THAT(m.BytecodeOperandWideFlag(i),
m.IsUnsignedOperand(offset, operand_size));
break;
case interpreter::OperandType::kIdx: case interpreter::OperandType::kIdx:
EXPECT_THAT(m.BytecodeOperandIdx(i), EXPECT_THAT(m.BytecodeOperandIdx(i),
c::IsChangeUint32ToWord( c::IsChangeUint32ToWord(
......
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