Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: src/builtins/x64/builtins-x64.cc

Issue 2803853005: Inline Array.prototype.forEach in TurboFan (Closed)
Patch Set: Disable new array builtins by default Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/x64/builtins-x64.cc
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc
index d4fb131afc79142508d97533d7f82ee3096de2f3..d74e57b0cf8a88b98d58168ec90f2fd5f253f9e3 100644
--- a/src/builtins/x64/builtins-x64.cc
+++ b/src/builtins/x64/builtins-x64.cc
@@ -1425,6 +1425,72 @@ void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
}
+void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) {
+ // Enter an internal frame.
+ {
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ // Preserve possible return result from lazy deopt.
+ __ pushq(rax);
+ __ CallRuntime(Runtime::kNotifyStubFailure, false);
+ __ popq(rax);
+ // Tear down internal frame.
+ }
+
+ __ DropUnderReturnAddress(1); // Ignore state offset
+ __ ret(0); // Return to ContinueToBuiltin stub still on stack.
+}
+
+namespace {
+void Generate_ContinueToBuiltinHelper(MacroAssembler* masm,
+ bool java_script_builtin,
+ bool with_result) {
+ const RegisterConfiguration* config(RegisterConfiguration::Turbofan());
+ int allocatable_register_count = config->num_allocatable_general_registers();
+ if (with_result) {
+ // Overwrite the hole inserted by the deoptimizer with the return value from
+ // the LAZY deopt point.
+ __ movq(Operand(rsp,
+ config->num_allocatable_general_registers() * kPointerSize +
+ BuiltinContinuationFrameConstants::kFixedFrameSize),
+ rax);
+ }
+ for (int i = allocatable_register_count - 1; i >= 0; --i) {
+ int code = config->GetAllocatableGeneralCode(i);
+ __ popq(Register::from_code(code));
+ if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) {
+ __ SmiToInteger32(Register::from_code(code), Register::from_code(code));
+ }
+ }
+ __ movq(
+ rbp,
+ Operand(rsp, BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp));
+ const int offsetToPC =
+ BuiltinContinuationFrameConstants::kFixedFrameSizeFromFp - kPointerSize;
+ __ popq(Operand(rsp, offsetToPC));
+ __ Drop(offsetToPC / kPointerSize);
+ __ addq(Operand(rsp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag));
+ __ Ret();
+}
+} // namespace
+
+void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) {
+ Generate_ContinueToBuiltinHelper(masm, false, false);
+}
+
+void Builtins::Generate_ContinueToCodeStubBuiltinWithResult(
+ MacroAssembler* masm) {
+ Generate_ContinueToBuiltinHelper(masm, false, true);
+}
+
+void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) {
+ Generate_ContinueToBuiltinHelper(masm, true, false);
+}
+
+void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult(
+ MacroAssembler* masm) {
+ Generate_ContinueToBuiltinHelper(masm, true, true);
+}
+
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
Deoptimizer::BailoutType type) {
// Enter an internal frame.
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler/code-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698