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

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

Issue 867153003: new classes: special construct stub for derived classs and TDZ for `this`. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CR feedback 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
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_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 // if (false) { const x; }; var y = x; 1530 // if (false) { const x; }; var y = x;
1531 // 1531 //
1532 // The condition on the declaration scopes is a conservative check for 1532 // The condition on the declaration scopes is a conservative check for
1533 // nested functions that access a binding and are called before the 1533 // nested functions that access a binding and are called before the
1534 // binding is initialized: 1534 // binding is initialized:
1535 // function() { f(); let x = 1; function f() { x = 2; } } 1535 // function() { f(); let x = 1; function f() { x = 2; } }
1536 // 1536 //
1537 bool skip_init_check; 1537 bool skip_init_check;
1538 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { 1538 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
1539 skip_init_check = false; 1539 skip_init_check = false;
1540 } else if (var->is_this()) {
1541 // TODO(dslomov): implement 'this' hole check elimination.
1542 skip_init_check = false;
1540 } else { 1543 } else {
1541 // Check that we always have valid source position. 1544 // Check that we always have valid source position.
1542 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); 1545 DCHECK(var->initializer_position() != RelocInfo::kNoPosition);
1543 DCHECK(proxy->position() != RelocInfo::kNoPosition); 1546 DCHECK(proxy->position() != RelocInfo::kNoPosition);
1544 skip_init_check = var->mode() != CONST_LEGACY && 1547 skip_init_check = var->mode() != CONST_LEGACY &&
1545 var->initializer_position() < proxy->position(); 1548 var->initializer_position() < proxy->position();
1546 } 1549 }
1547 1550
1548 if (!skip_init_check) { 1551 if (!skip_init_check) {
1549 // Let and const need a read barrier. 1552 // Let and const need a read barrier.
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3250 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3248 context()->Plug(r0); 3251 context()->Plug(r0);
3249 } 3252 }
3250 3253
3251 3254
3252 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3255 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3253 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3256 SuperReference* super_ref = expr->expression()->AsSuperReference();
3254 EmitLoadSuperConstructor(super_ref); 3257 EmitLoadSuperConstructor(super_ref);
3255 __ push(result_register()); 3258 __ push(result_register());
3256 3259
3260 Variable* this_var = super_ref->this_var()->var();
3261
3262 GetVar(r0, this_var);
3263 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex);
3264 Label uninitialized_this;
3265 __ b(eq, &uninitialized_this);
3266 __ mov(r0, Operand(this_var->name()));
3267 __ Push(r0);
3268 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3269 __ bind(&uninitialized_this);
3270
3257 // Push the arguments ("left-to-right") on the stack. 3271 // Push the arguments ("left-to-right") on the stack.
3258 ZoneList<Expression*>* args = expr->arguments(); 3272 ZoneList<Expression*>* args = expr->arguments();
3259 int arg_count = args->length(); 3273 int arg_count = args->length();
3260 for (int i = 0; i < arg_count; i++) { 3274 for (int i = 0; i < arg_count; i++) {
3261 VisitForStackValue(args->at(i)); 3275 VisitForStackValue(args->at(i));
3262 } 3276 }
3263 3277
3264 // Call the construct call builtin that handles allocation and 3278 // Call the construct call builtin that handles allocation and
3265 // constructor invocation. 3279 // constructor invocation.
3266 SetSourcePosition(expr->position()); 3280 SetSourcePosition(expr->position());
(...skipping 14 matching lines...) Expand all
3281 3295
3282 __ Move(r2, FeedbackVector()); 3296 __ Move(r2, FeedbackVector());
3283 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3297 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3284 3298
3285 // TODO(dslomov): use a different stub and propagate new.target. 3299 // TODO(dslomov): use a different stub and propagate new.target.
3286 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3300 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3287 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3301 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3288 3302
3289 RecordJSReturnSite(expr); 3303 RecordJSReturnSite(expr);
3290 3304
3291 // TODO(dslomov): implement TDZ for `this`. 3305 EmitVariableAssignment(this_var, Token::INIT_CONST);
3292 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
3293 context()->Plug(r0); 3306 context()->Plug(r0);
3294 } 3307 }
3295 3308
3296 3309
3297 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3310 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3298 ZoneList<Expression*>* args = expr->arguments(); 3311 ZoneList<Expression*>* args = expr->arguments();
3299 DCHECK(args->length() == 1); 3312 DCHECK(args->length() == 1);
3300 3313
3301 VisitForAccumulatorValue(args->at(0)); 3314 VisitForAccumulatorValue(args->at(0));
3302 3315
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
5410 5423
5411 DCHECK(interrupt_address == 5424 DCHECK(interrupt_address ==
5412 isolate->builtins()->OsrAfterStackCheck()->entry()); 5425 isolate->builtins()->OsrAfterStackCheck()->entry());
5413 return OSR_AFTER_STACK_CHECK; 5426 return OSR_AFTER_STACK_CHECK;
5414 } 5427 }
5415 5428
5416 5429
5417 } } // namespace v8::internal 5430 } } // namespace v8::internal
5418 5431
5419 #endif // V8_TARGET_ARCH_ARM 5432 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698