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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 5004004: Port direct API function call to x64 (ia32 CL is http://codereview.chromium.o... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 ExternalReference::heap_always_allocate_scope_depth(); 2528 ExternalReference::heap_always_allocate_scope_depth();
2529 if (always_allocate_scope) { 2529 if (always_allocate_scope) {
2530 __ movq(kScratchRegister, scope_depth); 2530 __ movq(kScratchRegister, scope_depth);
2531 __ incl(Operand(kScratchRegister, 0)); 2531 __ incl(Operand(kScratchRegister, 0));
2532 } 2532 }
2533 2533
2534 // Call C function. 2534 // Call C function.
2535 #ifdef _WIN64 2535 #ifdef _WIN64
2536 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9 2536 // Windows 64-bit ABI passes arguments in rcx, rdx, r8, r9
2537 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots. 2537 // Store Arguments object on stack, below the 4 WIN64 ABI parameter slots.
2538 __ movq(Operand(rsp, 4 * kPointerSize), r14); // argc. 2538 __ movq(StackSpaceOperand(0), r14); // argc.
2539 __ movq(Operand(rsp, 5 * kPointerSize), r12); // argv. 2539 __ movq(StackSpaceOperand(1), r12); // argv.
2540 if (result_size_ < 2) { 2540 if (result_size_ < 2) {
2541 // Pass a pointer to the Arguments object as the first argument. 2541 // Pass a pointer to the Arguments object as the first argument.
2542 // Return result in single register (rax). 2542 // Return result in single register (rax).
2543 __ lea(rcx, Operand(rsp, 4 * kPointerSize)); 2543 __ lea(rcx, StackSpaceOperand(0));
2544 } else { 2544 } else {
2545 ASSERT_EQ(2, result_size_); 2545 ASSERT_EQ(2, result_size_);
2546 // Pass a pointer to the result location as the first argument. 2546 // Pass a pointer to the result location as the first argument.
2547 __ lea(rcx, Operand(rsp, 6 * kPointerSize)); 2547 __ lea(rcx, StackSpaceOperand(2));
2548 // Pass a pointer to the Arguments object as the second argument. 2548 // Pass a pointer to the Arguments object as the second argument.
2549 __ lea(rdx, Operand(rsp, 4 * kPointerSize)); 2549 __ lea(rdx, StackSpaceOperand(0));
2550 } 2550 }
2551 2551
2552 #else // _WIN64 2552 #else // _WIN64
2553 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9. 2553 // GCC passes arguments in rdi, rsi, rdx, rcx, r8, r9.
2554 __ movq(rdi, r14); // argc. 2554 __ movq(rdi, r14); // argc.
2555 __ movq(rsi, r12); // argv. 2555 __ movq(rsi, r12); // argv.
2556 #endif 2556 #endif
2557 __ call(rbx); 2557 __ call(rbx);
2558 // Result is in rax - do not destroy this register! 2558 // Result is in rax - do not destroy this register!
2559 2559
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 // rbp: frame pointer of calling JS frame (restored after C call) 2679 // rbp: frame pointer of calling JS frame (restored after C call)
2680 // rsp: stack pointer (restored after C call) 2680 // rsp: stack pointer (restored after C call)
2681 // rsi: current context (restored) 2681 // rsi: current context (restored)
2682 2682
2683 // NOTE: Invocations of builtins may return failure objects 2683 // NOTE: Invocations of builtins may return failure objects
2684 // instead of a proper result. The builtin entry handles 2684 // instead of a proper result. The builtin entry handles
2685 // this by performing a garbage collection and retrying the 2685 // this by performing a garbage collection and retrying the
2686 // builtin once. 2686 // builtin once.
2687 2687
2688 // Enter the exit frame that transitions from JavaScript to C++. 2688 // Enter the exit frame that transitions from JavaScript to C++.
2689 __ EnterExitFrame(result_size_); 2689 #ifdef _WIN64
2690 int arg_stack_space = (result_size_ < 2 ? 2 : 4);
2691 #else
2692 int arg_stack_space = 0;
2693 #endif
2694 __ EnterExitFrame(arg_stack_space);
2690 2695
2691 // rax: Holds the context at this point, but should not be used. 2696 // rax: Holds the context at this point, but should not be used.
2692 // On entry to code generated by GenerateCore, it must hold 2697 // On entry to code generated by GenerateCore, it must hold
2693 // a failure result if the collect_garbage argument to GenerateCore 2698 // a failure result if the collect_garbage argument to GenerateCore
2694 // is true. This failure result can be the result of code 2699 // is true. This failure result can be the result of code
2695 // generated by a previous call to GenerateCore. The value 2700 // generated by a previous call to GenerateCore. The value
2696 // of rax is then passed to Runtime::PerformGC. 2701 // of rax is then passed to Runtime::PerformGC.
2697 // rbx: pointer to builtin function (C callee-saved). 2702 // rbx: pointer to builtin function (C callee-saved).
2698 // rbp: frame pointer of exit frame (restored after C call). 2703 // rbp: frame pointer of exit frame (restored after C call).
2699 // rsp: stack pointer (restored after C call). 2704 // rsp: stack pointer (restored after C call).
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
3978 // tagged as a small integer. 3983 // tagged as a small integer.
3979 __ bind(&runtime); 3984 __ bind(&runtime);
3980 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3985 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3981 } 3986 }
3982 3987
3983 #undef __ 3988 #undef __
3984 3989
3985 } } // namespace v8::internal 3990 } } // namespace v8::internal
3986 3991
3987 #endif // V8_TARGET_ARCH_X64 3992 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698