From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- .../v8/src/interpreter/bytecode-array-writer.cc | 2 +- chromium/v8/src/interpreter/bytecode-generator.cc | 3 +- .../v8/src/interpreter/interpreter-assembler.cc | 5 +- .../v8/src/interpreter/interpreter-generator.cc | 333 ++++----------------- chromium/v8/src/interpreter/interpreter.cc | 4 +- 5 files changed, 66 insertions(+), 281 deletions(-) (limited to 'chromium/v8/src/interpreter') diff --git a/chromium/v8/src/interpreter/bytecode-array-writer.cc b/chromium/v8/src/interpreter/bytecode-array-writer.cc index a1b9d9d5f67..34a19b4b5ff 100644 --- a/chromium/v8/src/interpreter/bytecode-array-writer.cc +++ b/chromium/v8/src/interpreter/bytecode-array-writer.cc @@ -27,7 +27,7 @@ BytecodeArrayWriter::BytecodeArrayWriter( SourcePositionTableBuilder::RecordingMode source_position_mode) : bytecodes_(zone), unbound_jumps_(0), - source_position_table_builder_(source_position_mode), + source_position_table_builder_(zone, source_position_mode), constant_array_builder_(constant_array_builder), last_bytecode_(Bytecode::kIllegal), last_bytecode_offset_(0), diff --git a/chromium/v8/src/interpreter/bytecode-generator.cc b/chromium/v8/src/interpreter/bytecode-generator.cc index 4a1c045927e..9a758370635 100644 --- a/chromium/v8/src/interpreter/bytecode-generator.cc +++ b/chromium/v8/src/interpreter/bytecode-generator.cc @@ -4886,7 +4886,8 @@ void BytecodeGenerator::VisitCall(Call* expr) { break; } case Call::NAMED_OPTIONAL_CHAIN_PROPERTY_CALL: - case Call::KEYED_OPTIONAL_CHAIN_PROPERTY_CALL: { + case Call::KEYED_OPTIONAL_CHAIN_PROPERTY_CALL: + case Call::PRIVATE_OPTIONAL_CHAIN_CALL: { OptionalChain* chain = callee_expr->AsOptionalChain(); Property* property = chain->expression()->AsProperty(); BuildOptionalChain([&]() { diff --git a/chromium/v8/src/interpreter/interpreter-assembler.cc b/chromium/v8/src/interpreter/interpreter-assembler.cc index 49adee5bf75..1d15ed77a09 100644 --- a/chromium/v8/src/interpreter/interpreter-assembler.cc +++ b/chromium/v8/src/interpreter/interpreter-assembler.cc @@ -683,8 +683,9 @@ TNode InterpreterAssembler::BytecodeOperandIntrinsicId( TNode InterpreterAssembler::LoadConstantPoolEntry(TNode index) { TNode constant_pool = CAST(LoadObjectField( BytecodeArrayTaggedPointer(), BytecodeArray::kConstantPoolOffset)); - return UnsafeLoadFixedArrayElement( - constant_pool, UncheckedCast(index), LoadSensitivity::kCritical); + return UnsafeLoadFixedArrayElement(constant_pool, + UncheckedCast(index), 0, + LoadSensitivity::kCritical); } TNode InterpreterAssembler::LoadAndUntagConstantPoolEntry( diff --git a/chromium/v8/src/interpreter/interpreter-generator.cc b/chromium/v8/src/interpreter/interpreter-generator.cc index 9fef9ac0a02..481c90ab0f8 100644 --- a/chromium/v8/src/interpreter/interpreter-generator.cc +++ b/chromium/v8/src/interpreter/interpreter-generator.cc @@ -14,6 +14,7 @@ #include "src/ic/accessor-assembler.h" #include "src/ic/binary-op-assembler.h" #include "src/ic/ic.h" +#include "src/ic/unary-op-assembler.h" #include "src/interpreter/bytecode-flags.h" #include "src/interpreter/bytecodes.h" #include "src/interpreter/interpreter-assembler.h" @@ -1083,38 +1084,17 @@ IGNITION_HANDLER(BitwiseAndSmi, InterpreterBitwiseBinaryOpAssembler) { // // Perform bitwise-not on the accumulator. IGNITION_HANDLER(BitwiseNot, InterpreterAssembler) { - TNode operand = GetAccumulator(); + TNode value = GetAccumulator(); + TNode context = GetContext(); TNode slot_index = BytecodeOperandIdx(0); TNode maybe_feedback_vector = LoadFeedbackVector(); - TNode context = GetContext(); - TVARIABLE(Word32T, var_word32); - TVARIABLE(Smi, var_feedback); - TVARIABLE(BigInt, var_bigint); - Label if_number(this), if_bigint(this); - TaggedToWord32OrBigIntWithFeedback(context, operand, &if_number, &var_word32, - &if_bigint, &var_bigint, &var_feedback); + UnaryOpAssembler unary_op_asm(state()); + TNode result = unary_op_asm.Generate_BitwiseNotWithFeedback( + context, value, slot_index, maybe_feedback_vector); - // Number case. - BIND(&if_number); - TNode result = - ChangeInt32ToTagged(Signed(Word32BitwiseNot(var_word32.value()))); - TNode result_type = SelectSmiConstant( - TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, - BinaryOperationFeedback::kNumber); - UpdateFeedback(SmiOr(result_type, var_feedback.value()), - maybe_feedback_vector, slot_index); SetAccumulator(result); Dispatch(); - - // BigInt case. - BIND(&if_bigint); - UpdateFeedback(SmiConstant(BinaryOperationFeedback::kBigInt), - maybe_feedback_vector, slot_index); - SetAccumulator(CallRuntime(Runtime::kBigIntUnaryOp, context, - var_bigint.value(), - SmiConstant(Operation::kBitwiseNot))); - Dispatch(); } // ShiftLeftSmi @@ -1144,162 +1124,22 @@ IGNITION_HANDLER(ShiftRightLogicalSmi, InterpreterBitwiseBinaryOpAssembler) { BitwiseBinaryOpWithSmi(Operation::kShiftRightLogical); } -class UnaryNumericOpAssembler : public InterpreterAssembler { - public: - UnaryNumericOpAssembler(CodeAssemblerState* state, Bytecode bytecode, - OperandScale operand_scale) - : InterpreterAssembler(state, bytecode, operand_scale) {} - - virtual ~UnaryNumericOpAssembler() = default; - - // Must return a tagged value. - virtual TNode SmiOp(TNode smi_value, - TVariable* var_feedback, Label* do_float_op, - TVariable* var_float) = 0; - // Must return a Float64 value. - virtual TNode FloatOp(TNode float_value) = 0; - // Must return a tagged value. - virtual TNode BigIntOp(TNode bigint_value) = 0; - - void UnaryOpWithFeedback() { - TVARIABLE(Object, var_value, GetAccumulator()); - TVARIABLE(Object, var_result); - TVARIABLE(Float64T, var_float_value); - TVARIABLE(Smi, var_feedback, SmiConstant(BinaryOperationFeedback::kNone)); - Label start(this, {&var_value, &var_feedback}), end(this); - Label do_float_op(this, &var_float_value); - Goto(&start); - // We might have to try again after ToNumeric conversion. - BIND(&start); - { - Label if_smi(this), if_heapnumber(this), if_oddball(this); - Label if_bigint(this, Label::kDeferred); - Label if_other(this, Label::kDeferred); - TNode value = var_value.value(); - GotoIf(TaggedIsSmi(value), &if_smi); - - TNode value_heap_object = CAST(value); - TNode map = LoadMap(value_heap_object); - GotoIf(IsHeapNumberMap(map), &if_heapnumber); - TNode instance_type = LoadMapInstanceType(map); - GotoIf(IsBigIntInstanceType(instance_type), &if_bigint); - Branch(InstanceTypeEqual(instance_type, ODDBALL_TYPE), &if_oddball, - &if_other); - - BIND(&if_smi); - { - var_result = - SmiOp(CAST(value), &var_feedback, &do_float_op, &var_float_value); - Goto(&end); - } - - BIND(&if_heapnumber); - { - var_float_value = LoadHeapNumberValue(value_heap_object); - Goto(&do_float_op); - } - - BIND(&if_bigint); - { - var_result = BigIntOp(value_heap_object); - CombineFeedback(&var_feedback, BinaryOperationFeedback::kBigInt); - Goto(&end); - } - - BIND(&if_oddball); - { - // We do not require an Or with earlier feedback here because once we - // convert the value to a number, we cannot reach this path. We can - // only reach this path on the first pass when the feedback is kNone. - CSA_ASSERT(this, SmiEqual(var_feedback.value(), - SmiConstant(BinaryOperationFeedback::kNone))); - OverwriteFeedback(&var_feedback, - BinaryOperationFeedback::kNumberOrOddball); - var_value = - LoadObjectField(value_heap_object, Oddball::kToNumberOffset); - Goto(&start); - } - - BIND(&if_other); - { - // We do not require an Or with earlier feedback here because once we - // convert the value to a number, we cannot reach this path. We can - // only reach this path on the first pass when the feedback is kNone. - CSA_ASSERT(this, SmiEqual(var_feedback.value(), - SmiConstant(BinaryOperationFeedback::kNone))); - OverwriteFeedback(&var_feedback, BinaryOperationFeedback::kAny); - var_value = CallBuiltin(Builtins::kNonNumberToNumeric, GetContext(), - value_heap_object); - Goto(&start); - } - } - - BIND(&do_float_op); - { - CombineFeedback(&var_feedback, BinaryOperationFeedback::kNumber); - var_result = - AllocateHeapNumberWithValue(FloatOp(var_float_value.value())); - Goto(&end); - } - - BIND(&end); - TNode slot_index = BytecodeOperandIdx(0); - TNode maybe_feedback_vector = LoadFeedbackVector(); - UpdateFeedback(var_feedback.value(), maybe_feedback_vector, slot_index); - SetAccumulator(var_result.value()); - Dispatch(); - } -}; - -class NegateAssemblerImpl : public UnaryNumericOpAssembler { - public: - explicit NegateAssemblerImpl(CodeAssemblerState* state, Bytecode bytecode, - OperandScale operand_scale) - : UnaryNumericOpAssembler(state, bytecode, operand_scale) {} - - TNode SmiOp(TNode smi_value, TVariable* var_feedback, - Label* do_float_op, - TVariable* var_float) override { - TVARIABLE(Number, var_result); - Label if_zero(this), if_min_smi(this), end(this); - // Return -0 if operand is 0. - GotoIf(SmiEqual(smi_value, SmiConstant(0)), &if_zero); - - // Special-case the minimum Smi to avoid overflow. - GotoIf(SmiEqual(smi_value, SmiConstant(Smi::kMinValue)), &if_min_smi); - - // Else simply subtract operand from 0. - CombineFeedback(var_feedback, BinaryOperationFeedback::kSignedSmall); - var_result = SmiSub(SmiConstant(0), smi_value); - Goto(&end); - - BIND(&if_zero); - CombineFeedback(var_feedback, BinaryOperationFeedback::kNumber); - var_result = MinusZeroConstant(); - Goto(&end); - - BIND(&if_min_smi); - *var_float = SmiToFloat64(smi_value); - Goto(do_float_op); - - BIND(&end); - return var_result.value(); - } - - TNode FloatOp(TNode float_value) override { - return Float64Neg(float_value); - } - - TNode BigIntOp(TNode bigint_value) override { - return CAST(CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, - SmiConstant(Operation::kNegate))); - } -}; - // Negate // // Perform arithmetic negation on the accumulator. -IGNITION_HANDLER(Negate, NegateAssemblerImpl) { UnaryOpWithFeedback(); } +IGNITION_HANDLER(Negate, InterpreterAssembler) { + TNode value = GetAccumulator(); + TNode context = GetContext(); + TNode slot_index = BytecodeOperandIdx(0); + TNode maybe_feedback_vector = LoadFeedbackVector(); + + UnaryOpAssembler unary_op_asm(state()); + TNode result = unary_op_asm.Generate_NegateWithFeedback( + context, value, slot_index, maybe_feedback_vector); + + SetAccumulator(result); + Dispatch(); +} // ToName // @@ -1345,72 +1185,39 @@ IGNITION_HANDLER(ToString, InterpreterAssembler) { Dispatch(); } -class IncDecAssembler : public UnaryNumericOpAssembler { - public: - explicit IncDecAssembler(CodeAssemblerState* state, Bytecode bytecode, - OperandScale operand_scale) - : UnaryNumericOpAssembler(state, bytecode, operand_scale) {} - - Operation op() { - DCHECK(op_ == Operation::kIncrement || op_ == Operation::kDecrement); - return op_; - } - - TNode SmiOp(TNode value, TVariable* var_feedback, - Label* do_float_op, - TVariable* var_float) override { - TNode one = SmiConstant(1); - Label if_overflow(this), if_notoverflow(this); - TNode result = op() == Operation::kIncrement - ? TrySmiAdd(value, one, &if_overflow) - : TrySmiSub(value, one, &if_overflow); - Goto(&if_notoverflow); - - BIND(&if_overflow); - { - *var_float = SmiToFloat64(value); - Goto(do_float_op); - } - - BIND(&if_notoverflow); - CombineFeedback(var_feedback, BinaryOperationFeedback::kSignedSmall); - return result; - } - - TNode FloatOp(TNode float_value) override { - return op() == Operation::kIncrement - ? Float64Add(float_value, Float64Constant(1.0)) - : Float64Sub(float_value, Float64Constant(1.0)); - } - - TNode BigIntOp(TNode bigint_value) override { - return CAST(CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, - SmiConstant(op()))); - } - - void IncWithFeedback() { - op_ = Operation::kIncrement; - UnaryOpWithFeedback(); - } - - void DecWithFeedback() { - op_ = Operation::kDecrement; - UnaryOpWithFeedback(); - } - - private: - Operation op_ = Operation::kEqual; // Dummy initialization. -}; - // Inc // // Increments value in the accumulator by one. -IGNITION_HANDLER(Inc, IncDecAssembler) { IncWithFeedback(); } +IGNITION_HANDLER(Inc, InterpreterAssembler) { + TNode value = GetAccumulator(); + TNode context = GetContext(); + TNode slot_index = BytecodeOperandIdx(0); + TNode maybe_feedback_vector = LoadFeedbackVector(); + + UnaryOpAssembler unary_op_asm(state()); + TNode result = unary_op_asm.Generate_IncrementWithFeedback( + context, value, slot_index, maybe_feedback_vector); + + SetAccumulator(result); + Dispatch(); +} // Dec // // Decrements value in the accumulator by one. -IGNITION_HANDLER(Dec, IncDecAssembler) { DecWithFeedback(); } +IGNITION_HANDLER(Dec, InterpreterAssembler) { + TNode value = GetAccumulator(); + TNode context = GetContext(); + TNode slot_index = BytecodeOperandIdx(0); + TNode maybe_feedback_vector = LoadFeedbackVector(); + + UnaryOpAssembler unary_op_asm(state()); + TNode result = unary_op_asm.Generate_DecrementWithFeedback( + context, value, slot_index, maybe_feedback_vector); + + SetAccumulator(result); + Dispatch(); +} // ToBooleanLogicalNot // @@ -2602,10 +2409,9 @@ IGNITION_HANDLER(CloneObject, InterpreterAssembler) { TNode maybe_feedback_vector = LoadFeedbackVector(); TNode context = GetContext(); - TVARIABLE(Object, var_result); - var_result = CallBuiltin(Builtins::kCloneObjectIC, context, source, smi_flags, - slot, maybe_feedback_vector); - SetAccumulator(var_result.value()); + TNode result = CallBuiltin(Builtins::kCloneObjectIC, context, source, + smi_flags, slot, maybe_feedback_vector); + SetAccumulator(result); Dispatch(); } @@ -2615,41 +2421,18 @@ IGNITION_HANDLER(CloneObject, InterpreterAssembler) { // accumulator, creating and caching the site object on-demand as per the // specification. IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { - TNode maybe_feedback_vector = LoadFeedbackVector(); + TNode context = GetContext(); + TNode closure = CAST(LoadRegister(Register::function_closure())); + TNode shared_info = LoadObjectField( + closure, JSFunction::kSharedFunctionInfoOffset); + TNode description = LoadConstantPoolEntryAtOperandIndex(0); TNode slot = BytecodeOperandIdx(1); - - Label call_runtime(this, Label::kDeferred); - GotoIf(IsUndefined(maybe_feedback_vector), &call_runtime); - - TNode cached_value = - CAST(LoadFeedbackVectorSlot(CAST(maybe_feedback_vector), slot)); - - GotoIf(TaggedEqual(cached_value, SmiConstant(0)), &call_runtime); - - SetAccumulator(cached_value); + TNode maybe_feedback_vector = LoadFeedbackVector(); + TNode result = + CallBuiltin(Builtins::kGetTemplateObject, context, shared_info, + description, slot, maybe_feedback_vector); + SetAccumulator(result); Dispatch(); - - BIND(&call_runtime); - { - TNode description = LoadConstantPoolEntryAtOperandIndex(0); - TNode slot_smi = SmiTag(Signed(slot)); - TNode closure = - CAST(LoadRegister(Register::function_closure())); - TNode shared_info = LoadObjectField( - closure, JSFunction::kSharedFunctionInfoOffset); - TNode context = GetContext(); - TNode result = CallRuntime(Runtime::kGetTemplateObject, context, - description, shared_info, slot_smi); - - Label end(this); - GotoIf(IsUndefined(maybe_feedback_vector), &end); - StoreFeedbackVectorSlot(CAST(maybe_feedback_vector), slot, result); - Goto(&end); - - Bind(&end); - SetAccumulator(result); - Dispatch(); - } } // CreateClosure diff --git a/chromium/v8/src/interpreter/interpreter.cc b/chromium/v8/src/interpreter/interpreter.cc index 42f0c561625..3174e749199 100644 --- a/chromium/v8/src/interpreter/interpreter.cc +++ b/chromium/v8/src/interpreter/interpreter.cc @@ -194,14 +194,14 @@ void InterpreterCompilationJob::CheckAndPrintBytecodeMismatch( MaybeHandle maybe_name = parse_info()->literal()->GetName(isolate); Handle name; if (maybe_name.ToHandle(&name) && name->length() != 0) { - name->StringPrint(std::cerr); + name->PrintUC16(std::cerr); } else { std::cerr << "anonymous"; } Object script_name = script->GetNameOrSourceURL(); if (script_name.IsString()) { std::cerr << " "; - String::cast(script_name).StringPrint(std::cerr); + String::cast(script_name).PrintUC16(std::cerr); std::cerr << ":" << parse_info()->literal()->start_position(); } #endif -- cgit v1.2.1