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

Side by Side Diff: src/full-codegen/x87/full-codegen-x87.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
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_X87 5 #if V8_TARGET_ARCH_X87
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 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 2834
2835 2835
2836 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2836 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
2837 // Load the arguments. 2837 // Load the arguments.
2838 ZoneList<Expression*>* args = expr->arguments(); 2838 ZoneList<Expression*>* args = expr->arguments();
2839 int arg_count = args->length(); 2839 int arg_count = args->length();
2840 for (int i = 0; i < arg_count; i++) { 2840 for (int i = 0; i < arg_count; i++) {
2841 VisitForStackValue(args->at(i)); 2841 VisitForStackValue(args->at(i));
2842 } 2842 }
2843 2843
2844 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
2844 SetCallPosition(expr, arg_count); 2845 SetCallPosition(expr, arg_count);
2845 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); 2846 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code();
2846 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); 2847 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot())));
2847 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2848 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2848 // Don't assign a type feedback id to the IC, since type feedback is provided 2849 // Don't assign a type feedback id to the IC, since type feedback is provided
2849 // by the vector above. 2850 // by the vector above.
2850 CallIC(ic); 2851 CallIC(ic);
2851 2852
2852 RecordJSReturnSite(expr); 2853 RecordJSReturnSite(expr);
2853 2854
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
3783 } 3784 }
3784 3785
3785 3786
3786 void FullCodeGenerator::EmitCall(CallRuntime* expr) { 3787 void FullCodeGenerator::EmitCall(CallRuntime* expr) {
3787 ZoneList<Expression*>* args = expr->arguments(); 3788 ZoneList<Expression*>* args = expr->arguments();
3788 DCHECK_LE(2, args->length()); 3789 DCHECK_LE(2, args->length());
3789 // Push target, receiver and arguments onto the stack. 3790 // Push target, receiver and arguments onto the stack.
3790 for (Expression* const arg : *args) { 3791 for (Expression* const arg : *args) {
3791 VisitForStackValue(arg); 3792 VisitForStackValue(arg);
3792 } 3793 }
3794 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3793 // Move target to edi. 3795 // Move target to edi.
3794 int const argc = args->length() - 2; 3796 int const argc = args->length() - 2;
3795 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize)); 3797 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize));
3796 // Call the target. 3798 // Call the target.
3797 __ mov(eax, Immediate(argc)); 3799 __ mov(eax, Immediate(argc));
3798 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 3800 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3799 // Restore context register. 3801 // Restore context register.
3800 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3802 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3801 // Discard the function left on TOS. 3803 // Discard the function left on TOS.
3802 context()->DropAndPlug(1, eax); 3804 context()->DropAndPlug(1, eax);
3803 } 3805 }
3804 3806
3805 3807
3806 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { 3808 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3807 ZoneList<Expression*>* args = expr->arguments(); 3809 ZoneList<Expression*>* args = expr->arguments();
3808 DCHECK(args->length() >= 2); 3810 DCHECK(args->length() >= 2);
3809 3811
3810 int arg_count = args->length() - 2; // 2 ~ receiver and function. 3812 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3811 for (int i = 0; i < arg_count + 1; ++i) { 3813 for (int i = 0; i < arg_count + 1; ++i) {
3812 VisitForStackValue(args->at(i)); 3814 VisitForStackValue(args->at(i));
3813 } 3815 }
3814 VisitForAccumulatorValue(args->last()); // Function. 3816 VisitForAccumulatorValue(args->last()); // Function.
3815 3817
3818 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3816 Label runtime, done; 3819 Label runtime, done;
3817 // Check for non-function argument (including proxy). 3820 // Check for non-function argument (including proxy).
3818 __ JumpIfSmi(eax, &runtime); 3821 __ JumpIfSmi(eax, &runtime);
3819 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); 3822 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
3820 __ j(not_equal, &runtime); 3823 __ j(not_equal, &runtime);
3821 3824
3822 // InvokeFunction requires the function in edi. Move it in there. 3825 // InvokeFunction requires the function in edi. Move it in there.
3823 __ mov(edi, result_register()); 3826 __ mov(edi, result_register());
3824 ParameterCount count(arg_count); 3827 ParameterCount count(arg_count);
3825 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); 3828 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper());
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
5049 Assembler::target_address_at(call_target_address, 5052 Assembler::target_address_at(call_target_address,
5050 unoptimized_code)); 5053 unoptimized_code));
5051 return OSR_AFTER_STACK_CHECK; 5054 return OSR_AFTER_STACK_CHECK;
5052 } 5055 }
5053 5056
5054 5057
5055 } // namespace internal 5058 } // namespace internal
5056 } // namespace v8 5059 } // namespace v8
5057 5060
5058 #endif // V8_TARGET_ARCH_X87 5061 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698