diff options
author | Myles Borins <mylesborins@google.com> | 2019-09-24 11:56:38 -0400 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2019-10-07 03:19:23 -0400 |
commit | f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2 (patch) | |
tree | f5edbccb3ffda2573d70a6e291e7157f290e0ae0 /deps/v8/src/compiler/js-type-hint-lowering.cc | |
parent | ffd22e81983056d09c064c59343a0e488236272d (diff) | |
download | android-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.tar.gz android-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.tar.bz2 android-node-v8-f7f6c928c1c9c136b7926f892b8a2fda11d8b4b2.zip |
deps: update V8 to 7.8.279.9
PR-URL: https://github.com/nodejs/node/pull/29694
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Diffstat (limited to 'deps/v8/src/compiler/js-type-hint-lowering.cc')
-rw-r--r-- | deps/v8/src/compiler/js-type-hint-lowering.cc | 154 |
1 files changed, 73 insertions, 81 deletions
diff --git a/deps/v8/src/compiler/js-type-hint-lowering.cc b/deps/v8/src/compiler/js-type-hint-lowering.cc index f3696bcc48..e1ff928cec 100644 --- a/deps/v8/src/compiler/js-type-hint-lowering.cc +++ b/deps/v8/src/compiler/js-type-hint-lowering.cc @@ -6,6 +6,7 @@ #include "src/compiler/access-builder.h" #include "src/compiler/js-graph.h" +#include "src/compiler/js-heap-broker.h" #include "src/compiler/operator-properties.h" #include "src/compiler/simplified-operator.h" #include "src/objects/feedback-vector.h" @@ -78,16 +79,6 @@ class JSSpeculativeBinopBuilder final { control_(control), slot_(slot) {} - BinaryOperationHint GetBinaryOperationHint() { - FeedbackNexus nexus(feedback_vector(), slot_); - return nexus.GetBinaryOperationFeedback(); - } - - CompareOperationHint GetCompareOperationHint() { - FeedbackNexus nexus(feedback_vector(), slot_); - return nexus.GetCompareOperationFeedback(); - } - bool GetBinaryNumberOperationHint(NumberOperationHint* hint) { return BinaryOperationHintToNumberOperationHint(GetBinaryOperationHint(), hint); @@ -239,34 +230,52 @@ class JSSpeculativeBinopBuilder final { JSOperatorBuilder* javascript() { return jsgraph()->javascript(); } SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } CommonOperatorBuilder* common() { return jsgraph()->common(); } - const Handle<FeedbackVector>& feedback_vector() const { - return lowering_->feedback_vector(); - } private: - const JSTypeHintLowering* lowering_; - const Operator* op_; + BinaryOperationHint GetBinaryOperationHint() { + return lowering_->GetBinaryOperationHint(slot_); + } + + CompareOperationHint GetCompareOperationHint() { + return lowering_->GetCompareOperationHint(slot_); + } + + JSTypeHintLowering const* const lowering_; + Operator const* const op_; Node* left_; Node* right_; - Node* effect_; - Node* control_; - FeedbackSlot slot_; + Node* const effect_; + Node* const control_; + FeedbackSlot const slot_; }; -JSTypeHintLowering::JSTypeHintLowering(JSGraph* jsgraph, - Handle<FeedbackVector> feedback_vector, +JSTypeHintLowering::JSTypeHintLowering(JSHeapBroker* broker, JSGraph* jsgraph, + FeedbackVectorRef feedback_vector, Flags flags) - : jsgraph_(jsgraph), flags_(flags), feedback_vector_(feedback_vector) {} + : broker_(broker), + jsgraph_(jsgraph), + flags_(flags), + feedback_vector_(feedback_vector) {} Isolate* JSTypeHintLowering::isolate() const { return jsgraph()->isolate(); } +BinaryOperationHint JSTypeHintLowering::GetBinaryOperationHint( + FeedbackSlot slot) const { + FeedbackSource source(feedback_vector(), slot); + return broker()->GetFeedbackForBinaryOperation(source); +} + +CompareOperationHint JSTypeHintLowering::GetCompareOperationHint( + FeedbackSlot slot) const { + FeedbackSource source(feedback_vector(), slot); + return broker()->GetFeedbackForCompareOperation(source); +} + JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceUnaryOperation( const Operator* op, Node* operand, Node* effect, Node* control, FeedbackSlot slot) const { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForUnaryOperation)) { return LoweringResult::Exit(node); } @@ -309,9 +318,7 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceUnaryOperation( control, slot); node = b.TryBuildNumberBinop(); if (!node) { - FeedbackNexus nexus(feedback_vector(), slot); - if (nexus.GetBinaryOperationFeedback() == - BinaryOperationHint::kBigInt) { + if (GetBinaryOperationHint(slot) == BinaryOperationHint::kBigInt) { const Operator* op = jsgraph()->simplified()->SpeculativeBigIntNegate( BigIntOperationHint::kBigInt); node = jsgraph()->graph()->NewNode(op, operand, effect, control); @@ -335,10 +342,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( FeedbackSlot slot) const { switch (op->opcode()) { case IrOpcode::kJSStrictEqual: { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForCompareOperation)) { return LoweringResult::Exit(node); } @@ -351,10 +356,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( case IrOpcode::kJSGreaterThan: case IrOpcode::kJSLessThanOrEqual: case IrOpcode::kJSGreaterThanOrEqual: { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForCompareOperation)) { return LoweringResult::Exit(node); } @@ -365,10 +368,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( break; } case IrOpcode::kJSInstanceOf: { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForCompareOperation)) { return LoweringResult::Exit(node); } @@ -387,10 +388,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( case IrOpcode::kJSMultiply: case IrOpcode::kJSDivide: case IrOpcode::kJSModulus: { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForBinaryOperation)) { return LoweringResult::Exit(node); } @@ -406,6 +405,11 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( break; } case IrOpcode::kJSExponentiate: { + if (Node* node = TryBuildSoftDeopt( + slot, effect, control, + DeoptimizeReason::kInsufficientTypeFeedbackForBinaryOperation)) { + return LoweringResult::Exit(node); + } // TODO(neis): Introduce a SpeculativeNumberPow operator? break; } @@ -418,10 +422,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation( JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceForInNextOperation( Node* receiver, Node* cache_array, Node* cache_type, Node* index, Node* effect, Node* control, FeedbackSlot slot) const { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForForIn)) { return LoweringResult::Exit(node); } @@ -432,10 +434,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceForInPrepareOperation(Node* enumerator, Node* effect, Node* control, FeedbackSlot slot) const { - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForForIn)) { return LoweringResult::Exit(node); } @@ -445,12 +445,11 @@ JSTypeHintLowering::ReduceForInPrepareOperation(Node* enumerator, Node* effect, JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceToNumberOperation( Node* input, Node* effect, Node* control, FeedbackSlot slot) const { DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); NumberOperationHint hint; - if (BinaryOperationHintToNumberOperationHint( - nexus.GetBinaryOperationFeedback(), &hint)) { + if (BinaryOperationHintToNumberOperationHint(GetBinaryOperationHint(slot), + &hint)) { Node* node = jsgraph()->graph()->NewNode( - jsgraph()->simplified()->SpeculativeToNumber(hint, VectorSlotPair()), + jsgraph()->simplified()->SpeculativeToNumber(hint, FeedbackSource()), input, effect, control); return LoweringResult::SideEffectFree(node, node, control); } @@ -462,10 +461,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceCallOperation( Node* control, FeedbackSlot slot) const { DCHECK(op->opcode() == IrOpcode::kJSCall || op->opcode() == IrOpcode::kJSCallWithSpread); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForCall)) { return LoweringResult::Exit(node); } @@ -477,10 +474,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceConstructOperation( Node* control, FeedbackSlot slot) const { DCHECK(op->opcode() == IrOpcode::kJSConstruct || op->opcode() == IrOpcode::kJSConstructWithSpread); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForConstruct)) { return LoweringResult::Exit(node); } @@ -490,11 +485,11 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceConstructOperation( JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceLoadNamedOperation( const Operator* op, Node* receiver, Node* effect, Node* control, FeedbackSlot slot) const { - DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); + // JSGetIterator involves a named load of the Symbol.iterator property. + DCHECK(op->opcode() == IrOpcode::kJSLoadNamed || + op->opcode() == IrOpcode::kJSGetIterator); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess)) { return LoweringResult::Exit(node); } @@ -505,10 +500,8 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceLoadKeyedOperation( const Operator* op, Node* obj, Node* key, Node* effect, Node* control, FeedbackSlot slot) const { DCHECK_EQ(IrOpcode::kJSLoadProperty, op->opcode()); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForGenericKeyedAccess)) { return LoweringResult::Exit(node); } @@ -522,10 +515,8 @@ JSTypeHintLowering::ReduceStoreNamedOperation(const Operator* op, Node* obj, FeedbackSlot slot) const { DCHECK(op->opcode() == IrOpcode::kJSStoreNamed || op->opcode() == IrOpcode::kJSStoreNamedOwn); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess)) { return LoweringResult::Exit(node); } @@ -538,31 +529,32 @@ JSTypeHintLowering::ReduceStoreKeyedOperation(const Operator* op, Node* obj, Node* effect, Node* control, FeedbackSlot slot) const { DCHECK(op->opcode() == IrOpcode::kJSStoreProperty || - op->opcode() == IrOpcode::kJSStoreInArrayLiteral); - DCHECK(!slot.IsInvalid()); - FeedbackNexus nexus(feedback_vector(), slot); + op->opcode() == IrOpcode::kJSStoreInArrayLiteral || + op->opcode() == IrOpcode::kJSStoreDataPropertyInLiteral); if (Node* node = TryBuildSoftDeopt( - nexus, effect, control, + slot, effect, control, DeoptimizeReason::kInsufficientTypeFeedbackForGenericKeyedAccess)) { return LoweringResult::Exit(node); } return LoweringResult::NoChange(); } -Node* JSTypeHintLowering::TryBuildSoftDeopt(FeedbackNexus& nexus, Node* effect, +Node* JSTypeHintLowering::TryBuildSoftDeopt(FeedbackSlot slot, Node* effect, Node* control, DeoptimizeReason reason) const { - if ((flags() & kBailoutOnUninitialized) && nexus.IsUninitialized()) { - Node* deoptimize = jsgraph()->graph()->NewNode( - jsgraph()->common()->Deoptimize(DeoptimizeKind::kSoft, reason, - VectorSlotPair()), - jsgraph()->Dead(), effect, control); - Node* frame_state = - NodeProperties::FindFrameStateBefore(deoptimize, jsgraph()->Dead()); - deoptimize->ReplaceInput(0, frame_state); - return deoptimize; - } - return nullptr; + if (!(flags() & kBailoutOnUninitialized)) return nullptr; + + FeedbackSource source(feedback_vector(), slot); + if (!broker()->FeedbackIsInsufficient(source)) return nullptr; + + Node* deoptimize = jsgraph()->graph()->NewNode( + jsgraph()->common()->Deoptimize(DeoptimizeKind::kSoft, reason, + FeedbackSource()), + jsgraph()->Dead(), effect, control); + Node* frame_state = + NodeProperties::FindFrameStateBefore(deoptimize, jsgraph()->Dead()); + deoptimize->ReplaceInput(0, frame_state); + return deoptimize; } } // namespace compiler |