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

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

Issue 1425883004: [turbofan] Fix missing bailout point before calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update unittests. Created 5 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
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 2833
2834 2834
2835 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2835 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
2836 // Load the arguments. 2836 // Load the arguments.
2837 ZoneList<Expression*>* args = expr->arguments(); 2837 ZoneList<Expression*>* args = expr->arguments();
2838 int arg_count = args->length(); 2838 int arg_count = args->length();
2839 for (int i = 0; i < arg_count; i++) { 2839 for (int i = 0; i < arg_count; i++) {
2840 VisitForStackValue(args->at(i)); 2840 VisitForStackValue(args->at(i));
2841 } 2841 }
2842 2842
2843 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2843 SetCallPosition(expr, arg_count); 2844 SetCallPosition(expr, arg_count);
2844 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); 2845 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code();
2845 __ Move(rdx, SmiFromSlot(expr->CallFeedbackICSlot())); 2846 __ Move(rdx, SmiFromSlot(expr->CallFeedbackICSlot()));
2846 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); 2847 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
2847 // Don't assign a type feedback id to the IC, since type feedback is provided 2848 // Don't assign a type feedback id to the IC, since type feedback is provided
2848 // by the vector above. 2849 // by the vector above.
2849 CallIC(ic); 2850 CallIC(ic);
2850 2851
2851 RecordJSReturnSite(expr); 2852 RecordJSReturnSite(expr);
2852 2853
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 } 3787 }
3787 3788
3788 3789
3789 void FullCodeGenerator::EmitCall(CallRuntime* expr) { 3790 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
3790 ZoneList<Expression*>* args = expr->arguments(); 3791 ZoneList<Expression*>* args = expr->arguments();
3791 DCHECK_LE(2, args->length()); 3792 DCHECK_LE(2, args->length());
3792 // Push target, receiver and arguments onto the stack. 3793 // Push target, receiver and arguments onto the stack.
3793 for (Expression* const arg : *args) { 3794 for (Expression* const arg : *args) {
3794 VisitForStackValue(arg); 3795 VisitForStackValue(arg);
3795 } 3796 }
3797 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3796 // Move target to rdi. 3798 // Move target to rdi.
3797 int const argc = args->length() - 2; 3799 int const argc = args->length() - 2;
3798 __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize)); 3800 __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize));
3799 // Call the target. 3801 // Call the target.
3800 __ Set(rax, argc); 3802 __ Set(rax, argc);
3801 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 3803 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3802 // Restore context register. 3804 // Restore context register.
3803 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3805 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3804 // Discard the function left on TOS. 3806 // Discard the function left on TOS.
3805 context()->DropAndPlug(1, rax); 3807 context()->DropAndPlug(1, rax);
3806 } 3808 }
3807 3809
3808 3810
3809 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3811 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3810 ZoneList<Expression*>* args = expr->arguments(); 3812 ZoneList<Expression*>* args = expr->arguments();
3811 DCHECK(args->length() >= 2); 3813 DCHECK(args->length() >= 2);
3812 3814
3813 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3815 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3814 for (int i = 0; i < arg_count + 1; i++) { 3816 for (int i = 0; i < arg_count + 1; i++) {
3815 VisitForStackValue(args->at(i)); 3817 VisitForStackValue(args->at(i));
3816 } 3818 }
3817 VisitForAccumulatorValue(args->last()); // Function. 3819 VisitForAccumulatorValue(args->last()); // Function.
3818 3820
3821 PrepareForBailoutForId(expr->CallId(), TOS_REG);
3819 Label runtime, done; 3822 Label runtime, done;
3820 // Check for non-function argument (including proxy). 3823 // Check for non-function argument (including proxy).
3821 __ JumpIfSmi(rax, &runtime); 3824 __ JumpIfSmi(rax, &runtime);
3822 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); 3825 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx);
3823 __ j(not_equal, &runtime); 3826 __ j(not_equal, &runtime);
3824 3827
3825 // InvokeFunction requires the function in rdi. Move it in there. 3828 // InvokeFunction requires the function in rdi. Move it in there.
3826 __ movp(rdi, result_register()); 3829 __ movp(rdi, result_register());
3827 ParameterCount count(arg_count); 3830 ParameterCount count(arg_count);
3828 __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper()); 3831 __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper());
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
5072 Assembler::target_address_at(call_target_address, 5075 Assembler::target_address_at(call_target_address,
5073 unoptimized_code)); 5076 unoptimized_code));
5074 return OSR_AFTER_STACK_CHECK; 5077 return OSR_AFTER_STACK_CHECK;
5075 } 5078 }
5076 5079
5077 5080
5078 } // namespace internal 5081 } // namespace internal
5079 } // namespace v8 5082 } // namespace v8
5080 5083
5081 #endif // V8_TARGET_ARCH_X64 5084 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698