From 92a6ed2014278c78b60d7ef00751f15e6727aae0 Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Tue, 2 Dec 2014 18:58:03 +0000 Subject: Fix new-instance node. new-instance may throw when called on: - interfaces - abstract/innaccessible/unknown classes Change-Id: Id55dbb95b906a58c946b14adad934ee0e3498c0a --- compiler/optimizing/nodes.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 9d0b4a971e..4706b3beab 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1669,7 +1669,12 @@ class HNewInstance : public HExpression<0> { uint16_t GetTypeIndex() const { return type_index_; } // Calls runtime so needs an environment. - virtual bool NeedsEnvironment() const { return true; } + bool NeedsEnvironment() const OVERRIDE { return true; } + // It may throw when called on: + // - interfaces + // - abstract/innaccessible/unknown classes + // TODO: optimize when possible. + bool CanThrow() const OVERRIDE { return true; } DECLARE_INSTRUCTION(NewInstance); -- cgit v1.2.3-59-g8ed1b