summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-11-05 02:49:18 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-11-05 02:49:19 +0000
commita840d6155dd3332a1bef42facb1a5d2a3a524c5e (patch)
treee18758ebf663cc8c20c220f3154fcd67e539b464
parent1eb791ab6b5cb571edbe803db2908c42070d597f (diff)
parentb5f3d818a1bca7203d7ea0dee55bdc79e8dfaa20 (diff)
Merge "ART: Make TypeCheckSlowPath call kind consistent"
-rw-r--r--compiler/optimizing/code_generator_x86_64.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 163858e207..e1aea02ef7 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -5978,25 +5978,29 @@ void InstructionCodeGeneratorX86_64::VisitInstanceOf(HInstanceOf* instruction) {
}
}
-void LocationsBuilderX86_64::VisitCheckCast(HCheckCast* instruction) {
- LocationSummary::CallKind call_kind = LocationSummary::kNoCall;
- bool throws_into_catch = instruction->CanThrowIntoCatchBlock();
- TypeCheckKind type_check_kind = instruction->GetTypeCheckKind();
+bool IsTypeCheckSlowPathFatal(TypeCheckKind type_check_kind, bool throws_into_catch) {
switch (type_check_kind) {
case TypeCheckKind::kExactCheck:
case TypeCheckKind::kAbstractClassCheck:
case TypeCheckKind::kClassHierarchyCheck:
case TypeCheckKind::kArrayObjectCheck:
case TypeCheckKind::kInterfaceCheck:
- call_kind = (throws_into_catch || kEmitCompilerReadBarrier) ?
- LocationSummary::kCallOnSlowPath :
- LocationSummary::kNoCall; // In fact, call on a fatal (non-returning) slow path.
- break;
+ return !throws_into_catch && !kEmitCompilerReadBarrier;
case TypeCheckKind::kArrayCheck:
case TypeCheckKind::kUnresolvedCheck:
- call_kind = LocationSummary::kCallOnSlowPath;
- break;
+ return false;
}
+ LOG(FATAL) << "Unreachable";
+ UNREACHABLE();
+}
+
+void LocationsBuilderX86_64::VisitCheckCast(HCheckCast* instruction) {
+ bool throws_into_catch = instruction->CanThrowIntoCatchBlock();
+ TypeCheckKind type_check_kind = instruction->GetTypeCheckKind();
+ bool is_fatal_slow_path = IsTypeCheckSlowPathFatal(type_check_kind, throws_into_catch);
+ LocationSummary::CallKind call_kind = is_fatal_slow_path
+ ? LocationSummary::kNoCall
+ : LocationSummary::kCallOnSlowPath;
LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, call_kind);
locations->SetInAt(0, Location::RequiresRegister());
if (type_check_kind == TypeCheckKind::kInterfaceCheck) {
@@ -6036,11 +6040,7 @@ void InstructionCodeGeneratorX86_64::VisitCheckCast(HCheckCast* instruction) {
const int object_array_data_offset = mirror::Array::DataOffset(kHeapReferenceSize).Uint32Value();
bool is_type_check_slow_path_fatal =
- (type_check_kind == TypeCheckKind::kExactCheck ||
- type_check_kind == TypeCheckKind::kAbstractClassCheck ||
- type_check_kind == TypeCheckKind::kClassHierarchyCheck ||
- type_check_kind == TypeCheckKind::kArrayObjectCheck) &&
- !instruction->CanThrowIntoCatchBlock();
+ IsTypeCheckSlowPathFatal(type_check_kind, instruction->CanThrowIntoCatchBlock());
SlowPathCode* type_check_slow_path =
new (GetGraph()->GetArena()) TypeCheckSlowPathX86_64(instruction,
is_type_check_slow_path_fatal);