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

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

Issue 920543004: MIPS: new classes: implement correct check for uninitialized this in 'super()' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months 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 | « no previous file | src/mips64/full-codegen-mips64.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 3227
3228 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3228 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3229 Comment cmnt(masm_, "[ SuperConstructorCall"); 3229 Comment cmnt(masm_, "[ SuperConstructorCall");
3230 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 3230 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
3231 GetVar(result_register(), new_target_var); 3231 GetVar(result_register(), new_target_var);
3232 __ Push(result_register()); 3232 __ Push(result_register());
3233 3233
3234 EmitLoadSuperConstructor(); 3234 EmitLoadSuperConstructor();
3235 __ push(result_register()); 3235 __ push(result_register());
3236 3236
3237 SuperReference* super_ref = expr->expression()->AsSuperReference();
3238 Variable* this_var = super_ref->this_var()->var();
3239
3240 GetVar(a0, this_var);
3241 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3242 Label uninitialized_this;
3243 __ Branch(&uninitialized_this, eq, a0, Operand(at));
3244 __ li(a0, Operand(this_var->name()));
3245 __ Push(a0);
3246 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3247 __ bind(&uninitialized_this);
3248
3249 // Push the arguments ("left-to-right") on the stack. 3237 // Push the arguments ("left-to-right") on the stack.
3250 ZoneList<Expression*>* args = expr->arguments(); 3238 ZoneList<Expression*>* args = expr->arguments();
3251 int arg_count = args->length(); 3239 int arg_count = args->length();
3252 for (int i = 0; i < arg_count; i++) { 3240 for (int i = 0; i < arg_count; i++) {
3253 VisitForStackValue(args->at(i)); 3241 VisitForStackValue(args->at(i));
3254 } 3242 }
3255 3243
3256 // Call the construct call builtin that handles allocation and 3244 // Call the construct call builtin that handles allocation and
3257 // constructor invocation. 3245 // constructor invocation.
3258 SetSourcePosition(expr->position()); 3246 SetSourcePosition(expr->position());
(...skipping 15 matching lines...) Expand all
3274 __ li(a2, FeedbackVector()); 3262 __ li(a2, FeedbackVector());
3275 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3263 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3276 3264
3277 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3265 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3278 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3266 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3279 3267
3280 __ Drop(1); 3268 __ Drop(1);
3281 3269
3282 RecordJSReturnSite(expr); 3270 RecordJSReturnSite(expr);
3283 3271
3272 SuperReference* super_ref = expr->expression()->AsSuperReference();
3273 Variable* this_var = super_ref->this_var()->var();
3274 GetVar(a1, this_var);
3275 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3276 Label uninitialized_this;
3277 __ Branch(&uninitialized_this, eq, a1, Operand(at));
3278 __ li(a0, Operand(this_var->name()));
3279 __ Push(a0);
3280 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3281 __ bind(&uninitialized_this);
3282
3284 EmitVariableAssignment(this_var, Token::INIT_CONST); 3283 EmitVariableAssignment(this_var, Token::INIT_CONST);
3285 context()->Plug(v0); 3284 context()->Plug(v0);
3286 } 3285 }
3287 3286
3288 3287
3289 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3288 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3290 ZoneList<Expression*>* args = expr->arguments(); 3289 ZoneList<Expression*>* args = expr->arguments();
3291 DCHECK(args->length() == 1); 3290 DCHECK(args->length() == 1);
3292 3291
3293 VisitForAccumulatorValue(args->at(0)); 3292 VisitForAccumulatorValue(args->at(0));
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5423 Assembler::target_address_at(pc_immediate_load_address)) == 5422 Assembler::target_address_at(pc_immediate_load_address)) ==
5424 reinterpret_cast<uint32_t>( 5423 reinterpret_cast<uint32_t>(
5425 isolate->builtins()->OsrAfterStackCheck()->entry())); 5424 isolate->builtins()->OsrAfterStackCheck()->entry()));
5426 return OSR_AFTER_STACK_CHECK; 5425 return OSR_AFTER_STACK_CHECK;
5427 } 5426 }
5428 5427
5429 5428
5430 } } // namespace v8::internal 5429 } } // namespace v8::internal
5431 5430
5432 #endif // V8_TARGET_ARCH_MIPS 5431 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698