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

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

Issue 1471193002: X87: [builtins] Sanitize the machinery around Construct calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/crankshaft/x87/lithium-x87.cc ('k') | src/x87/builtins-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_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 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 SetConstructCallPosition(expr, arg_count); 2939 SetConstructCallPosition(expr, arg_count);
2940 2940
2941 // Load function and argument count into edi and eax. 2941 // Load function and argument count into edi and eax.
2942 __ Move(eax, Immediate(arg_count)); 2942 __ Move(eax, Immediate(arg_count));
2943 __ mov(edi, Operand(esp, arg_count * kPointerSize)); 2943 __ mov(edi, Operand(esp, arg_count * kPointerSize));
2944 2944
2945 // Record call targets in unoptimized code. 2945 // Record call targets in unoptimized code.
2946 __ EmitLoadTypeFeedbackVector(ebx); 2946 __ EmitLoadTypeFeedbackVector(ebx);
2947 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); 2947 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot())));
2948 2948
2949 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 2949 CallConstructStub stub(isolate());
2950 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2950 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2951 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2951 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2952 // Restore context register. 2952 // Restore context register.
2953 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2953 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2954 context()->Plug(eax); 2954 context()->Plug(eax);
2955 } 2955 }
2956 2956
2957 2957
2958 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 2958 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
2959 SuperCallReference* super_call_ref = 2959 SuperCallReference* super_call_ref =
2960 expr->expression()->AsSuperCallReference(); 2960 expr->expression()->AsSuperCallReference();
2961 DCHECK_NOT_NULL(super_call_ref); 2961 DCHECK_NOT_NULL(super_call_ref);
2962 2962
2963 EmitLoadSuperConstructor(super_call_ref); 2963 EmitLoadSuperConstructor(super_call_ref);
2964 __ push(result_register()); 2964 __ push(result_register());
2965 2965
2966 // Push the arguments ("left-to-right") on the stack. 2966 // Push the arguments ("left-to-right") on the stack.
2967 ZoneList<Expression*>* args = expr->arguments(); 2967 ZoneList<Expression*>* args = expr->arguments();
2968 int arg_count = args->length(); 2968 int arg_count = args->length();
2969 for (int i = 0; i < arg_count; i++) { 2969 for (int i = 0; i < arg_count; i++) {
2970 VisitForStackValue(args->at(i)); 2970 VisitForStackValue(args->at(i));
2971 } 2971 }
2972 2972
2973 // Call the construct call builtin that handles allocation and 2973 // Call the construct call builtin that handles allocation and
2974 // constructor invocation. 2974 // constructor invocation.
2975 SetConstructCallPosition(expr, arg_count); 2975 SetConstructCallPosition(expr, arg_count);
2976 2976
2977 // Load new target into ecx. 2977 // Load new target into edx.
2978 VisitForAccumulatorValue(super_call_ref->new_target_var()); 2978 VisitForAccumulatorValue(super_call_ref->new_target_var());
2979 __ mov(ecx, result_register()); 2979 __ mov(edx, result_register());
2980 2980
2981 // Load function and argument count into edi and eax. 2981 // Load function and argument count into edi and eax.
2982 __ Move(eax, Immediate(arg_count)); 2982 __ Move(eax, Immediate(arg_count));
2983 __ mov(edi, Operand(esp, arg_count * kPointerSize)); 2983 __ mov(edi, Operand(esp, arg_count * kPointerSize));
2984 2984
2985 // Record call targets in unoptimized code. 2985 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
2986 __ EmitLoadTypeFeedbackVector(ebx);
2987 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot())));
2988
2989 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
2990 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2991 2986
2992 RecordJSReturnSite(expr); 2987 RecordJSReturnSite(expr);
2993 2988
2994 // Restore context register. 2989 // Restore context register.
2995 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2990 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2996 context()->Plug(eax); 2991 context()->Plug(eax);
2997 } 2992 }
2998 2993
2999 2994
3000 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2995 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
4916 Assembler::target_address_at(call_target_address, 4911 Assembler::target_address_at(call_target_address,
4917 unoptimized_code)); 4912 unoptimized_code));
4918 return OSR_AFTER_STACK_CHECK; 4913 return OSR_AFTER_STACK_CHECK;
4919 } 4914 }
4920 4915
4921 4916
4922 } // namespace internal 4917 } // namespace internal
4923 } // namespace v8 4918 } // namespace v8
4924 4919
4925 #endif // V8_TARGET_ARCH_X87 4920 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/crankshaft/x87/lithium-x87.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698