Commit 4bc48c21 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [builtins] implement RunMicrotasks pump as a code stub

Port 52ff3ae4

Original Commit Message:

    - Implement RunMicrotasks in CSA to prevent a potentially large number
      of jumps between C++ and JS code while consuming te queue. Appears to
      provide a ~60% speedup in microtask-heavy code, which from limited
      testing appears to scale linearly.

      The code-stub microtask pump bails out to the old C++ microtask pump
      if it encounters a CallHandlerInfo microtask, and remains in C++ for
      the remainder of the queue (returning to the JS/stub implementation
      after the bailed out queue is exhausted).

    - Add a variation of JSEntryStub which enters the new RunMicrotasks code
      stub.

    - Add a new RunMicrotasks helper to Execution, which uses the
      RunMicrotasks entry stub.

R=caitp@igalia.com, joransiu@ca.ibm.com, jbarboza@ca.ibm.com
BUG=
LOG=N

Change-Id: Ifa15ca19312bb92758e82d19c3e3fc0a8b908d82
Reviewed-on: https://chromium-review.googlesource.com/820197Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#50018}
parent e5d1ff25
...@@ -643,8 +643,6 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -643,8 +643,6 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
__ mov(cp, Operand(context_address)); __ mov(cp, Operand(context_address));
__ LoadP(cp, MemOperand(cp)); __ LoadP(cp, MemOperand(cp));
__ InitializeRootRegister();
// Push the function and the receiver onto the stack. // Push the function and the receiver onto the stack.
__ Push(r4, r5); __ Push(r4, r5);
......
...@@ -639,8 +639,6 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, ...@@ -639,8 +639,6 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
__ mov(cp, Operand(context_address)); __ mov(cp, Operand(context_address));
__ LoadP(cp, MemOperand(cp)); __ LoadP(cp, MemOperand(cp));
__ InitializeRootRegister();
// Push the function and the receiver onto the stack. // Push the function and the receiver onto the stack.
__ Push(r3, r4); __ Push(r3, r4);
......
...@@ -489,6 +489,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) { ...@@ -489,6 +489,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
// Set up the reserved register for 0.0. // Set up the reserved register for 0.0.
__ LoadDoubleLiteral(kDoubleRegZero, Double(0.0), r0); __ LoadDoubleLiteral(kDoubleRegZero, Double(0.0), r0);
__ InitializeRootRegister();
// Push a frame with special values setup to mark it as an entry frame. // Push a frame with special values setup to mark it as an entry frame.
// r3: code entry // r3: code entry
// r4: function // r4: function
...@@ -566,12 +568,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) { ...@@ -566,12 +568,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
// r5: receiver // r5: receiver
// r6: argc // r6: argc
// r7: argv // r7: argv
if (type() == StackFrame::CONSTRUCT_ENTRY) { __ Call(EntryTrampoline(), RelocInfo::CODE_TARGET);
__ Call(BUILTIN_CODE(isolate(), JSConstructEntryTrampoline),
RelocInfo::CODE_TARGET);
} else {
__ Call(BUILTIN_CODE(isolate(), JSEntryTrampoline), RelocInfo::CODE_TARGET);
}
// Unlink this frame from the handler chain. // Unlink this frame from the handler chain.
__ PopStackHandler(); __ PopStackHandler();
......
...@@ -495,6 +495,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) { ...@@ -495,6 +495,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
// kCEntryFPAddress // kCEntryFPAddress
// Frame type // Frame type
__ lay(sp, MemOperand(sp, -5 * kPointerSize)); __ lay(sp, MemOperand(sp, -5 * kPointerSize));
// Push a bad frame pointer to fail if it is used. // Push a bad frame pointer to fail if it is used.
__ LoadImmP(r10, Operand(-1)); __ LoadImmP(r10, Operand(-1));
...@@ -512,6 +513,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) { ...@@ -512,6 +513,8 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
__ lay(fp, __ lay(fp,
MemOperand(sp, -EntryFrameConstants::kCallerFPOffset + kPointerSize)); MemOperand(sp, -EntryFrameConstants::kCallerFPOffset + kPointerSize));
__ InitializeRootRegister();
// If this is the outermost JS call, set js_entry_sp value. // If this is the outermost JS call, set js_entry_sp value.
Label non_outermost_js; Label non_outermost_js;
ExternalReference js_entry_sp(IsolateAddressId::kJSEntrySPAddress, isolate()); ExternalReference js_entry_sp(IsolateAddressId::kJSEntrySPAddress, isolate());
...@@ -564,12 +567,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) { ...@@ -564,12 +567,7 @@ void JSEntryStub::Generate(MacroAssembler* masm) {
// r4: receiver // r4: receiver
// r5: argc // r5: argc
// r6: argv // r6: argv
if (type() == StackFrame::CONSTRUCT_ENTRY) { __ Call(EntryTrampoline(), RelocInfo::CODE_TARGET);
__ Call(BUILTIN_CODE(isolate(), JSConstructEntryTrampoline),
RelocInfo::CODE_TARGET);
} else {
__ Call(BUILTIN_CODE(isolate(), JSEntryTrampoline), RelocInfo::CODE_TARGET);
}
// Unlink this frame from the handler chain. // Unlink this frame from the handler chain.
__ PopStackHandler(); __ PopStackHandler();
......
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