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

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

Issue 1471623005: PPC: [builtins] Sanitize the machinery around Construct calls. (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/crankshaft/ppc/lithium-ppc.cc ('k') | src/ppc/builtins-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 SetConstructCallPosition(expr, arg_count); 3057 SetConstructCallPosition(expr, arg_count);
3058 3058
3059 // Load function and argument count into r4 and r3. 3059 // Load function and argument count into r4 and r3.
3060 __ mov(r3, Operand(arg_count)); 3060 __ mov(r3, Operand(arg_count));
3061 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0); 3061 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0);
3062 3062
3063 // Record call targets in unoptimized code. 3063 // Record call targets in unoptimized code.
3064 __ EmitLoadTypeFeedbackVector(r5); 3064 __ EmitLoadTypeFeedbackVector(r5);
3065 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot())); 3065 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot()));
3066 3066
3067 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3067 CallConstructStub stub(isolate());
3068 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3068 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3069 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3069 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3070 // Restore context register. 3070 // Restore context register.
3071 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3071 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3072 context()->Plug(r3); 3072 context()->Plug(r3);
3073 } 3073 }
3074 3074
3075 3075
3076 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3076 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3077 SuperCallReference* super_call_ref = 3077 SuperCallReference* super_call_ref =
3078 expr->expression()->AsSuperCallReference(); 3078 expr->expression()->AsSuperCallReference();
3079 DCHECK_NOT_NULL(super_call_ref); 3079 DCHECK_NOT_NULL(super_call_ref);
3080 3080
3081 EmitLoadSuperConstructor(super_call_ref); 3081 EmitLoadSuperConstructor(super_call_ref);
3082 __ push(result_register()); 3082 __ push(result_register());
3083 3083
3084 // Push the arguments ("left-to-right") on the stack. 3084 // Push the arguments ("left-to-right") on the stack.
3085 ZoneList<Expression*>* args = expr->arguments(); 3085 ZoneList<Expression*>* args = expr->arguments();
3086 int arg_count = args->length(); 3086 int arg_count = args->length();
3087 for (int i = 0; i < arg_count; i++) { 3087 for (int i = 0; i < arg_count; i++) {
3088 VisitForStackValue(args->at(i)); 3088 VisitForStackValue(args->at(i));
3089 } 3089 }
3090 3090
3091 // Call the construct call builtin that handles allocation and 3091 // Call the construct call builtin that handles allocation and
3092 // constructor invocation. 3092 // constructor invocation.
3093 SetConstructCallPosition(expr, arg_count); 3093 SetConstructCallPosition(expr, arg_count);
3094 3094
3095 // Load new target into r7. 3095 // Load new target into r6.
3096 VisitForAccumulatorValue(super_call_ref->new_target_var()); 3096 VisitForAccumulatorValue(super_call_ref->new_target_var());
3097 __ mr(r7, result_register()); 3097 __ mr(r6, result_register());
3098 3098
3099 // Load function and argument count into r1 and r0. 3099 // Load function and argument count into r1 and r0.
3100 __ mov(r3, Operand(arg_count)); 3100 __ mov(r3, Operand(arg_count));
3101 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); 3101 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize));
3102 3102
3103 // Record call targets in unoptimized code. 3103 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
3104 __ EmitLoadTypeFeedbackVector(r5);
3105 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot()));
3106
3107 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3108 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3109 3104
3110 RecordJSReturnSite(expr); 3105 RecordJSReturnSite(expr);
3111 3106
3112 // Restore context register. 3107 // Restore context register.
3113 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3108 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3114 context()->Plug(r3); 3109 context()->Plug(r3);
3115 } 3110 }
3116 3111
3117 3112
3118 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3113 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
(...skipping 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
5007 return ON_STACK_REPLACEMENT; 5002 return ON_STACK_REPLACEMENT;
5008 } 5003 }
5009 5004
5010 DCHECK(interrupt_address == 5005 DCHECK(interrupt_address ==
5011 isolate->builtins()->OsrAfterStackCheck()->entry()); 5006 isolate->builtins()->OsrAfterStackCheck()->entry());
5012 return OSR_AFTER_STACK_CHECK; 5007 return OSR_AFTER_STACK_CHECK;
5013 } 5008 }
5014 } // namespace internal 5009 } // namespace internal
5015 } // namespace v8 5010 } // namespace v8
5016 #endif // V8_TARGET_ARCH_PPC 5011 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/crankshaft/ppc/lithium-ppc.cc ('k') | src/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698