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

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

Issue 2497523002: [promises] Move promise constructor to TFS (Closed)
Patch Set: fixees Created 4 years, 1 month 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
Index: src/builtins/x64/builtins-x64.cc
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc
index 21071017c5299a0d63c8050681ec155def7b3986..f6e33dfe4ed37b4786aa957cad3a8d8523b7697d 100644
--- a/src/builtins/x64/builtins-x64.cc
+++ b/src/builtins/x64/builtins-x64.cc
@@ -2839,6 +2839,59 @@ void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
}
// static
+void Builtins::Generate_PromiseConstructorHelper(MacroAssembler* masm) {
Benedikt Meurer 2016/11/22 06:03:28 Unless I'm missing something, this is 100% identic
+ // ----------- S t a t e -------------
+ // -- rax: number of arguments
+ // -- rsi: context
+ // -- rdi: constructor function
+ // -- rdx: new target
+ // -----------------------------------
+
+ // Enter a construct frame.
+ {
+ FrameScope scope(masm, StackFrame::CONSTRUCT);
+
+ // Preserve the incoming parameters on the stack.
+ __ Integer32ToSmi(rcx, rax);
+ __ Push(rsi);
+ __ Push(rcx);
+ __ PushRoot(Heap::kTheHoleValueRootIndex);
+
+ // Set up pointer to last argument.
+ __ leap(rbx, Operand(rbp, StandardFrameConstants::kCallerSPOffset));
+
+ // Copy arguments and receiver to the expression stack.
+ Label loop, entry;
+ __ movp(rcx, rax);
+ __ jmp(&entry);
+ __ bind(&loop);
+ __ Push(Operand(rbx, rcx, times_pointer_size, 0));
+ __ bind(&entry);
+ __ decp(rcx);
+ __ j(greater_equal, &loop);
+
+ // Call the function.
+ ParameterCount actual(rax);
+ __ InvokeFunction(rdi, rdx, actual, CALL_FUNCTION,
+ CheckDebugStepCallWrapper());
+
+ // Restore context from the frame.
+ __ movp(rsi, Operand(rbp, ConstructFrameConstants::kContextOffset));
+
+ __ movp(rbx, Operand(rsp, 0));
+
+ // Leave construct frame.
+ }
+
+ // Remove caller arguments from the stack and return.
+ __ PopReturnAddressTo(rcx);
+ SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
+ __ leap(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
+ __ PushReturnAddressFrom(rcx);
+ __ ret(0);
+}
+
+// static
void Builtins::Generate_Construct(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- rax : the number of arguments (not including the receiver)

Powered by Google App Engine
This is Rietveld 408576698