Commit 4c0ad049 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [es6] Faster implementation of OrdinaryHasInstance.

  port b6419fa2 (r34959)

  original commit message:
  Now implemented as a builtin that delegates to the InstanceOfStub. That
  stub was parameterized to fallback to either Runtime_InstanceOf or to
  Runtime_OrdinaryHasInstance depending on the --harmony-instanceof flag.
  Once the feature stabilizes and the flag is no longer needed, we can get
  rid of this parameterization again.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34975}
parent 400f6c50
......@@ -957,6 +957,28 @@ void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
}
}
// static
void Builtins::Generate_FunctionHasInstance(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc
// -- esp[0] : return address
// -- esp[4] : first argument (left-hand side)
// -- esp[8] : receiver (right-hand side)
// -----------------------------------
{
FrameScope scope(masm, StackFrame::INTERNAL);
__ mov(InstanceOfDescriptor::LeftRegister(),
Operand(ebp, 2 * kPointerSize)); // Load left-hand side.
__ mov(InstanceOfDescriptor::RightRegister(),
Operand(ebp, 3 * kPointerSize)); // Load right-hand side.
InstanceOfStub stub(masm->isolate(), true);
__ CallStub(&stub);
}
// Pop the argument and the receiver.
__ ret(2 * kPointerSize);
}
// static
void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
......@@ -1145,7 +1167,6 @@ void Builtins::Generate_ReflectApply(MacroAssembler* masm) {
}
}
void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- eax : argc
......
......@@ -1910,7 +1910,8 @@ void InstanceOfStub::Generate(MacroAssembler* masm) {
__ Push(object);
__ Push(function);
__ PushReturnAddressFrom(scratch);
__ TailCallRuntime(Runtime::kInstanceOf);
__ TailCallRuntime(is_es6_instanceof() ? Runtime::kOrdinaryHasInstance
: Runtime::kInstanceOf);
}
......
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