OLD | NEW |
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 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 | 2974 |
2975 // Call the function just below TOS on the stack with the given | 2975 // Call the function just below TOS on the stack with the given |
2976 // arguments. The receiver is the TOS. | 2976 // arguments. The receiver is the TOS. |
2977 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, | 2977 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, |
2978 CallFunctionFlags flags, | 2978 CallFunctionFlags flags, |
2979 int position) { | 2979 int position) { |
2980 // Push the arguments ("left-to-right") on the stack. | 2980 // Push the arguments ("left-to-right") on the stack. |
2981 int arg_count = args->length(); | 2981 int arg_count = args->length(); |
2982 for (int i = 0; i < arg_count; i++) { | 2982 for (int i = 0; i < arg_count; i++) { |
2983 Load(args->at(i)); | 2983 Load(args->at(i)); |
| 2984 frame_->SpillTop(); |
2984 } | 2985 } |
2985 | 2986 |
2986 // Record the position for debugging purposes. | 2987 // Record the position for debugging purposes. |
2987 CodeForSourcePosition(position); | 2988 CodeForSourcePosition(position); |
2988 | 2989 |
2989 // Use the shared code stub to call the function. | 2990 // Use the shared code stub to call the function. |
2990 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; | 2991 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; |
2991 CallFunctionStub call_function(arg_count, in_loop, flags); | 2992 CallFunctionStub call_function(arg_count, in_loop, flags); |
2992 Result answer = frame_->CallStub(&call_function, arg_count + 1); | 2993 Result answer = frame_->CallStub(&call_function, arg_count + 1); |
2993 // Restore context and replace function on the stack with the | 2994 // Restore context and replace function on the stack with the |
(...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5725 // arguments. | 5726 // arguments. |
5726 | 5727 |
5727 // Prepare the stack for the call to the resolved function. | 5728 // Prepare the stack for the call to the resolved function. |
5728 Load(function); | 5729 Load(function); |
5729 | 5730 |
5730 // Allocate a frame slot for the receiver. | 5731 // Allocate a frame slot for the receiver. |
5731 frame_->Push(Factory::undefined_value()); | 5732 frame_->Push(Factory::undefined_value()); |
5732 int arg_count = args->length(); | 5733 int arg_count = args->length(); |
5733 for (int i = 0; i < arg_count; i++) { | 5734 for (int i = 0; i < arg_count; i++) { |
5734 Load(args->at(i)); | 5735 Load(args->at(i)); |
| 5736 frame_->SpillTop(); |
5735 } | 5737 } |
5736 | 5738 |
5737 // Prepare the stack for the call to ResolvePossiblyDirectEval. | 5739 // Prepare the stack for the call to ResolvePossiblyDirectEval. |
5738 frame_->PushElementAt(arg_count + 1); | 5740 frame_->PushElementAt(arg_count + 1); |
5739 if (arg_count > 0) { | 5741 if (arg_count > 0) { |
5740 frame_->PushElementAt(arg_count); | 5742 frame_->PushElementAt(arg_count); |
5741 } else { | 5743 } else { |
5742 frame_->Push(Factory::undefined_value()); | 5744 frame_->Push(Factory::undefined_value()); |
5743 } | 5745 } |
5744 | 5746 |
(...skipping 29 matching lines...) Expand all Loading... |
5774 | 5776 |
5775 // Pass the global object as the receiver and let the IC stub | 5777 // Pass the global object as the receiver and let the IC stub |
5776 // patch the stack to use the global proxy as 'this' in the | 5778 // patch the stack to use the global proxy as 'this' in the |
5777 // invoked function. | 5779 // invoked function. |
5778 LoadGlobal(); | 5780 LoadGlobal(); |
5779 | 5781 |
5780 // Load the arguments. | 5782 // Load the arguments. |
5781 int arg_count = args->length(); | 5783 int arg_count = args->length(); |
5782 for (int i = 0; i < arg_count; i++) { | 5784 for (int i = 0; i < arg_count; i++) { |
5783 Load(args->at(i)); | 5785 Load(args->at(i)); |
| 5786 frame_->SpillTop(); |
5784 } | 5787 } |
5785 | 5788 |
5786 // Push the name of the function onto the frame. | 5789 // Push the name of the function onto the frame. |
5787 frame_->Push(var->name()); | 5790 frame_->Push(var->name()); |
5788 | 5791 |
5789 // Call the IC initialization code. | 5792 // Call the IC initialization code. |
5790 CodeForSourcePosition(node->position()); | 5793 CodeForSourcePosition(node->position()); |
5791 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET_CONTEXT, | 5794 Result result = frame_->CallCallIC(RelocInfo::CODE_TARGET_CONTEXT, |
5792 arg_count, | 5795 arg_count, |
5793 loop_nesting()); | 5796 loop_nesting()); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5879 node->position()); | 5882 node->position()); |
5880 | 5883 |
5881 } else { | 5884 } else { |
5882 // Push the receiver onto the frame. | 5885 // Push the receiver onto the frame. |
5883 Load(property->obj()); | 5886 Load(property->obj()); |
5884 | 5887 |
5885 // Load the arguments. | 5888 // Load the arguments. |
5886 int arg_count = args->length(); | 5889 int arg_count = args->length(); |
5887 for (int i = 0; i < arg_count; i++) { | 5890 for (int i = 0; i < arg_count; i++) { |
5888 Load(args->at(i)); | 5891 Load(args->at(i)); |
| 5892 frame_->SpillTop(); |
5889 } | 5893 } |
5890 | 5894 |
5891 // Push the name of the function onto the frame. | 5895 // Push the name of the function onto the frame. |
5892 frame_->Push(name); | 5896 frame_->Push(name); |
5893 | 5897 |
5894 // Call the IC initialization code. | 5898 // Call the IC initialization code. |
5895 CodeForSourcePosition(node->position()); | 5899 CodeForSourcePosition(node->position()); |
5896 Result result = | 5900 Result result = |
5897 frame_->CallCallIC(RelocInfo::CODE_TARGET, arg_count, | 5901 frame_->CallCallIC(RelocInfo::CODE_TARGET, arg_count, |
5898 loop_nesting()); | 5902 loop_nesting()); |
(...skipping 7389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13288 // tagged as a small integer. | 13292 // tagged as a small integer. |
13289 __ bind(&runtime); | 13293 __ bind(&runtime); |
13290 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 13294 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
13291 } | 13295 } |
13292 | 13296 |
13293 #undef __ | 13297 #undef __ |
13294 | 13298 |
13295 } } // namespace v8::internal | 13299 } } // namespace v8::internal |
13296 | 13300 |
13297 #endif // V8_TARGET_ARCH_IA32 | 13301 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |