diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 709fdc57900f09..37abe105b74e3c 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -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.) diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index 97db02225f8bc3..804a6840c18ee3 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -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; } @@ -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 equals or // undefined equals static bool MatchLiteralCompareUndefined(Expression* left, Token::Value op, diff --git a/deps/v8/src/ast/ast.h b/deps/v8/src/ast/ast.h index a348ccf82a2d1f..971a2b0ec1321e 100644 --- a/deps/v8/src/ast/ast.h +++ b/deps/v8/src/ast/ast.h @@ -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; @@ -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 { @@ -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); diff --git a/deps/v8/src/compiler/bytecode-graph-builder.cc b/deps/v8/src/compiler/bytecode-graph-builder.cc index a86f16886ae13e..7fe1b626b1e27b 100644 --- a/deps/v8/src/compiler/bytecode-graph-builder.cc +++ b/deps/v8/src/compiler/bytecode-graph-builder.cc @@ -3977,24 +3977,19 @@ 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(); @@ -4002,6 +3997,7 @@ void BytecodeGraphBuilder::BuildJumpIfTrue() { MergeIntoSuccessorEnvironment(bytecode_iterator().GetJumpTargetOffset()); } NewIfFalse(); + environment()->BindAccumulator(jsgraph()->FalseConstant()); } void BytecodeGraphBuilder::BuildJumpIfToBooleanTrue() { diff --git a/deps/v8/src/compiler/wasm-compiler.cc b/deps/v8/src/compiler/wasm-compiler.cc index 6dda13e53cd506..f0e444dc358600 100644 --- a/deps/v8/src/compiler/wasm-compiler.cc +++ b/deps/v8/src/compiler/wasm-compiler.cc @@ -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); @@ -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(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, ¶meter_slots, &return_slots); const RegList kCalleeSaveRegisters; const DoubleRegList kCalleeSaveFPRegisters; @@ -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 @@ -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(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(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, ¶meter_slots, &return_slots); return zone->New( // -- 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 diff --git a/deps/v8/src/interpreter/bytecode-generator.cc b/deps/v8/src/interpreter/bytecode-generator.cc index 6d3fe7e76e3985..4a0299df55dd82 100644 --- a/deps/v8/src/interpreter/bytecode-generator.cc +++ b/deps/v8/src/interpreter/bytecode-generator.cc @@ -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; @@ -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); diff --git a/deps/v8/src/interpreter/bytecode-generator.h b/deps/v8/src/interpreter/bytecode-generator.h index 075578433c8a96..28ede9457b16cf 100644 --- a/deps/v8/src/interpreter/bytecode-generator.h +++ b/deps/v8/src/interpreter/bytecode-generator.h @@ -263,7 +263,6 @@ class BytecodeGenerator final : public AstVisitor { 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(); diff --git a/deps/v8/src/interpreter/interpreter-generator.cc b/deps/v8/src/interpreter/interpreter-generator.cc index 50e9fff51ebb72..e0c35ac2c9a248 100644 --- a/deps/v8/src/interpreter/interpreter-generator.cc +++ b/deps/v8/src/interpreter/interpreter-generator.cc @@ -1915,6 +1915,7 @@ IGNITION_HANDLER(JumpConstant, InterpreterAssembler) { // will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfTrue, InterpreterAssembler) { TNode accumulator = GetAccumulator(); + CSA_DCHECK(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqual(accumulator, TrueConstant(), 0); } @@ -1925,6 +1926,7 @@ IGNITION_HANDLER(JumpIfTrue, InterpreterAssembler) { // and will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfTrueConstant, InterpreterAssembler) { TNode accumulator = GetAccumulator(); + CSA_DCHECK(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqualConstant(accumulator, TrueConstant(), 0); } @@ -1935,6 +1937,7 @@ IGNITION_HANDLER(JumpIfTrueConstant, InterpreterAssembler) { // will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfFalse, InterpreterAssembler) { TNode accumulator = GetAccumulator(); + CSA_DCHECK(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqual(accumulator, FalseConstant(), 0); } @@ -1945,6 +1948,7 @@ IGNITION_HANDLER(JumpIfFalse, InterpreterAssembler) { // and will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfFalseConstant, InterpreterAssembler) { TNode accumulator = GetAccumulator(); + CSA_DCHECK(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqualConstant(accumulator, FalseConstant(), 0); } diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareBoolean.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareBoolean.golden deleted file mode 100644 index 76646494bd509c..00000000000000 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareBoolean.golden +++ /dev/null @@ -1,368 +0,0 @@ -# -# Autogenerated by generate-bytecode-expectations. -# - ---- -wrap: yes - ---- -snippet: " - var a = 1; - return a === true; -" -frame size: 1 -parameter count: 1 -bytecode array length: 7 -bytecodes: [ - /* 42 S> */ B(LdaSmi), I8(1), - B(Star0), - /* 45 S> */ B(LdaTrue), - B(TestReferenceEqual), R(0), - /* 63 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = true; - return true === a; -" -frame size: 1 -parameter count: 1 -bytecode array length: 6 -bytecodes: [ - /* 42 S> */ B(LdaTrue), - B(Star0), - /* 48 S> */ B(LdaTrue), - B(TestReferenceEqual), R(0), - /* 66 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = false; - return true !== a; -" -frame size: 1 -parameter count: 1 -bytecode array length: 7 -bytecodes: [ - /* 42 S> */ B(LdaFalse), - B(Star0), - /* 49 S> */ B(LdaTrue), - B(TestReferenceEqual), R(0), - /* 61 E> */ B(LogicalNot), - /* 67 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = 1; - return true === a ? 1 : 2; -" -frame size: 1 -parameter count: 1 -bytecode array length: 14 -bytecodes: [ - /* 42 S> */ B(LdaSmi), I8(1), - B(Star0), - /* 45 S> */ B(JumpIfTrue), U8(4), - B(Jump), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - /* 71 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = true; - return false === a ? 1 : 2; -" -frame size: 1 -parameter count: 1 -bytecode array length: 13 -bytecodes: [ - /* 42 S> */ B(LdaTrue), - B(Star0), - /* 48 S> */ B(JumpIfFalse), U8(4), - B(Jump), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - /* 75 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = 1; - return true !== a ? 1 : 2; -" -frame size: 1 -parameter count: 1 -bytecode array length: 12 -bytecodes: [ - /* 42 S> */ B(LdaSmi), I8(1), - B(Star0), - /* 45 S> */ B(JumpIfTrue), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - /* 71 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = false; - return false !== null ? 1 : 2; -" -frame size: 1 -parameter count: 1 -bytecode array length: 12 -bytecodes: [ - /* 42 S> */ B(LdaFalse), - B(Star0), - /* 49 S> */ B(LdaNull), - B(JumpIfFalse), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - /* 79 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = 0; - if (a !== true) { - return 1; - } -" -frame size: 1 -parameter count: 1 -bytecode array length: 9 -bytecodes: [ - /* 42 S> */ B(LdaZero), - B(Star0), - /* 45 S> */ B(JumpIfTrue), U8(5), - /* 65 S> */ B(LdaSmi), I8(1), - /* 74 S> */ B(Return), - B(LdaUndefined), - /* 77 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - var a = true; - var b = 0; - while (a !== true) { - b++; - } -" -frame size: 2 -parameter count: 1 -bytecode array length: 18 -bytecodes: [ - /* 42 S> */ B(LdaTrue), - B(Star0), - /* 56 S> */ B(LdaZero), - B(Star1), - /* 68 S> */ B(Ldar), R(0), - B(JumpIfTrue), U8(10), - /* 82 S> */ B(Ldar), R(1), - B(Inc), U8(0), - B(Star1), - /* 59 E> */ B(JumpLoop), U8(9), I8(0), - B(LdaUndefined), - /* 89 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - (0 === true) ? 1 : 2; -" -frame size: 0 -parameter count: 1 -bytecode array length: 13 -bytecodes: [ - /* 34 S> */ B(LdaZero), - B(JumpIfTrue), U8(4), - B(Jump), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - B(LdaUndefined), - /* 56 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - (0 !== true) ? 1 : 2; -" -frame size: 0 -parameter count: 1 -bytecode array length: 11 -bytecodes: [ - /* 34 S> */ B(LdaZero), - B(JumpIfTrue), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - B(LdaUndefined), - /* 56 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - (false === 0) ? 1 : 2; -" -frame size: 0 -parameter count: 1 -bytecode array length: 13 -bytecodes: [ - /* 34 S> */ B(LdaZero), - B(JumpIfFalse), U8(4), - B(Jump), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - B(LdaUndefined), - /* 57 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - (0 === true || 0 === false) ? 1 : 2; -" -frame size: 0 -parameter count: 1 -bytecode array length: 16 -bytecodes: [ - /* 34 S> */ B(LdaZero), - B(JumpIfTrue), U8(7), - B(LdaZero), - B(JumpIfFalse), U8(4), - B(Jump), U8(6), - B(LdaSmi), I8(1), - B(Jump), U8(4), - B(LdaSmi), I8(2), - B(LdaUndefined), - /* 71 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - if (0 === true || 0 === false) return 1; -" -frame size: 0 -parameter count: 1 -bytecode array length: 13 -bytecodes: [ - /* 34 S> */ B(LdaZero), - B(JumpIfTrue), U8(7), - B(LdaZero), - B(JumpIfFalse), U8(4), - B(Jump), U8(5), - /* 65 S> */ B(LdaSmi), I8(1), - /* 74 S> */ B(Return), - B(LdaUndefined), - /* 75 S> */ B(Return), -] -constant pool: [ -] -handlers: [ -] - ---- -snippet: " - if (!('false' === false)) return 1; -" -frame size: 0 -parameter count: 1 -bytecode array length: 9 -bytecodes: [ - /* 34 S> */ B(LdaConstant), U8(0), - B(JumpIfFalse), U8(5), - /* 60 S> */ B(LdaSmi), I8(1), - /* 69 S> */ B(Return), - B(LdaUndefined), - /* 70 S> */ B(Return), -] -constant pool: [ - ONE_BYTE_INTERNALIZED_STRING_TYPE ["false"], -] -handlers: [ -] - ---- -snippet: " - if (!('false' !== false)) return 1; -" -frame size: 0 -parameter count: 1 -bytecode array length: 11 -bytecodes: [ - /* 34 S> */ B(LdaConstant), U8(0), - B(JumpIfFalse), U8(4), - B(Jump), U8(5), - /* 60 S> */ B(LdaSmi), I8(1), - /* 69 S> */ B(Return), - B(LdaUndefined), - /* 70 S> */ B(Return), -] -constant pool: [ - ONE_BYTE_INTERNALIZED_STRING_TYPE ["false"], -] -handlers: [ -] - diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index 2a31638d33bcb4..09e2926059b249 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -1161,62 +1161,6 @@ TEST(CompareTypeOf) { LoadGolden("CompareTypeOf.golden"))); } -TEST(CompareBoolean) { - InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate()); - - std::string snippets[] = { - "var a = 1;\n" - "return a === true;\n", - - "var a = true;\n" - "return true === a;\n", - - "var a = false;\n" - "return true !== a;\n", - - "var a = 1;\n" - "return true === a ? 1 : 2;\n", - - "var a = true;\n" - "return false === a ? 1 : 2;\n", - - "var a = 1;\n" - "return true !== a ? 1 : 2;\n", - - "var a = false;\n" - "return false !== null ? 1 : 2;\n", - - "var a = 0;\n" - "if (a !== true) {\n" - " return 1;\n" - "}\n", - - "var a = true;\n" - "var b = 0;\n" - "while (a !== true) {\n" - " b++;\n" - "}\n", - - "(0 === true) ? 1 : 2;\n", - - "(0 !== true) ? 1 : 2;\n", - - "(false === 0) ? 1 : 2;\n", - - "(0 === true || 0 === false) ? 1 : 2;\n", - - "if (0 === true || 0 === false) return 1;\n", - - "if (!('false' === false)) return 1;\n", - - "if (!('false' !== false)) return 1;\n", - }; - - CHECK(CompareTexts(BuildActual(printer, snippets), - LoadGolden("CompareBoolean.golden"))); -} - TEST(CompareNil) { InitializedIgnitionHandleScope scope; BytecodeExpectationsPrinter printer(CcTest::isolate()); diff --git a/deps/v8/test/js-perf-test/BytecodeHandlers/compare.js b/deps/v8/test/js-perf-test/BytecodeHandlers/compare.js index 668ec4b7ebd591..ea12ff4b2192ca 100644 --- a/deps/v8/test/js-perf-test/BytecodeHandlers/compare.js +++ b/deps/v8/test/js-perf-test/BytecodeHandlers/compare.js @@ -16,7 +16,6 @@ addBenchmark('Number-StrictEquals-False', NumberStrictEqualsFalse); addBenchmark('String-StrictEquals-True', StringStrictEqualsTrue); addBenchmark('String-StrictEquals-False', StringStrictEqualsFalse); addBenchmark('SmiString-StrictEquals', MixedStrictEquals); -addBenchmark('Boolean-StrictEquals', BooleanStrictEquals); addBenchmark('Smi-Equals-True', SmiEqualsTrue); addBenchmark('Smi-Equals-False', SmiEqualsFalse); addBenchmark('Number-Equals-True', NumberEqualsTrue); @@ -47,113 +46,6 @@ function strictEquals(a, b) { } } -function strictEqualsBoolean(a) { - var ret; - for (var i = 0; i < 1000; ++i) { - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === true) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - if (a === false) ret = true; - } - return ret; -} - function equals(a, b) { for (var i = 0; i < 1000; ++i) { a == b; a == b; a == b; a == b; a == b; a == b; a == b; a == b; a == b; a == b; @@ -212,12 +104,6 @@ function StringStrictEqualsTrue() { strictEquals("abc", "abc"); } -function BooleanStrictEquals() { - strictEqualsBoolean("a"); - strictEqualsBoolean(true); - strictEqualsBoolean(false); -} - function MixedStrictEquals() { strictEquals(10, "10"); } diff --git a/deps/v8/test/js-perf-test/JSTests3.json b/deps/v8/test/js-perf-test/JSTests3.json index ec57b96abb740c..244a7e728db017 100644 --- a/deps/v8/test/js-perf-test/JSTests3.json +++ b/deps/v8/test/js-perf-test/JSTests3.json @@ -318,7 +318,6 @@ {"name": "String-StrictEquals-True"}, {"name": "String-StrictEquals-False"}, {"name": "SmiString-StrictEquals"}, - {"name": "Boolean-StrictEquals"}, {"name": "Smi-Equals-True"}, {"name": "Smi-Equals-False"}, {"name": "Number-Equals-True"},