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

Side by Side Diff: src/x64/virtual-frame-x64.cc

Issue 598072: Direct call C++ functions (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« src/runtime.h ('K') | « src/x64/stub-cache-x64.cc ('k') | no next file » | 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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 RelocInfo::Mode rmode) { 969 RelocInfo::Mode rmode) {
970 ASSERT(cgen()->HasValidEntryRegisters()); 970 ASSERT(cgen()->HasValidEntryRegisters());
971 __ Call(code, rmode); 971 __ Call(code, rmode);
972 Result result = cgen()->allocator()->Allocate(rax); 972 Result result = cgen()->allocator()->Allocate(rax);
973 ASSERT(result.is_valid()); 973 ASSERT(result.is_valid());
974 return result; 974 return result;
975 } 975 }
976 976
977 977
978 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) { 978 Result VirtualFrame::CallRuntime(Runtime::Function* f, int arg_count) {
979 PrepareForCall(arg_count, arg_count); 979 if (Runtime::DIRECT_CALL_NOT_FAILS == f->calling_convention) {
980 ASSERT(cgen()->HasValidEntryRegisters()); 980 ASSERT(height() >= arg_count);
981 __ CallRuntime(f, arg_count); 981 if (arg_count > kCArgRegsCount) {
982 Forget(arg_count);
983 return Result(Factory::undefined_value());
984 }
985
986 for (int i = arg_count - 1; i >= 0; i--) {
987 Result arg = Pop();
988 Register reg = kCArgRegs[i];
989 if (RegisterAllocator::IsReserved(reg)) {
990 arg.ToRegister();
991 __ movq(reg, arg.reg());
992 arg.Unuse();
993 } else {
994 arg.ToRegister(reg);
995 arg.Unuse();
996 }
997 }
998
999 // TODO(serya): do not spill out C callee saved registers
1000 PrepareForCall(0, 0);
1001
1002 ASSERT(cgen()->HasValidEntryRegisters());
1003 __ CallRuntime(f, arg_count);
1004 if ((1 << rsi.code()) & kCCallerSaved) {
1005 RestoreContextRegister();
1006 }
1007 } else {
1008 ASSERT(Runtime::EXIT_FRAME_CALL == f->calling_convention);
1009 PrepareForCall(arg_count, arg_count);
1010 ASSERT(cgen()->HasValidEntryRegisters());
1011 __ CallRuntime(f, arg_count);
1012 }
1013
982 Result result = cgen()->allocator()->Allocate(rax); 1014 Result result = cgen()->allocator()->Allocate(rax);
983 ASSERT(result.is_valid()); 1015 ASSERT(result.is_valid());
984 return result; 1016 return result;
985 } 1017 }
986 1018
987 1019
988 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) { 1020 Result VirtualFrame::CallRuntime(Runtime::FunctionId id, int arg_count) {
989 PrepareForCall(arg_count, arg_count); 1021 return CallRuntime(Runtime::FunctionForId(id), arg_count);
990 ASSERT(cgen()->HasValidEntryRegisters());
991 __ CallRuntime(id, arg_count);
992 Result result = cgen()->allocator()->Allocate(rax);
993 ASSERT(result.is_valid());
994 return result;
995 } 1022 }
996 1023
997 1024
998 #ifdef ENABLE_DEBUGGER_SUPPORT 1025 #ifdef ENABLE_DEBUGGER_SUPPORT
999 void VirtualFrame::DebugBreak() { 1026 void VirtualFrame::DebugBreak() {
1000 PrepareForCall(0, 0); 1027 PrepareForCall(0, 0);
1001 ASSERT(cgen()->HasValidEntryRegisters()); 1028 ASSERT(cgen()->HasValidEntryRegisters());
1002 __ DebugBreak(); 1029 __ DebugBreak();
1003 Result result = cgen()->allocator()->Allocate(rax); 1030 Result result = cgen()->allocator()->Allocate(rax);
1004 ASSERT(result.is_valid()); 1031 ASSERT(result.is_valid());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 // Grow the expression stack by handler size less one (the return 1160 // Grow the expression stack by handler size less one (the return
1134 // address is already pushed by a call instruction). 1161 // address is already pushed by a call instruction).
1135 Adjust(kHandlerSize - 1); 1162 Adjust(kHandlerSize - 1);
1136 __ PushTryHandler(IN_JAVASCRIPT, type); 1163 __ PushTryHandler(IN_JAVASCRIPT, type);
1137 } 1164 }
1138 1165
1139 1166
1140 #undef __ 1167 #undef __
1141 1168
1142 } } // namespace v8::internal 1169 } } // namespace v8::internal
OLDNEW
« src/runtime.h ('K') | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698