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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 1196193014: Do not add extra argument for new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment added Created 5 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 532
533 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, 533 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8,
534 r9, &miss); 534 r9, &miss);
535 __ bind(&miss); 535 __ bind(&miss);
536 PropertyAccessCompiler::TailCallBuiltin( 536 PropertyAccessCompiler::TailCallBuiltin(
537 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); 537 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC));
538 } 538 }
539 539
540 540
541 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 541 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
542 CHECK(!has_new_target());
543 // The key is in rdx and the parameter count is in rax. 542 // The key is in rdx and the parameter count is in rax.
544 DCHECK(rdx.is(ArgumentsAccessReadDescriptor::index())); 543 DCHECK(rdx.is(ArgumentsAccessReadDescriptor::index()));
545 DCHECK(rax.is(ArgumentsAccessReadDescriptor::parameter_count())); 544 DCHECK(rax.is(ArgumentsAccessReadDescriptor::parameter_count()));
546 545
547 // Check that the key is a smi. 546 // Check that the key is a smi.
548 Label slow; 547 Label slow;
549 __ JumpIfNotSmi(rdx, &slow); 548 __ JumpIfNotSmi(rdx, &slow);
550 549
551 // Check if the calling frame is an arguments adaptor frame. We look at the 550 // Check if the calling frame is an arguments adaptor frame. We look at the
552 // context offset, and if the frame is not a regular one, then we find a 551 // context offset, and if the frame is not a regular one, then we find a
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 598
600 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { 599 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
601 // Stack layout: 600 // Stack layout:
602 // rsp[0] : return address 601 // rsp[0] : return address
603 // rsp[8] : number of parameters (tagged) 602 // rsp[8] : number of parameters (tagged)
604 // rsp[16] : receiver displacement 603 // rsp[16] : receiver displacement
605 // rsp[24] : function 604 // rsp[24] : function
606 // Registers used over the whole function: 605 // Registers used over the whole function:
607 // rbx: the mapped parameter count (untagged) 606 // rbx: the mapped parameter count (untagged)
608 // rax: the allocated object (tagged). 607 // rax: the allocated object (tagged).
609
610 CHECK(!has_new_target());
611
612 Factory* factory = isolate()->factory(); 608 Factory* factory = isolate()->factory();
613 609
614 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); 610 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER);
615 __ SmiToInteger64(rbx, args.GetArgumentOperand(2)); 611 __ SmiToInteger64(rbx, args.GetArgumentOperand(2));
616 // rbx = parameter count (untagged) 612 // rbx = parameter count (untagged)
617 613
618 // Check if the calling frame is an arguments adaptor frame. 614 // Check if the calling frame is an arguments adaptor frame.
619 Label runtime; 615 Label runtime;
620 Label adaptor_frame, try_allocate; 616 Label adaptor_frame, try_allocate;
621 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 617 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count. 811 __ movp(args.GetArgumentOperand(2), rcx); // Patch argument count.
816 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1); 812 __ TailCallRuntime(Runtime::kNewSloppyArguments, 3, 1);
817 } 813 }
818 814
819 815
820 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { 816 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
821 // rsp[0] : return address 817 // rsp[0] : return address
822 // rsp[8] : number of parameters 818 // rsp[8] : number of parameters
823 // rsp[16] : receiver displacement 819 // rsp[16] : receiver displacement
824 // rsp[24] : function 820 // rsp[24] : function
825 CHECK(!has_new_target());
826 821
827 // Check if the calling frame is an arguments adaptor frame. 822 // Check if the calling frame is an arguments adaptor frame.
828 Label runtime; 823 Label runtime;
829 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 824 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
830 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset)); 825 __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset));
831 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 826 __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
832 __ j(not_equal, &runtime); 827 __ j(not_equal, &runtime);
833 828
834 // Patch the arguments.length and the parameters pointer. 829 // Patch the arguments.length and the parameters pointer.
835 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); 830 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // Get the length from the frame. 948 // Get the length from the frame.
954 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); 949 StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER);
955 __ movp(rcx, args.GetArgumentOperand(2)); 950 __ movp(rcx, args.GetArgumentOperand(2));
956 __ SmiToInteger64(rcx, rcx); 951 __ SmiToInteger64(rcx, rcx);
957 __ jmp(&try_allocate); 952 __ jmp(&try_allocate);
958 953
959 // Patch the arguments.length and the parameters pointer. 954 // Patch the arguments.length and the parameters pointer.
960 __ bind(&adaptor_frame); 955 __ bind(&adaptor_frame);
961 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 956 __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
962 957
963 if (has_new_target()) {
964 // If the constructor was [[Call]]ed, the call will not push a new.target
965 // onto the stack. In that case the arguments array we construct is bogus,
966 // bu we do not care as the constructor throws immediately.
967 __ Cmp(rcx, Smi::FromInt(0));
968 Label skip_decrement;
969 __ j(equal, &skip_decrement);
970 // Subtract 1 from smi-tagged arguments count.
971 __ SmiToInteger32(rcx, rcx);
972 __ decl(rcx);
973 __ Integer32ToSmi(rcx, rcx);
974 __ bind(&skip_decrement);
975 }
976 __ movp(args.GetArgumentOperand(2), rcx); 958 __ movp(args.GetArgumentOperand(2), rcx);
977 __ SmiToInteger64(rcx, rcx); 959 __ SmiToInteger64(rcx, rcx);
978 __ leap(rdx, Operand(rdx, rcx, times_pointer_size, 960 __ leap(rdx, Operand(rdx, rcx, times_pointer_size,
979 StandardFrameConstants::kCallerSPOffset)); 961 StandardFrameConstants::kCallerSPOffset));
980 __ movp(args.GetArgumentOperand(1), rdx); 962 __ movp(args.GetArgumentOperand(1), rdx);
981 963
982 // Try the new space allocation. Start out with computing the size of 964 // Try the new space allocation. Start out with computing the size of
983 // the arguments object and the elements array. 965 // the arguments object and the elements array.
984 Label add_arguments_object; 966 Label add_arguments_object;
985 __ bind(&try_allocate); 967 __ bind(&try_allocate);
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 kStackSpace, nullptr, return_value_operand, NULL); 5408 kStackSpace, nullptr, return_value_operand, NULL);
5427 } 5409 }
5428 5410
5429 5411
5430 #undef __ 5412 #undef __
5431 5413
5432 } // namespace internal 5414 } // namespace internal
5433 } // namespace v8 5415 } // namespace v8
5434 5416
5435 #endif // V8_TARGET_ARCH_X64 5417 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698