Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 6139806f909405a612bcfb68cc6f267a496c40a4..051d3a1162f16a225ce576762160cacec303da71 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -1538,6 +1538,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); |
@@ -3249,6 +3253,17 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
EmitLoadSuperConstructor(super_ref); |
__ push(result_register()); |
+ Variable* this_var = super_ref->this_var()->var(); |
+ |
+ GetVar(r0, this_var); |
+ __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); |
+ Label uninitialized_this; |
+ __ b(eq, &uninitialized_this); |
+ __ mov(r0, Operand(this_var->name())); |
+ __ Push(r0); |
+ __ 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(); |
@@ -3283,8 +3298,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(r0); |
} |