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

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

Issue 2103007: Spill arguments for a function call from the virtual frame as they are produc... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 7 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
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/x64/virtual-frame-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 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2794 // arguments. 2794 // arguments.
2795 2795
2796 // Prepare the stack for the call to the resolved function. 2796 // Prepare the stack for the call to the resolved function.
2797 Load(function); 2797 Load(function);
2798 2798
2799 // Allocate a frame slot for the receiver. 2799 // Allocate a frame slot for the receiver.
2800 frame_->Push(Factory::undefined_value()); 2800 frame_->Push(Factory::undefined_value());
2801 int arg_count = args->length(); 2801 int arg_count = args->length();
2802 for (int i = 0; i < arg_count; i++) { 2802 for (int i = 0; i < arg_count; i++) {
2803 Load(args->at(i)); 2803 Load(args->at(i));
2804 frame_->SpillTop();
2804 } 2805 }
2805 2806
2806 // Prepare the stack for the call to ResolvePossiblyDirectEval. 2807 // Prepare the stack for the call to ResolvePossiblyDirectEval.
2807 frame_->PushElementAt(arg_count + 1); 2808 frame_->PushElementAt(arg_count + 1);
2808 if (arg_count > 0) { 2809 if (arg_count > 0) {
2809 frame_->PushElementAt(arg_count); 2810 frame_->PushElementAt(arg_count);
2810 } else { 2811 } else {
2811 frame_->Push(Factory::undefined_value()); 2812 frame_->Push(Factory::undefined_value());
2812 } 2813 }
2813 2814
(...skipping 29 matching lines...) Expand all
2843 2844
2844 // Pass the global object as the receiver and let the IC stub 2845 // Pass the global object as the receiver and let the IC stub
2845 // patch the stack to use the global proxy as 'this' in the 2846 // patch the stack to use the global proxy as 'this' in the
2846 // invoked function. 2847 // invoked function.
2847 LoadGlobal(); 2848 LoadGlobal();
2848 2849
2849 // Load the arguments. 2850 // Load the arguments.
2850 int arg_count = args->length(); 2851 int arg_count = args->length();
2851 for (int i = 0; i < arg_count; i++) { 2852 for (int i = 0; i < arg_count; i++) {
2852 Load(args->at(i)); 2853 Load(args->at(i));
2854 frame_->SpillTop();
2853 } 2855 }
2854 2856
2855 // Push the name of the function on the frame. 2857 // Push the name of the function on the frame.
2856 frame_->Push(var->name()); 2858 frame_->Push(var->name());
2857 2859
2858 // Call the IC initialization code. 2860 // Call the IC initialization code.
2859 CodeForSourcePosition(node->position()); 2861 CodeForSourcePosition(node->position());
2860 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET_CONTEXT, 2862 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET_CONTEXT,
2861 arg_count, 2863 arg_count,
2862 loop_nesting()); 2864 loop_nesting());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 node->position()); 2950 node->position());
2949 2951
2950 } else { 2952 } else {
2951 // Push the receiver onto the frame. 2953 // Push the receiver onto the frame.
2952 Load(property->obj()); 2954 Load(property->obj());
2953 2955
2954 // Load the arguments. 2956 // Load the arguments.
2955 int arg_count = args->length(); 2957 int arg_count = args->length();
2956 for (int i = 0; i < arg_count; i++) { 2958 for (int i = 0; i < arg_count; i++) {
2957 Load(args->at(i)); 2959 Load(args->at(i));
2960 frame_->SpillTop();
2958 } 2961 }
2959 2962
2960 // Push the name of the function onto the frame. 2963 // Push the name of the function onto the frame.
2961 frame_->Push(name); 2964 frame_->Push(name);
2962 2965
2963 // Call the IC initialization code. 2966 // Call the IC initialization code.
2964 CodeForSourcePosition(node->position()); 2967 CodeForSourcePosition(node->position());
2965 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET, 2968 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET,
2966 arg_count, 2969 arg_count,
2967 loop_nesting()); 2970 loop_nesting());
(...skipping 5925 matching lines...) Expand 10 before | Expand all | Expand 10 after
8893 8896
8894 // Call the function just below TOS on the stack with the given 8897 // Call the function just below TOS on the stack with the given
8895 // arguments. The receiver is the TOS. 8898 // arguments. The receiver is the TOS.
8896 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, 8899 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args,
8897 CallFunctionFlags flags, 8900 CallFunctionFlags flags,
8898 int position) { 8901 int position) {
8899 // Push the arguments ("left-to-right") on the stack. 8902 // Push the arguments ("left-to-right") on the stack.
8900 int arg_count = args->length(); 8903 int arg_count = args->length();
8901 for (int i = 0; i < arg_count; i++) { 8904 for (int i = 0; i < arg_count; i++) {
8902 Load(args->at(i)); 8905 Load(args->at(i));
8906 frame_->SpillTop();
8903 } 8907 }
8904 8908
8905 // Record the position for debugging purposes. 8909 // Record the position for debugging purposes.
8906 CodeForSourcePosition(position); 8910 CodeForSourcePosition(position);
8907 8911
8908 // Use the shared code stub to call the function. 8912 // Use the shared code stub to call the function.
8909 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; 8913 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
8910 CallFunctionStub call_function(arg_count, in_loop, flags); 8914 CallFunctionStub call_function(arg_count, in_loop, flags);
8911 Result answer = frame_->CallStub(&call_function, arg_count + 1); 8915 Result answer = frame_->CallStub(&call_function, arg_count + 1);
8912 // Restore context and replace function on the stack with the 8916 // Restore context and replace function on the stack with the
(...skipping 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after
11586 } 11590 }
11587 11591
11588 #endif 11592 #endif
11589 11593
11590 11594
11591 #undef __ 11595 #undef __
11592 11596
11593 } } // namespace v8::internal 11597 } } // namespace v8::internal
11594 11598
11595 #endif // V8_TARGET_ARCH_X64 11599 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.h ('k') | src/x64/virtual-frame-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698