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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 8318014: Make _CallFunction proxy-aware. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Kevin's comment. Created 9 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/x64/debug-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 ZoneList<Expression*>* args = expr->arguments(); 1999 ZoneList<Expression*>* args = expr->arguments();
2000 int arg_count = args->length(); 2000 int arg_count = args->length();
2001 { PreservePositionScope scope(masm()->positions_recorder()); 2001 { PreservePositionScope scope(masm()->positions_recorder());
2002 for (int i = 0; i < arg_count; i++) { 2002 for (int i = 0; i < arg_count; i++) {
2003 VisitForStackValue(args->at(i)); 2003 VisitForStackValue(args->at(i));
2004 } 2004 }
2005 } 2005 }
2006 // Record source position for debugger. 2006 // Record source position for debugger.
2007 SetSourcePosition(expr->position()); 2007 SetSourcePosition(expr->position());
2008 CallFunctionStub stub(arg_count, flags); 2008 CallFunctionStub stub(arg_count, flags);
2009 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
2009 __ CallStub(&stub); 2010 __ CallStub(&stub);
2010 RecordJSReturnSite(expr); 2011 RecordJSReturnSite(expr);
2011 // Restore context register. 2012 // Restore context register.
2012 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2013 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2013 // Discard the function left on TOS. 2014 // Discard the function left on TOS.
2014 context()->DropAndPlug(1, rax); 2015 context()->DropAndPlug(1, rax);
2015 } 2016 }
2016 2017
2017 2018
2018 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, 2019 void FullCodeGenerator::EmitResolvePossiblyDirectEval(ResolveEvalFlag flag,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 __ bind(&done); 2090 __ bind(&done);
2090 2091
2091 // The runtime call returns a pair of values in rax (function) and 2092 // The runtime call returns a pair of values in rax (function) and
2092 // rdx (receiver). Touch up the stack with the right values. 2093 // rdx (receiver). Touch up the stack with the right values.
2093 __ movq(Operand(rsp, (arg_count + 0) * kPointerSize), rdx); 2094 __ movq(Operand(rsp, (arg_count + 0) * kPointerSize), rdx);
2094 __ movq(Operand(rsp, (arg_count + 1) * kPointerSize), rax); 2095 __ movq(Operand(rsp, (arg_count + 1) * kPointerSize), rax);
2095 } 2096 }
2096 // Record source position for debugger. 2097 // Record source position for debugger.
2097 SetSourcePosition(expr->position()); 2098 SetSourcePosition(expr->position());
2098 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); 2099 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT);
2100 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
2099 __ CallStub(&stub); 2101 __ CallStub(&stub);
2100 RecordJSReturnSite(expr); 2102 RecordJSReturnSite(expr);
2101 // Restore context register. 2103 // Restore context register.
2102 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2104 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2103 context()->DropAndPlug(1, rax); 2105 context()->DropAndPlug(1, rax);
2104 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { 2106 } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
2105 // Call to a global variable. Push global object as receiver for the 2107 // Call to a global variable. Push global object as receiver for the
2106 // call IC lookup. 2108 // call IC lookup.
2107 __ push(GlobalObjectOperand()); 2109 __ push(GlobalObjectOperand());
2108 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT); 2110 EmitCallWithIC(expr, proxy->name(), RelocInfo::CODE_TARGET_CONTEXT);
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 2956
2955 void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) { 2957 void FullCodeGenerator::EmitCallFunction(ZoneList<Expression*>* args) {
2956 ASSERT(args->length() >= 2); 2958 ASSERT(args->length() >= 2);
2957 2959
2958 int arg_count = args->length() - 2; // 2 ~ receiver and function. 2960 int arg_count = args->length() - 2; // 2 ~ receiver and function.
2959 for (int i = 0; i < arg_count + 1; i++) { 2961 for (int i = 0; i < arg_count + 1; i++) {
2960 VisitForStackValue(args->at(i)); 2962 VisitForStackValue(args->at(i));
2961 } 2963 }
2962 VisitForAccumulatorValue(args->last()); // Function. 2964 VisitForAccumulatorValue(args->last()); // Function.
2963 2965
2966 // Check for proxy.
2967 Label proxy, done;
2968 __ CmpObjectType(rax, JS_FUNCTION_PROXY_TYPE, rbx);
2969 __ j(equal, &proxy);
2970
2964 // InvokeFunction requires the function in rdi. Move it in there. 2971 // InvokeFunction requires the function in rdi. Move it in there.
2965 __ movq(rdi, result_register()); 2972 __ movq(rdi, result_register());
2966 ParameterCount count(arg_count); 2973 ParameterCount count(arg_count);
2967 __ InvokeFunction(rdi, count, CALL_FUNCTION, 2974 __ InvokeFunction(rdi, count, CALL_FUNCTION,
2968 NullCallWrapper(), CALL_AS_METHOD); 2975 NullCallWrapper(), CALL_AS_METHOD);
2969 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2976 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2977 __ jmp(&done);
2978
2979 __ bind(&proxy);
2980 __ push(rax);
2981 __ CallRuntime(Runtime::kCall, args->length());
2982 __ bind(&done);
2983
2970 context()->Plug(rax); 2984 context()->Plug(rax);
2971 } 2985 }
2972 2986
2973 2987
2974 void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) { 2988 void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) {
2975 RegExpConstructResultStub stub; 2989 RegExpConstructResultStub stub;
2976 ASSERT(args->length() == 3); 2990 ASSERT(args->length() == 3);
2977 VisitForStackValue(args->at(0)); 2991 VisitForStackValue(args->at(0));
2978 VisitForStackValue(args->at(1)); 2992 VisitForStackValue(args->at(1));
2979 VisitForStackValue(args->at(2)); 2993 VisitForStackValue(args->at(2));
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
4187 *context_length = 0; 4201 *context_length = 0;
4188 return previous_; 4202 return previous_;
4189 } 4203 }
4190 4204
4191 4205
4192 #undef __ 4206 #undef __
4193 4207
4194 } } // namespace v8::internal 4208 } } // namespace v8::internal
4195 4209
4196 #endif // V8_TARGET_ARCH_X64 4210 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/debug-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698