| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index a8d20beb1e2dd7f8ac1c14797168b66ed46fc8f8..e5362c6ebee30f0f51e8606a3e51ca717c32ba1c 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -1495,6 +1495,9 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| bool skip_init_check;
|
| if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
|
| skip_init_check = false;
|
| + } else if (var->is_this()) {
|
| + // 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);
|
| @@ -3143,6 +3146,17 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
| EmitLoadSuperConstructor(super_ref);
|
| __ Push(result_register());
|
|
|
| + Variable* this_var = super_ref->this_var()->var();
|
| +
|
| + GetVar(rax, this_var);
|
| + __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
|
| + Label uninitialized_this;
|
| + __ j(equal, &uninitialized_this);
|
| + __ Push(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();
|
| @@ -3177,8 +3191,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(rax);
|
| }
|
|
|
|
|