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

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

Powered by Google App Engine
This is Rietveld 408576698