Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: patch V8 to 10.2.154.4 #43067

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 10
#define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 154
#define V8_PATCH_LEVEL 2
#define V8_PATCH_LEVEL 4

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
22 changes: 0 additions & 22 deletions deps/v8/src/ast/ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ bool Expression::IsNullLiteral() const {
return IsLiteral() && AsLiteral()->type() == Literal::kNull;
}

bool Expression::IsBooleanLiteral() const {
return IsLiteral() && AsLiteral()->type() == Literal::kBoolean;
}

bool Expression::IsTheHoleLiteral() const {
return IsLiteral() && AsLiteral()->type() == Literal::kTheHole;
}
Expand Down Expand Up @@ -896,24 +892,6 @@ static bool IsVoidOfLiteral(Expression* expr) {
maybe_unary->expression()->IsLiteral();
}

static bool MatchLiteralStrictCompareBoolean(Expression* left, Token::Value op,
Expression* right,
Expression** expr,
Literal** literal) {
if (left->IsBooleanLiteral() && op == Token::EQ_STRICT) {
*expr = right;
*literal = left->AsLiteral();
return true;
}
return false;
}

bool CompareOperation::IsLiteralStrictCompareBoolean(Expression** expr,
Literal** literal) {
return MatchLiteralStrictCompareBoolean(left_, op(), right_, expr, literal) ||
MatchLiteralStrictCompareBoolean(right_, op(), left_, expr, literal);
}

// Check for the pattern: void <literal> equals <expression> or
// undefined equals <expression>
static bool MatchLiteralCompareUndefined(Expression* left, Token::Value op,
Expand Down
8 changes: 0 additions & 8 deletions deps/v8/src/ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ class Expression : public AstNode {
// True iff the expression is the null literal.
bool IsNullLiteral() const;

bool IsBooleanLiteral() const;

// True iff the expression is the hole literal.
bool IsTheHoleLiteral() const;

Expand Down Expand Up @@ -957,11 +955,6 @@ class Literal final : public Expression {
return Smi::FromInt(smi_);
}

bool AsBooleanLiteral() const {
DCHECK_EQ(kBoolean, type());
return boolean_;
}

// Returns true if literal represents a Number.
bool IsNumber() const { return type() == kHeapNumber || type() == kSmi; }
double AsNumber() const {
Expand Down Expand Up @@ -1970,7 +1963,6 @@ class CompareOperation final : public Expression {

// Match special cases.
bool IsLiteralCompareTypeof(Expression** expr, Literal** literal);
bool IsLiteralStrictCompareBoolean(Expression** expr, Literal** literal);
bool IsLiteralCompareUndefined(Expression** expr);
bool IsLiteralCompareNull(Expression** expr);

Expand Down
16 changes: 6 additions & 10 deletions deps/v8/src/compiler/bytecode-graph-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3977,31 +3977,27 @@ void BytecodeGraphBuilder::BuildJumpIfNotEqual(Node* comperand) {
}

void BytecodeGraphBuilder::BuildJumpIfFalse() {
Node* accumulator = environment()->LookupAccumulator();
Node* condition = NewNode(simplified()->ReferenceEqual(), accumulator,
jsgraph()->FalseConstant());
NewBranch(condition, BranchHint::kNone);
NewBranch(environment()->LookupAccumulator(), BranchHint::kNone);
{
SubEnvironment sub_environment(this);
NewIfTrue();
NewIfFalse();
environment()->BindAccumulator(jsgraph()->FalseConstant());
MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset());
}
NewIfFalse();
NewIfTrue();
environment()->BindAccumulator(jsgraph()->TrueConstant());
}

void BytecodeGraphBuilder::BuildJumpIfTrue() {
Node* accumulator = environment()->LookupAccumulator();
Node* condition = NewNode(simplified()->ReferenceEqual(), accumulator,
jsgraph()->TrueConstant());
NewBranch(condition, BranchHint::kNone);
NewBranch(environment()->LookupAccumulator(), BranchHint::kNone);
{
SubEnvironment sub_environment(this);
NewIfTrue();
environment()->BindAccumulator(jsgraph()->TrueConstant());
MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset());
}
NewIfFalse();
environment()->BindAccumulator(jsgraph()->FalseConstant());
}

void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() {
Expand Down
117 changes: 48 additions & 69 deletions deps/v8/src/compiler/wasm-compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8554,16 +8554,10 @@ class LinkageLocationAllocator {
// must be offset to just before the param slots, using this |slot_offset_|.
int slot_offset_;
};
} // namespace

// General code uses the above configuration data.
CallDescriptor* GetWasmCallDescriptor(Zone* zone, const wasm::FunctionSig* fsig,
WasmCallKind call_kind,
bool need_frame_state) {
// The extra here is to accomodate the instance object as first parameter
// and, when specified, the additional callable.
bool extra_callable_param =
call_kind == kWasmImportWrapper || call_kind == kWasmCapiFunction;
LocationSignature* BuildLocations(Zone* zone, const wasm::FunctionSig* fsig,
bool extra_callable_param,
int* parameter_slots, int* return_slots) {
int extra_params = extra_callable_param ? 2 : 1;
LocationSignature::Builder locations(zone, fsig->return_count(),
fsig->parameter_count() + extra_params);
Expand Down Expand Up @@ -8606,19 +8600,37 @@ CallDescriptor* GetWasmCallDescriptor(Zone* zone, const wasm::FunctionSig* fsig,
kJSFunctionRegister.code(), MachineType::TaggedPointer()));
}

int parameter_slots = AddArgumentPaddingSlots(params.NumStackSlots());
*parameter_slots = AddArgumentPaddingSlots(params.NumStackSlots());

// Add return location(s).
LinkageLocationAllocator rets(wasm::kGpReturnRegisters,
wasm::kFpReturnRegisters, parameter_slots);
wasm::kFpReturnRegisters, *parameter_slots);

const int return_count = static_cast<int>(locations.return_count_);
for (int i = 0; i < return_count; i++) {
const size_t return_count = locations.return_count_;
for (size_t i = 0; i < return_count; i++) {
MachineRepresentation ret = fsig->GetReturn(i).machine_representation();
locations.AddReturn(rets.Next(ret));
}

int return_slots = rets.NumStackSlots();
*return_slots = rets.NumStackSlots();

return locations.Build();
}
} // namespace

