Commit e0c851fc authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Turboprop] Avoid passing unnecessary args to DyanmicMapChecks builtin

The feedback vector can be retrieved from the callee's frame, and the
actual_map can be read from the actual_value, so avoid passing these
explicitly to the DynamicMapChecks builtin. This reduces the size of
each DynamicMapCheck codegen by around 20 bytes on x64.

BUG=v8:9684

Change-Id: I31cf9b8cf085284ac051ebafc86f3e26105f3046
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2485813
Auto-Submit: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70629}
parent 4068b3d2
......@@ -11,6 +11,7 @@ const kBailout: constexpr int32
const kDeopt: constexpr int32
generates 'static_cast<int>(DynamicMapChecksStatus::kDeopt)';
extern runtime TryMigrateInstance(implicit context: Context)(Object): Object;
extern macro LoadFeedbackVectorForStub(): FeedbackVector;
macro PerformMapAndHandlerCheck(
entry: constexpr int32, polymorphicArray: WeakFixedArray,
......@@ -123,8 +124,10 @@ macro PerformMonomorphicCheck(
//
// For other cases, we bailout to the runtime.
builtin DynamicMapChecks(implicit context: Context)(
feedbackVector: FeedbackVector, slotIndex: intptr, actualValue: HeapObject,
actualMap: Map, actualHandler: Smi|DataHandler): int32 {
slotIndex: intptr, actualValue: HeapObject,
actualHandler: Smi|DataHandler): int32 {
const feedbackVector = LoadFeedbackVectorForStub();
let actualMap = actualValue.map;
const feedback = feedbackVector[slotIndex];
try {
const maybePolymorphicArray =
......@@ -132,7 +135,6 @@ builtin DynamicMapChecks(implicit context: Context)(
return PerformPolymorphicCheck(
maybePolymorphicArray, actualMap, actualHandler);
} label MigrateAndDoMonomorphicCheck {
let newActualMap = actualMap;
if (IsDeprecatedMap(actualMap)) {
// TODO(gsathya): Should this migration happen before the
// polymorphic check?
......@@ -140,10 +142,10 @@ builtin DynamicMapChecks(implicit context: Context)(
if (TaggedIsSmi(result)) {
return kDeopt;
}
newActualMap = actualValue.map;
actualMap = actualValue.map;
}
return PerformMonomorphicCheck(
feedbackVector, slotIndex, feedback, newActualMap, actualHandler);
feedbackVector, slotIndex, feedback, actualMap, actualHandler);
}
}
......
......@@ -1991,7 +1991,6 @@ void EffectControlLinearizer::LowerDynamicCheckMaps(Node* node,
Node* actual_value = node->InputAt(0);
FeedbackSource const& feedback = p.feedback();
Node* feedback_vector = __ HeapConstant(feedback.vector);
Node* actual_value_map = __ LoadField(AccessBuilder::ForMap(), actual_value);
Node* actual_handler =
p.handler()->IsSmi()
......@@ -2014,9 +2013,8 @@ void EffectControlLinearizer::LowerDynamicCheckMaps(Node* node,
Node* slot_index = __ IntPtrConstant(feedback.index());
Operator::Properties properties = Operator::kNoDeopt | Operator::kNoThrow;
auto builtin = Builtins::kDynamicMapChecks;
Node* result =
CallBuiltin(builtin, properties, feedback_vector, slot_index,
actual_value, actual_value_map, actual_handler);
Node* result = CallBuiltin(builtin, properties, slot_index, actual_value,
actual_handler);
__ GotoIf(__ WordEqual(result, __ IntPtrConstant(static_cast<int>(
DynamicMapChecksStatus::kSuccess))),
&done);
......@@ -2035,6 +2033,7 @@ void EffectControlLinearizer::LowerDynamicCheckMaps(Node* node,
}
} else {
DCHECK_EQ(p.state(), DynamicCheckMapsParameters::kPolymorphic);
Node* feedback_vector = __ HeapConstant(feedback.vector);
Node* feedback_slot =
__ LoadField(AccessBuilder::ForFeedbackVectorSlot(feedback.index()),
feedback_vector);
......
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