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

Side by Side Diff: src/full-codegen/mips64/full-codegen-mips64.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/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 SetConstructCallPosition(expr, arg_count); 3059 SetConstructCallPosition(expr, arg_count);
3060 3060
3061 // Load function and argument count into a1 and a0. 3061 // Load function and argument count into a1 and a0.
3062 __ li(a0, Operand(arg_count)); 3062 __ li(a0, Operand(arg_count));
3063 __ ld(a1, MemOperand(sp, arg_count * kPointerSize)); 3063 __ ld(a1, MemOperand(sp, arg_count * kPointerSize));
3064 3064
3065 // Record call targets in unoptimized code. 3065 // Record call targets in unoptimized code.
3066 __ EmitLoadTypeFeedbackVector(a2); 3066 __ EmitLoadTypeFeedbackVector(a2);
3067 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3067 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3068 3068
3069 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3069 CallConstructStub stub(isolate());
3070 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3070 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3071 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3071 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3072 // Restore context register. 3072 // Restore context register.
3073 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3073 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3074 context()->Plug(v0); 3074 context()->Plug(v0);
3075 } 3075 }
3076 3076
3077 3077
3078 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3078 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3079 SuperCallReference* super_call_ref = 3079 SuperCallReference* super_call_ref =
3080 expr->expression()->AsSuperCallReference(); 3080 expr->expression()->AsSuperCallReference();
3081 DCHECK_NOT_NULL(super_call_ref); 3081 DCHECK_NOT_NULL(super_call_ref);
3082 3082
3083 EmitLoadSuperConstructor(super_call_ref); 3083 EmitLoadSuperConstructor(super_call_ref);
3084 __ push(result_register()); 3084 __ push(result_register());
3085 3085
3086 // Push the arguments ("left-to-right") on the stack. 3086 // Push the arguments ("left-to-right") on the stack.
3087 ZoneList<Expression*>* args = expr->arguments(); 3087 ZoneList<Expression*>* args = expr->arguments();
3088 int arg_count = args->length(); 3088 int arg_count = args->length();
3089 for (int i = 0; i < arg_count; i++) { 3089 for (int i = 0; i < arg_count; i++) {
3090 VisitForStackValue(args->at(i)); 3090 VisitForStackValue(args->at(i));
3091 } 3091 }
3092 3092
3093 // Call the construct call builtin that handles allocation and 3093 // Call the construct call builtin that handles allocation and
3094 // constructor invocation. 3094 // constructor invocation.
3095 SetConstructCallPosition(expr, arg_count); 3095 SetConstructCallPosition(expr, arg_count);
3096 3096
3097 // Load new target into a4. 3097 // Load new target into a3.
3098 VisitForAccumulatorValue(super_call_ref->new_target_var()); 3098 VisitForAccumulatorValue(super_call_ref->new_target_var());
3099 __ mov(a4, result_register()); 3099 __ mov(a3, result_register());
3100 3100
3101 // Load function and argument count into a1 and a0. 3101 // Load function and argument count into a1 and a0.
3102 __ li(a0, Operand(arg_count)); 3102 __ li(a0, Operand(arg_count));
3103 __ ld(a1, MemOperand(sp, arg_count * kPointerSize)); 3103 __ ld(a1, MemOperand(sp, arg_count * kPointerSize));
3104 3104
3105 // Record call targets in unoptimized code. 3105 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
3106 __ EmitLoadTypeFeedbackVector(a2);
3107 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3108
3109 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3110 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3111 3106
3112 RecordJSReturnSite(expr); 3107 RecordJSReturnSite(expr);
3113 3108
3114 // Restore context register. 3109 // Restore context register.
3115 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3110 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3116 context()->Plug(v0); 3111 context()->Plug(v0);
3117 } 3112 }
3118 3113
3119 3114
3120 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3115 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
5030 reinterpret_cast<uint64_t>( 5025 reinterpret_cast<uint64_t>(
5031 isolate->builtins()->OsrAfterStackCheck()->entry())); 5026 isolate->builtins()->OsrAfterStackCheck()->entry()));
5032 return OSR_AFTER_STACK_CHECK; 5027 return OSR_AFTER_STACK_CHECK;
5033 } 5028 }
5034 5029
5035 5030
5036 } // namespace internal 5031 } // namespace internal
5037 } // namespace v8 5032 } // namespace v8
5038 5033
5039 #endif // V8_TARGET_ARCH_MIPS64 5034 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698