Index: src/x87/full-codegen-x87.cc |
diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc |
index a7a5d714ecd7ba2886a8f8ba205a847d2d47a675..86576cebb1f170b0cf6995849355bb2400e27276 100644 |
--- a/src/x87/full-codegen-x87.cc |
+++ b/src/x87/full-codegen-x87.cc |
@@ -1450,6 +1450,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
bool skip_init_check; |
if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
skip_init_check = false; |
+ } else if (var->is_this()) { |
+ CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); |
+ // TODO(dslomov): implement 'this' hole check elimination. |
+ skip_init_check = false; |
} else { |
// Check that we always have valid source position. |
DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
@@ -3128,6 +3132,15 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
EmitLoadSuperConstructor(super_ref); |
__ push(result_register()); |
+ Variable* this_var = super_ref->this_var()->var(); |
+ GetVar(eax, this_var); |
+ __ cmp(eax, isolate()->factory()->the_hole_value()); |
+ Label uninitialized_this; |
+ __ j(equal, &uninitialized_this); |
+ __ push(Immediate(this_var->name())); |
+ __ CallRuntime(Runtime::kThrowReferenceError, 1); |
+ __ bind(&uninitialized_this); |
+ |
// Push the arguments ("left-to-right") on the stack. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
@@ -3162,8 +3175,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
RecordJSReturnSite(expr); |
- // TODO(dslomov): implement TDZ for `this`. |
- EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); |
+ EmitVariableAssignment(this_var, Token::INIT_CONST); |
context()->Plug(eax); |
} |