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

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

Issue 1469793002: [builtins] Sanitize the machinery around Construct calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips64 fix. 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/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.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 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 #if V8_TARGET_ARCH_ARM64 5 #if V8_TARGET_ARCH_ARM64
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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 SetConstructCallPosition(expr, arg_count); 2770 SetConstructCallPosition(expr, arg_count);
2771 2771
2772 // Load function and argument count into x1 and x0. 2772 // Load function and argument count into x1 and x0.
2773 __ Mov(x0, arg_count); 2773 __ Mov(x0, arg_count);
2774 __ Peek(x1, arg_count * kXRegSize); 2774 __ Peek(x1, arg_count * kXRegSize);
2775 2775
2776 // Record call targets in unoptimized code. 2776 // Record call targets in unoptimized code.
2777 __ EmitLoadTypeFeedbackVector(x2); 2777 __ EmitLoadTypeFeedbackVector(x2);
2778 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); 2778 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot()));
2779 2779
2780 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 2780 CallConstructStub stub(isolate());
2781 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2781 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2782 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2782 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2783 // Restore context register. 2783 // Restore context register.
2784 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2784 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2785 context()->Plug(x0); 2785 context()->Plug(x0);
2786 } 2786 }
2787 2787
2788 2788
2789 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 2789 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
2790 SuperCallReference* super_call_ref = 2790 SuperCallReference* super_call_ref =
2791 expr->expression()->AsSuperCallReference(); 2791 expr->expression()->AsSuperCallReference();
2792 DCHECK_NOT_NULL(super_call_ref); 2792 DCHECK_NOT_NULL(super_call_ref);
2793 2793
2794 EmitLoadSuperConstructor(super_call_ref); 2794 EmitLoadSuperConstructor(super_call_ref);
2795 __ push(result_register()); 2795 __ push(result_register());
2796 2796
2797 // Push the arguments ("left-to-right") on the stack. 2797 // Push the arguments ("left-to-right") on the stack.
2798 ZoneList<Expression*>* args = expr->arguments(); 2798 ZoneList<Expression*>* args = expr->arguments();
2799 int arg_count = args->length(); 2799 int arg_count = args->length();
2800 for (int i = 0; i < arg_count; i++) { 2800 for (int i = 0; i < arg_count; i++) {
2801 VisitForStackValue(args->at(i)); 2801 VisitForStackValue(args->at(i));
2802 } 2802 }
2803 2803
2804 // Call the construct call builtin that handles allocation and 2804 // Call the construct call builtin that handles allocation and
2805 // constructor invocation. 2805 // constructor invocation.
2806 SetConstructCallPosition(expr, arg_count); 2806 SetConstructCallPosition(expr, arg_count);
2807 2807
2808 // Load new target into x4. 2808 // Load new target into x3.
2809 VisitForAccumulatorValue(super_call_ref->new_target_var()); 2809 VisitForAccumulatorValue(super_call_ref->new_target_var());
2810 __ Mov(x4, result_register()); 2810 __ Mov(x3, result_register());
2811 2811
2812 // Load function and argument count into x1 and x0. 2812 // Load function and argument count into x1 and x0.
2813 __ Mov(x0, arg_count); 2813 __ Mov(x0, arg_count);
2814 __ Peek(x1, arg_count * kXRegSize); 2814 __ Peek(x1, arg_count * kXRegSize);
2815 2815
2816 // Record call targets in unoptimized code. 2816 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
2817 __ EmitLoadTypeFeedbackVector(x2);
2818 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
2819
2820 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
2821 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2822 2817
2823 RecordJSReturnSite(expr); 2818 RecordJSReturnSite(expr);
2824 2819
2825 // Restore context register. 2820 // Restore context register.
2826 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2821 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2827 context()->Plug(x0); 2822 context()->Plug(x0);
2828 } 2823 }
2829 2824
2830 2825
2831 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2826 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
(...skipping 2214 matching lines...) Expand 10 before | Expand all | Expand 10 after
5046 } 5041 }
5047 5042
5048 return INTERRUPT; 5043 return INTERRUPT;
5049 } 5044 }
5050 5045
5051 5046
5052 } // namespace internal 5047 } // namespace internal
5053 } // namespace v8 5048 } // namespace v8
5054 5049
5055 #endif // V8_TARGET_ARCH_ARM64 5050 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698