// General code uses the above configuration data.
CallDescriptor* GetWasmCallDescriptor(Zone* zone, const wasm::FunctionSig* fsig,
WasmCallKind call_kind,
bool need_frame_state) {
// The extra here is to accomodate the instance object as first parameter
// and, when specified, the additional callable.
bool extra_callable_param =
call_kind == kWasmImportWrapper || call_kind == kWasmCapiFunction;

int parameter_slots;
int return_slots;
LocationSignature* location_sig = BuildLocations(
zone, fsig, extra_callable_param, &parameter_slots, &return_slots);

const RegList kCalleeSaveRegisters;
const DoubleRegList kCalleeSaveFPRegisters;
Expand All @@ -8644,7 +8656,7 @@ CallDescriptor* GetWasmCallDescriptor(Zone* zone, const wasm::FunctionSig* fsig,
descriptor_kind, // kind
target_type, // target MachineType
target_loc, // target location
locations.Build(), // location_sig
location_sig, // location_sig
parameter_slots, // parameter slot count
compiler::Operator::kNoProperties, // properties
kCalleeSaveRegisters, // callee-saved registers
Expand Down Expand Up @@ -8695,78 +8707,45 @@ const wasm::FunctionSig* ReplaceTypeInSig(Zone* zone,
CallDescriptor* ReplaceTypeInCallDescriptorWith(
Zone* zone, const CallDescriptor* call_descriptor, size_t num_replacements,
wasm::ValueType input_type, wasm::ValueType output_type) {
size_t parameter_count = call_descriptor->ParameterCount();
size_t return_count = call_descriptor->ReturnCount();
for (size_t i = 0; i < call_descriptor->ParameterCount(); i++) {
if (call_descriptor->GetParameterType(i) == input_type.machine_type()) {
parameter_count += num_replacements - 1;
if (call_descriptor->wasm_sig() == nullptr) {
// This happens for builtins calls. They need no replacements anyway.
#if DEBUG
for (size_t i = 0; i < call_descriptor->ParameterCount(); i++) {
DCHECK_NE(call_descriptor->GetParameterType(i),
input_type.machine_type());
}
}
for (size_t i = 0; i < call_descriptor->ReturnCount(); i++) {
if (call_descriptor->GetReturnType(i) == input_type.machine_type()) {
return_count += num_replacements - 1;
for (size_t i = 0; i < call_descriptor->ReturnCount(); i++) {
DCHECK_NE(call_descriptor->GetReturnType(i), input_type.machine_type());
}
#endif
return const_cast<CallDescriptor*>(call_descriptor);
}
if (parameter_count == call_descriptor->ParameterCount() &&
return_count == call_descriptor->ReturnCount()) {
const wasm::FunctionSig* sig =
ReplaceTypeInSig(zone, call_descriptor->wasm_sig(), input_type,
output_type, num_replacements);
// If {ReplaceTypeInSig} took the early fast path, there's nothing to do.
if (sig == call_descriptor->wasm_sig()) {
return const_cast<CallDescriptor*>(call_descriptor);
}

LocationSignature::Builder locations(zone, return_count, parameter_count);

// The last parameter may be the special callable parameter. In that case we
// have to preserve it as the last parameter, i.e. we allocate it in the new
// location signature again in the same register.
bool has_callable_param =
bool extra_callable_param =
(call_descriptor->GetInputLocation(call_descriptor->InputCount() - 1) ==
LinkageLocation::ForRegister(kJSFunctionRegister.code(),
MachineType::TaggedPointer()));
LinkageLocationAllocator params(
wasm::kGpParamRegisters, wasm::kFpParamRegisters, 0 /* no slot offset */);

for (size_t i = 0;
i < call_descriptor->ParameterCount() - (has_callable_param ? 1 : 0);
i++) {
if (call_descriptor->GetParameterType(i) == input_type.machine_type()) {
for (size_t j = 0; j < num_replacements; j++) {
locations.AddParam(params.Next(output_type.machine_representation()));
}
} else {
locations.AddParam(
params.Next(call_descriptor->GetParameterType(i).representation()));
}
}
if (has_callable_param) {
locations.AddParam(LinkageLocation::ForRegister(
kJSFunctionRegister.code(), MachineType::TaggedPointer()));
}

int parameter_slots = AddArgumentPaddingSlots(params.NumStackSlots());

LinkageLocationAllocator rets(wasm::kGpReturnRegisters,
wasm::kFpReturnRegisters, parameter_slots);

for (size_t i = 0; i < call_descriptor->ReturnCount(); i++) {
if (call_descriptor->GetReturnType(i) == input_type.machine_type()) {
for (size_t j = 0; j < num_replacements; j++) {
locations.AddReturn(rets.Next(output_type.machine_representation()));
}
} else {
locations.AddReturn(
rets.Next(call_descriptor->GetReturnType(i).representation()));
}
}

int return_slots = rets.NumStackSlots();

auto sig = ReplaceTypeInSig(zone, call_descriptor->wasm_sig(), input_type,
output_type, num_replacements);
int parameter_slots;
int return_slots;
LocationSignature* location_sig = BuildLocations(
zone, sig, extra_callable_param, &parameter_slots, &return_slots);

return zone->New<CallDescriptor>( // --
call_descriptor->kind(), // kind
call_descriptor->GetInputType(0), // target MachineType
call_descriptor->GetInputLocation(0), // target location
locations.Build(), // location_sig
location_sig, // location_sig
parameter_slots, // parameter slot count
call_descriptor->properties(), // properties
call_descriptor->CalleeSavedRegisters(), // callee-saved registers
Expand Down
28 changes: 0 additions & 28 deletions deps/v8/src/interpreter/bytecode-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6157,29 +6157,6 @@ void BytecodeGenerator::BuildLiteralCompareNil(
}
}

void BytecodeGenerator::BuildLiteralStrictCompareBoolean(Literal* literal) {
DCHECK(literal->IsBooleanLiteral());
if (execution_result()->IsTest()) {
TestResultScope* test_result = execution_result()->AsTest();
if (literal->AsBooleanLiteral()) {
builder()->JumpIfTrue(ToBooleanMode::kAlreadyBoolean,
test_result->NewThenLabel());
} else {
builder()->JumpIfFalse(ToBooleanMode::kAlreadyBoolean,
test_result->NewThenLabel());
}
if (test_result->fallthrough() != TestFallthrough::kElse) {
builder()->Jump(test_result->NewElseLabel());
}
test_result->SetResultConsumedByTest();
} else {
Register result = register_allocator()->NewRegister();
builder()->StoreAccumulatorInRegister(result);
builder()->LoadBoolean(literal->AsBooleanLiteral());
builder()->CompareReference(result);
}
}

void BytecodeGenerator::VisitCompareOperation(CompareOperation* expr) {
Expression* sub_expr;
Literal* literal;
Expand All @@ -6195,11 +6172,6 @@ void BytecodeGenerator::VisitCompareOperation(CompareOperation* expr) {
} else {
builder()->CompareTypeOf(literal_flag);
}
} else if (expr->IsLiteralStrictCompareBoolean(&sub_expr, &literal)) {
DCHECK(expr->op() == Token::EQ_STRICT);
VisitForAccumulatorValue(sub_expr);
builder()->SetExpressionPosition(expr);
BuildLiteralStrictCompareBoolean(literal);
} else if (expr->IsLiteralCompareUndefined(&sub_expr)) {
VisitForAccumulatorValue(sub_expr);
builder()->SetExpressionPosition(expr);
Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/interpreter/bytecode-generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ class BytecodeGenerator final : public AstVisitor<BytecodeGenerator> {
LookupHoistingMode lookup_hoisting_mode = LookupHoistingMode::kNormal);
void BuildLiteralCompareNil(Token::Value compare_op,
BytecodeArrayBuilder::NilValue nil);
void BuildLiteralStrictCompareBoolean(Literal* literal);
void BuildReturn(int source_position);
void BuildAsyncReturn(int source_position);
void BuildAsyncGeneratorReturn();
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/src/interpreter/interpreter-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,7 @@ IGNITION_HANDLER(JumpConstant, InterpreterAssembler) {
// will misbehave if passed arbitrary input values.
IGNITION_HANDLER(JumpIfTrue, InterpreterAssembler) {
TNode<Object> accumulator = GetAccumulator();
CSA_DCHECK(this, IsBoolean(CAST(accumulator)));
JumpIfTaggedEqual(accumulator, TrueConstant(), 0);
}

Expand All @@ -1925,6 +1926,7 @@ IGNITION_HANDLER(JumpIfTrue, InterpreterAssembler) {
// and will misbehave if passed arbitrary input values.
IGNITION_HANDLER(JumpIfTrueConstant, InterpreterAssembler) {
TNode<Object> accumulator = GetAccumulator();
CSA_DCHECK(this, IsBoolean(CAST(accumulator)));
JumpIfTaggedEqualConstant(accumulator, TrueConstant(), 0);
}

Expand All @@ -1935,6 +1937,7 @@ IGNITION_HANDLER(JumpIfTrueConstant, InterpreterAssembler) {
// will misbehave if passed arbitrary input values.
IGNITION_HANDLER(JumpIfFalse, InterpreterAssembler) {
TNode<Object> accumulator = GetAccumulator();
CSA_DCHECK(this, IsBoolean(CAST(accumulator)));
JumpIfTaggedEqual(accumulator, FalseConstant(), 0);
}

Expand All @@ -1945,6 +1948,7 @@ IGNITION_HANDLER(JumpIfFalse, InterpreterAssembler) {
// and will misbehave if passed arbitrary input values.
IGNITION_HANDLER(JumpIfFalseConstant, InterpreterAssembler) {
TNode<Object> accumulator = GetAccumulator();
CSA_DCHECK(this, IsBoolean(CAST(accumulator)));
JumpIfTaggedEqualConstant(accumulator, FalseConstant(), 0);
}

Expand Down
Loading