summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/method_compiler.cc
diff options
context:
space:
mode:
author TDYa127 <tdy@google.com> 2012-06-11 17:56:10 -0700
committer Shih-wei Liao <sliao@google.com> 2012-06-11 20:19:50 -0700
commitb2e940a5e5fe25ca4c779129652d836e3a6adc67 (patch)
tree314165523d4e34e26bddff532a794ffda0de5429 /src/compiler_llvm/method_compiler.cc
parent3bb50b1ce3debd9722e7a7affd5c91025666ccc2 (diff)
Fix assume_this_non_null.
If we modify "this" register, we can't assume this will not be null. Change-Id: Ic4715d892af948e2c0f73de5be9159454ab661d6
Diffstat (limited to 'src/compiler_llvm/method_compiler.cc')
-rw-r--r--src/compiler_llvm/method_compiler.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 6c1e194c62..754f3baccf 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -4397,10 +4397,14 @@ void MethodCompiler::ComputeMethodInfo() {
field_idx, oat_compilation_unit_, field_offset, is_volatile, false);
if (!is_fast_path) {
may_throw_exception = true;
- } else if (reg_idx != this_reg_idx) {
- // NullPointerException
- may_throw_exception = true;
- assume_this_non_null = true;
+ } else {
+ // Fast-path, may throw NullPointerException
+ if (reg_idx == this_reg_idx) {
+ // We assume "this" will not be null at first.
+ assume_this_non_null = true;
+ } else {
+ may_throw_exception = true;
+ }
}
}
break;
@@ -4421,10 +4425,14 @@ void MethodCompiler::ComputeMethodInfo() {
field_idx, oat_compilation_unit_, field_offset, is_volatile, true);
if (!is_fast_path) {
may_throw_exception = true;
- } else if (reg_idx != this_reg_idx) {
- // NullPointerException
- may_throw_exception = true;
- assume_this_non_null = true;
+ } else {
+ // Fast-path, may throw NullPointerException
+ if (reg_idx == this_reg_idx) {
+ // We assume "this" will not be null at first.
+ assume_this_non_null = true;
+ } else {
+ may_throw_exception = true;
+ }
}
}
break;