Commit bd185e99 authored by bmeurer's avatar bmeurer Committed by Commit Bot

[ignition] Slightly improve code for Call/Construct bytecodes.

The Construct bytecode is always passed a valid feedback slot (just like
the Call bytecode), so no need to check for invalid feedback slot anymore.
Also perform the call count increment initially for both bytecodes instead
of delaying it, which decreases live range for the feedback vector and slot
registers.

R=mythria@chromium.org, rmcilroy@chromium.org
BUG=v8:4280

Review-Url: https://codereview.chromium.org/2955063002
Cr-Commit-Position: refs/heads/master@{#46232}
parent 4ea4e729
......@@ -587,6 +587,9 @@ Node* InterpreterAssembler::CallJSWithFeedback(
Label call_function(this), extra_checks(this, Label::kDeferred), call(this),
end(this);
// Increment the call count.
IncrementCallCount(feedback_vector, slot_id);
// The checks. First, does function match the recorded monomorphic target?
Node* feedback_element = LoadFixedArrayElement(feedback_vector, slot_id);
Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element);
......@@ -600,9 +603,6 @@ Node* InterpreterAssembler::CallJSWithFeedback(
BIND(&call_function);
{
// Increment the call count.
IncrementCallCount(feedback_vector, slot_id);
// Call using call function builtin.
Callable callable = CodeFactory::InterpreterPushArgsThenCall(
isolate(), receiver_mode, tail_call_mode,
......@@ -640,9 +640,6 @@ Node* InterpreterAssembler::CallJSWithFeedback(
Node* is_array_function = WordEqual(context_slot, function);
GotoIfNot(is_array_function, &mark_megamorphic);
// It is a monomorphic Array function. Increment the call count.
IncrementCallCount(feedback_vector, slot_id);
// Call ArrayConstructorStub.
Callable callable_call =
CodeFactory::InterpreterPushArgsThenConstructArray(isolate());
......@@ -723,10 +720,7 @@ Node* InterpreterAssembler::CallJSWithFeedback(
BIND(&call);
{
Comment("Increment call count and call using Call builtin");
// Increment the call count.
IncrementCallCount(feedback_vector, slot_id);
Comment("invoke using Call builtin");
// Call using call builtin.
Callable callable_call = CodeFactory::InterpreterPushArgsThenCall(
isolate(), receiver_mode, tail_call_mode,
......@@ -782,10 +776,8 @@ Node* InterpreterAssembler::Construct(Node* constructor, Node* context,
Label call_construct_function(this, &allocation_feedback),
extra_checks(this, Label::kDeferred), call_construct(this), end(this);
// Slot id of 0 is used to indicate no type feedback is available.
STATIC_ASSERT(FeedbackVector::kReservedIndexCount > 0);
Node* is_feedback_unavailable = WordEqual(slot_id, IntPtrConstant(0));
GotoIf(is_feedback_unavailable, &call_construct);
// Increment the call count.
IncrementCallCount(feedback_vector, slot_id);
// Check that the constructor is not a smi.
Node* is_smi = TaggedIsSmi(constructor);
......@@ -806,8 +798,7 @@ Node* InterpreterAssembler::Construct(Node* constructor, Node* context,
BIND(&call_construct_function);
{
Comment("call using ConstructFunction");
IncrementCallCount(feedback_vector, slot_id);
Comment("construct using ConstructFunction");
Callable callable_function = CodeFactory::InterpreterPushArgsThenConstruct(
isolate(), InterpreterPushArgsMode::kJSFunction);
return_value.Bind(CallStub(callable_function.descriptor(),
......
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