From 275e088abec213aa0be3eef748926e4be2c5c79f Mon Sep 17 00:00:00 2001 From: dslomov Date: Wed, 4 Feb 2015 04:14:21 -0800 Subject: [PATCH] Fix assertion in full codegen for holed 'this'. R=rossberg@chromium.org BUG=chromium:455141 LOG=N Review URL: https://codereview.chromium.org/902563002 Cr-Commit-Position: refs/heads/master@{#26423} --- src/arm/full-codegen-arm.cc | 3 ++- src/arm64/full-codegen-arm64.cc | 3 ++- src/ia32/full-codegen-ia32.cc | 3 ++- src/x64/full-codegen-x64.cc | 3 ++- test/mjsunit/harmony/regress/regress-455141.js | 15 +++++++++++++++ 5 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 test/mjsunit/harmony/regress/regress-455141.js diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index f82d506..c97d431 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -1539,7 +1539,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { skip_init_check = false; } else if (var->is_this()) { - CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); + CHECK(info_->function() != nullptr && + (info_->function()->kind() & kSubclassConstructor) != 0); // TODO(dslomov): implement 'this' hole check elimination. skip_init_check = false; } else { diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc index 8c7fb5d..ebdc9bc 100644 --- a/src/arm64/full-codegen-arm64.cc +++ b/src/arm64/full-codegen-arm64.cc @@ -1519,7 +1519,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { skip_init_check = false; } else if (var->is_this()) { - CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); + CHECK(info_->function() != nullptr && + (info_->function()->kind() & kSubclassConstructor) != 0); // TODO(dslomov): implement 'this' hole check elimination. skip_init_check = false; } else { diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 777ec68..eb4c1bc 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -1462,7 +1462,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { skip_init_check = false; } else if (var->is_this()) { - CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); + CHECK(info_->function() != nullptr && + (info_->function()->kind() & kSubclassConstructor) != 0); // TODO(dslomov): implement 'this' hole check elimination. skip_init_check = false; } else { diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index b716c66..b37c9ed 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -1497,7 +1497,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { skip_init_check = false; } else if (var->is_this()) { - CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); + CHECK(info_->function() != nullptr && + (info_->function()->kind() & kSubclassConstructor) != 0); // TODO(dslomov): implement 'this' hole check elimination. skip_init_check = false; } else { diff --git a/test/mjsunit/harmony/regress/regress-455141.js b/test/mjsunit/harmony/regress/regress-455141.js new file mode 100644 index 0000000..6f5abb5 --- /dev/null +++ b/test/mjsunit/harmony/regress/regress-455141.js @@ -0,0 +1,15 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --experimental-classes --no-lazy +"use strict"; +class Base { +} +class Subclass extends Base { + constructor() { + this.prp1 = 3; + } +} +function __f_1(){ +} -- 2.7.4