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

Side by Side Diff: src/mips64/full-codegen-mips64.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 | « src/mips/full-codegen-mips.cc ('k') | no next file » | 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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 3226
3227 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3227 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3228 Comment cmnt(masm_, "[ SuperConstructorCall"); 3228 Comment cmnt(masm_, "[ SuperConstructorCall");
3229 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 3229 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
3230 GetVar(result_register(), new_target_var); 3230 GetVar(result_register(), new_target_var);
3231 __ Push(result_register()); 3231 __ Push(result_register());
3232 3232
3233 EmitLoadSuperConstructor(); 3233 EmitLoadSuperConstructor();
3234 __ push(result_register()); 3234 __ push(result_register());
3235 3235
3236 SuperReference* super_ref = expr->expression()->AsSuperReference();
3237 Variable* this_var = super_ref->this_var()->var();
3238
3239 GetVar(a0, this_var);
3240 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3241 Label uninitialized_this;
3242 __ Branch(&uninitialized_this, eq, a0, Operand(at));
3243 __ li(a0, Operand(this_var->name()));
3244 __ Push(a0);
3245 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3246 __ bind(&uninitialized_this);
3247
3248 // Push the arguments ("left-to-right") on the stack. 3236 // Push the arguments ("left-to-right") on the stack.
3249 ZoneList<Expression*>* args = expr->arguments(); 3237 ZoneList<Expression*>* args = expr->arguments();
3250 int arg_count = args->length(); 3238 int arg_count = args->length();
3251 for (int i = 0; i < arg_count; i++) { 3239 for (int i = 0; i < arg_count; i++) {
3252 VisitForStackValue(args->at(i)); 3240 VisitForStackValue(args->at(i));
3253 } 3241 }
3254 3242
3255 // Call the construct call builtin that handles allocation and 3243 // Call the construct call builtin that handles allocation and
3256 // constructor invocation. 3244 // constructor invocation.
3257 SetSourcePosition(expr->position()); 3245 SetSourcePosition(expr->position());
(...skipping 15 matching lines...) Expand all
3273 __ li(a2, FeedbackVector()); 3261 __ li(a2, FeedbackVector());
3274 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3262 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3275 3263
3276 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3264 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3277 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3265 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3278 3266
3279 __ Drop(1); 3267 __ Drop(1);
3280 3268
3281 RecordJSReturnSite(expr); 3269 RecordJSReturnSite(expr);
3282 3270
3271 SuperReference* super_ref = expr->expression()->AsSuperReference();
3272 Variable* this_var = super_ref->this_var()->var();
3273 GetVar(a1, this_var);
3274 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3275 Label uninitialized_this;
3276 __ Branch(&uninitialized_this, eq, a1, Operand(at));
3277 __ li(a0, Operand(this_var->name()));
3278 __ Push(a0);
3279 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3280 __ bind(&uninitialized_this);
3281
3283 EmitVariableAssignment(this_var, Token::INIT_CONST); 3282 EmitVariableAssignment(this_var, Token::INIT_CONST);
3284 context()->Plug(v0); 3283 context()->Plug(v0);
3285 } 3284 }
3286 3285
3287 3286
3288 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3287 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3289 ZoneList<Expression*>* args = expr->arguments(); 3288 ZoneList<Expression*>* args = expr->arguments();
3290 DCHECK(args->length() == 1); 3289 DCHECK(args->length() == 1);
3291 3290
3292 VisitForAccumulatorValue(args->at(0)); 3291 VisitForAccumulatorValue(args->at(0));
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 Assembler::target_address_at(pc_immediate_load_address)) == 5427 Assembler::target_address_at(pc_immediate_load_address)) ==
5429 reinterpret_cast<uint64_t>( 5428 reinterpret_cast<uint64_t>(
5430 isolate->builtins()->OsrAfterStackCheck()->entry())); 5429 isolate->builtins()->OsrAfterStackCheck()->entry()));
5431 return OSR_AFTER_STACK_CHECK; 5430 return OSR_AFTER_STACK_CHECK;
5432 } 5431 }
5433 5432
5434 5433
5435 } } // namespace v8::internal 5434 } } // namespace v8::internal
5436 5435
5437 #endif // V8_TARGET_ARCH_MIPS64 5436 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698