Commit 83a0af55 authored by mvstanton's avatar mvstanton Committed by Commit bot

VectorICs: built-in function apply should use an IC.

Handled a TODO that sent builtin function apply to the runtime on property get.

R=yangguo@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1120613002

Cr-Commit-Position: refs/heads/master@{#28165}
parent 81afc931
...@@ -1731,18 +1731,6 @@ void Genesis::InitializeGlobal_harmony_reflect() { ...@@ -1731,18 +1731,6 @@ void Genesis::InitializeGlobal_harmony_reflect() {
Handle<JSFunction> construct = InstallFunction( Handle<JSFunction> construct = InstallFunction(
builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize, builtins, "$reflectConstruct", JS_OBJECT_TYPE, JSObject::kHeaderSize,
MaybeHandle<JSObject>(), Builtins::kReflectConstruct); MaybeHandle<JSObject>(), Builtins::kReflectConstruct);
if (FLAG_vector_ics) {
// Apply embeds an IC, so we need a type vector of size 1 in the shared
// function info.
FeedbackVectorSpec spec(0, Code::CALL_IC);
Handle<TypeFeedbackVector> feedback_vector =
factory()->NewTypeFeedbackVector(&spec);
apply->shared()->set_feedback_vector(*feedback_vector);
feedback_vector = factory()->NewTypeFeedbackVector(&spec);
construct->shared()->set_feedback_vector(*feedback_vector);
}
apply->shared()->set_internal_formal_parameter_count(3); apply->shared()->set_internal_formal_parameter_count(3);
apply->shared()->set_length(3); apply->shared()->set_length(3);
...@@ -2181,14 +2169,6 @@ bool Genesis::InstallNatives() { ...@@ -2181,14 +2169,6 @@ bool Genesis::InstallNatives() {
Handle<JSFunction> apply = Handle<JSFunction> apply =
InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize, InstallFunction(proto, "apply", JS_OBJECT_TYPE, JSObject::kHeaderSize,
MaybeHandle<JSObject>(), Builtins::kFunctionApply); MaybeHandle<JSObject>(), Builtins::kFunctionApply);
if (FLAG_vector_ics) {
// Apply embeds an IC, so we need a type vector of size 1 in the shared
// function info.
FeedbackVectorSpec spec(0, Code::CALL_IC);
Handle<TypeFeedbackVector> feedback_vector =
factory()->NewTypeFeedbackVector(&spec);
apply->shared()->set_feedback_vector(*feedback_vector);
}
// Make sure that Function.prototype.call appears to be compiled. // Make sure that Function.prototype.call appears to be compiled.
// The code will never be called, but inline caching for call will // The code will never be called, but inline caching for call will
......
...@@ -1057,21 +1057,13 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm, ...@@ -1057,21 +1057,13 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ bind(&loop); __ bind(&loop);
__ mov(receiver, Operand(ebp, argumentsOffset)); // load arguments __ mov(receiver, Operand(ebp, argumentsOffset)); // load arguments
if (FLAG_vector_ics) {
// TODO(mvstanton): Vector-based ics need additional infrastructure to
// be embedded here. For now, just call the runtime.
__ push(receiver);
__ push(key);
__ CallRuntime(Runtime::kGetProperty, 2);
} else {
// Use inline caching to speed up access to arguments. // Use inline caching to speed up access to arguments.
Handle<Code> ic = CodeFactory::KeyedLoadIC(masm->isolate()).code(); Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
__ call(ic, RelocInfo::CODE_TARGET); __ call(ic, RelocInfo::CODE_TARGET);
// It is important that we do not have a test instruction after the // It is important that we do not have a test instruction after the
// call. A test instruction after the call is used to indicate that // call. A test instruction after the call is used to indicate that
// we have generated an inline version of the keyed load. In this // we have generated an inline version of the keyed load. In this
// case, we know that we are not generating a test instruction next. // case, we know that we are not generating a test instruction next.
}
// Push the nth argument. // Push the nth argument.
__ push(eax); __ push(eax);
......
...@@ -1122,20 +1122,12 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm, ...@@ -1122,20 +1122,12 @@ static void Generate_PushAppliedArguments(MacroAssembler* masm,
__ movp(receiver, Operand(rbp, argumentsOffset)); // load arguments __ movp(receiver, Operand(rbp, argumentsOffset)); // load arguments
// Use inline caching to speed up access to arguments. // Use inline caching to speed up access to arguments.
if (FLAG_vector_ics) { Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Megamorphic();
// TODO(mvstanton): Vector-based ics need additional infrastructure to
// be embedded here. For now, just call the runtime.
__ Push(receiver);
__ Push(key);
__ CallRuntime(Runtime::kGetProperty, 2);
} else {
Handle<Code> ic = CodeFactory::KeyedLoadIC(masm->isolate()).code();
__ Call(ic, RelocInfo::CODE_TARGET); __ Call(ic, RelocInfo::CODE_TARGET);
// It is important that we do not have a test instruction after the // It is important that we do not have a test instruction after the
// call. A test instruction after the call is used to indicate that // call. A test instruction after the call is used to indicate that
// we have generated an inline version of the keyed load. In this // we have generated an inline version of the keyed load. In this
// case, we know that we are not generating a test instruction next. // case, we know that we are not generating a test instruction next.
}
// Push the nth argument. // Push the nth argument.
__ Push(rax); __ Push(rax);
......
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