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

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

Issue 2672001: Port fast eval calls to x64 and ARM. For global variables that can... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 6 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/arm/codegen-arm.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 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
2876 // In a call to eval, we first call %ResolvePossiblyDirectEval to 2876 // In a call to eval, we first call %ResolvePossiblyDirectEval to
2877 // resolve the function we need to call and the receiver of the 2877 // resolve the function we need to call and the receiver of the
2878 // call. Then we call the resolved function using the given 2878 // call. Then we call the resolved function using the given
2879 // arguments. 2879 // arguments.
2880 2880
2881 // Prepare the stack for the call to the resolved function. 2881 // Prepare the stack for the call to the resolved function.
2882 Load(function); 2882 Load(function);
2883 2883
2884 // Allocate a frame slot for the receiver. 2884 // Allocate a frame slot for the receiver.
2885 frame_->Push(Factory::undefined_value()); 2885 frame_->Push(Factory::undefined_value());
2886
2887 // Load the arguments.
2886 int arg_count = args->length(); 2888 int arg_count = args->length();
2887 for (int i = 0; i < arg_count; i++) { 2889 for (int i = 0; i < arg_count; i++) {
2888 Load(args->at(i)); 2890 Load(args->at(i));
2889 frame_->SpillTop(); 2891 frame_->SpillTop();
2890 } 2892 }
2891 2893
2892 // Prepare the stack for the call to ResolvePossiblyDirectEval. 2894 // Result to hold the result of the function resolution and the
2895 // final result of the eval call.
2896 Result result;
2897
2898 // If we know that eval can only be shadowed by eval-introduced
2899 // variables we attempt to load the global eval function directly
2900 // in generated code. If we succeed, there is no need to perform a
2901 // context lookup in the runtime system.
2902 JumpTarget done;
2903 if (var->slot() != NULL && var->mode() == Variable::DYNAMIC_GLOBAL) {
2904 ASSERT(var->slot()->type() == Slot::LOOKUP);
2905 JumpTarget slow;
2906 // Prepare the stack for the call to
2907 // ResolvePossiblyDirectEvalNoLookup by pushing the loaded
2908 // function, the first argument to the eval call and the
2909 // receiver.
2910 Result fun = LoadFromGlobalSlotCheckExtensions(var->slot(),
2911 NOT_INSIDE_TYPEOF,
2912 &slow);
2913 frame_->Push(&fun);
2914 if (arg_count > 0) {
2915 frame_->PushElementAt(arg_count);
2916 } else {
2917 frame_->Push(Factory::undefined_value());
2918 }
2919 frame_->PushParameterAt(-1);
2920
2921 // Resolve the call.
2922 result =
2923 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEvalNoLookup, 3);
2924
2925 done.Jump(&result);
2926 slow.Bind();
2927 }
2928
2929 // Prepare the stack for the call to ResolvePossiblyDirectEval by
2930 // pushing the loaded function, the first argument to the eval
2931 // call and the receiver.
2893 frame_->PushElementAt(arg_count + 1); 2932 frame_->PushElementAt(arg_count + 1);
2894 if (arg_count > 0) { 2933 if (arg_count > 0) {
2895 frame_->PushElementAt(arg_count); 2934 frame_->PushElementAt(arg_count);
2896 } else { 2935 } else {
2897 frame_->Push(Factory::undefined_value()); 2936 frame_->Push(Factory::undefined_value());
2898 } 2937 }
2899
2900 // Push the receiver.
2901 frame_->PushParameterAt(-1); 2938 frame_->PushParameterAt(-1);
2902 2939
2903 // Resolve the call. 2940 // Resolve the call.
2904 Result result = 2941 result = frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3);
2905 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3); 2942
2943 // If we generated fast-case code bind the jump-target where fast
2944 // and slow case merge.
2945 if (done.is_linked()) done.Bind(&result);
2906 2946
2907 // The runtime call returns a pair of values in rax (function) and 2947 // The runtime call returns a pair of values in rax (function) and
2908 // rdx (receiver). Touch up the stack with the right values. 2948 // rdx (receiver). Touch up the stack with the right values.
2909 Result receiver = allocator_->Allocate(rdx); 2949 Result receiver = allocator_->Allocate(rdx);
2910 frame_->SetElementAt(arg_count + 1, &result); 2950 frame_->SetElementAt(arg_count + 1, &result);
2911 frame_->SetElementAt(arg_count, &receiver); 2951 frame_->SetElementAt(arg_count, &receiver);
2912 receiver.Unuse(); 2952 receiver.Unuse();
2913 2953
2914 // Call the function. 2954 // Call the function.
2915 CodeForSourcePosition(node->position()); 2955 CodeForSourcePosition(node->position());
(...skipping 8955 matching lines...) Expand 10 before | Expand all | Expand 10 after
11871 } 11911 }
11872 11912
11873 #endif 11913 #endif
11874 11914
11875 11915
11876 #undef __ 11916 #undef __
11877 11917
11878 } } // namespace v8::internal 11918 } } // namespace v8::internal
11879 11919
11880 #endif // V8_TARGET_ARCH_X64 11920 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698