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

Side by Side Diff: src/full-codegen/arm/full-codegen-arm.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 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/x64/lithium-x64.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 SetConstructCallPosition(expr, arg_count); 3064 SetConstructCallPosition(expr, arg_count);
3065 3065
3066 // Load function and argument count into r1 and r0. 3066 // Load function and argument count into r1 and r0.
3067 __ mov(r0, Operand(arg_count)); 3067 __ mov(r0, Operand(arg_count));
3068 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); 3068 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize));
3069 3069
3070 // Record call targets in unoptimized code. 3070 // Record call targets in unoptimized code.
3071 __ EmitLoadTypeFeedbackVector(r2); 3071 __ EmitLoadTypeFeedbackVector(r2);
3072 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3072 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3073 3073
3074 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3074 CallConstructStub stub(isolate());
3075 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3075 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3076 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3076 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3077 // Restore context register. 3077 // Restore context register.
3078 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3078 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3079 context()->Plug(r0); 3079 context()->Plug(r0);
3080 } 3080 }
3081 3081
3082 3082
3083 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3083 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3084 SuperCallReference* super_call_ref = 3084 SuperCallReference* super_call_ref =
3085 expr->expression()->AsSuperCallReference(); 3085 expr->expression()->AsSuperCallReference();
3086 DCHECK_NOT_NULL(super_call_ref); 3086 DCHECK_NOT_NULL(super_call_ref);
3087 3087
3088 EmitLoadSuperConstructor(super_call_ref); 3088 EmitLoadSuperConstructor(super_call_ref);
3089 __ push(result_register()); 3089 __ push(result_register());
3090 3090
3091 // Push the arguments ("left-to-right") on the stack. 3091 // Push the arguments ("left-to-right") on the stack.
3092 ZoneList<Expression*>* args = expr->arguments(); 3092 ZoneList<Expression*>* args = expr->arguments();
3093 int arg_count = args->length(); 3093 int arg_count = args->length();
3094 for (int i = 0; i < arg_count; i++) { 3094 for (int i = 0; i < arg_count; i++) {
3095 VisitForStackValue(args->at(i)); 3095 VisitForStackValue(args->at(i));
3096 } 3096 }
3097 3097
3098 // Call the construct call builtin that handles allocation and 3098 // Call the construct call builtin that handles allocation and
3099 // constructor invocation. 3099 // constructor invocation.
3100 SetConstructCallPosition(expr, arg_count); 3100 SetConstructCallPosition(expr, arg_count);
3101 3101
3102 // Load new target into r4. 3102 // Load new target into r3.
3103 VisitForAccumulatorValue(super_call_ref->new_target_var()); 3103 VisitForAccumulatorValue(super_call_ref->new_target_var());
3104 __ mov(r4, result_register()); 3104 __ mov(r3, result_register());
3105 3105
3106 // Load function and argument count into r1 and r0. 3106 // Load function and argument count into r1 and r0.
3107 __ mov(r0, Operand(arg_count)); 3107 __ mov(r0, Operand(arg_count));
3108 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); 3108 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize));
3109 3109
3110 // Record call targets in unoptimized code. 3110 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
3111 __ EmitLoadTypeFeedbackVector(r2);
3112 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3113
3114 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3115 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3116 3111
3117 RecordJSReturnSite(expr); 3112 RecordJSReturnSite(expr);
3118 3113
3119 // Restore context register. 3114 // Restore context register.
3120 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3115 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3121 context()->Plug(r0); 3116 context()->Plug(r0);
3122 } 3117 }
3123 3118
3124 3119
3125 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3120 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
5058 DCHECK(interrupt_address == 5053 DCHECK(interrupt_address ==
5059 isolate->builtins()->OsrAfterStackCheck()->entry()); 5054 isolate->builtins()->OsrAfterStackCheck()->entry());
5060 return OSR_AFTER_STACK_CHECK; 5055 return OSR_AFTER_STACK_CHECK;
5061 } 5056 }
5062 5057
5063 5058
5064 } // namespace internal 5059 } // namespace internal
5065 } // namespace v8 5060 } // namespace v8
5066 5061
5067 #endif // V8_TARGET_ARCH_ARM 5062 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/crankshaft/x64/lithium-x64.cc ('k') | src/full-codegen/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698