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

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

Issue 1419813010: [runtime] Remove the very dangerous %_CallFunction intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/x64/full-codegen-x64.cc ('k') | src/js/array.js » ('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_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 3742 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 // Call the target. 3753 // Call the target.
3754 __ mov(eax, Immediate(argc)); 3754 __ mov(eax, Immediate(argc));
3755 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 3755 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
3756 // Restore context register. 3756 // Restore context register.
3757 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3757 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3758 // Discard the function left on TOS. 3758 // Discard the function left on TOS.
3759 context()->DropAndPlug(1, eax); 3759 context()->DropAndPlug(1, eax);
3760 } 3760 }
3761 3761
3762 3762
3763 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
3764 ZoneList<Expression*>* args = expr->arguments();
3765 DCHECK(args->length() >= 2);
3766
3767 int arg_count = args->length() - 2; // 2 ~ receiver and function.
3768 for (int i = 0; i < arg_count + 1; ++i) {
3769 VisitForStackValue(args->at(i));
3770 }
3771 VisitForAccumulatorValue(args->last()); // Function.
3772
3773 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS);
3774 Label runtime, done;
3775 // Check for non-function argument (including proxy).
3776 __ JumpIfSmi(eax, &runtime);
3777 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
3778 __ j(not_equal, &runtime);
3779
3780 // InvokeFunction requires the function in edi. Move it in there.
3781 __ mov(edi, result_register());
3782 ParameterCount count(arg_count);
3783 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper());
3784 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3785 __ jmp(&done);
3786
3787 __ bind(&runtime);
3788 __ push(eax);
3789 __ CallRuntime(Runtime::kCallFunction, args->length());
3790 __ bind(&done);
3791
3792 context()->Plug(eax);
3793 }
3794
3795
3796 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 3763 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
3797 ZoneList<Expression*>* args = expr->arguments(); 3764 ZoneList<Expression*>* args = expr->arguments();
3798 DCHECK(args->length() == 2); 3765 DCHECK(args->length() == 2);
3799 3766
3800 // Evaluate new.target and super constructor. 3767 // Evaluate new.target and super constructor.
3801 VisitForStackValue(args->at(0)); 3768 VisitForStackValue(args->at(0));
3802 VisitForStackValue(args->at(1)); 3769 VisitForStackValue(args->at(1));
3803 3770
3804 // Check if the calling frame is an arguments adaptor frame. 3771 // Check if the calling frame is an arguments adaptor frame.
3805 Label adaptor_frame, args_set_up, runtime; 3772 Label adaptor_frame, args_set_up, runtime;
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
5007 Assembler::target_address_at(call_target_address, 4974 Assembler::target_address_at(call_target_address,
5008 unoptimized_code)); 4975 unoptimized_code));
5009 return OSR_AFTER_STACK_CHECK; 4976 return OSR_AFTER_STACK_CHECK;
5010 } 4977 }
5011 4978
5012 4979
5013 } // namespace internal 4980 } // namespace internal
5014 } // namespace v8 4981 } // namespace v8
5015 4982
5016 #endif // V8_TARGET_ARCH_X87 4983 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/js/array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698