diff options
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
| -rw-r--r-- | compiler/optimizing/code_generator.cc | 42 | 
1 files changed, 19 insertions, 23 deletions
| diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index aff6f9f64f..45eec6d744 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -981,21 +981,6 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction,      }    } -  uint32_t outer_dex_pc = dex_pc; -  uint32_t outer_environment_size = 0; -  uint32_t inlining_depth = 0; -  if (instruction != nullptr) { -    for (HEnvironment* environment = instruction->GetEnvironment(); -         environment != nullptr; -         environment = environment->GetParent()) { -      outer_dex_pc = environment->GetDexPc(); -      outer_environment_size = environment->Size(); -      if (environment != instruction->GetEnvironment()) { -        inlining_depth++; -      } -    } -  } -    // Collect PC infos for the mapping table.    uint32_t native_pc = GetAssembler()->CodePosition(); @@ -1003,12 +988,12 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction,    if (instruction == nullptr) {      // For stack overflow checks and native-debug-info entries without dex register      // mapping (i.e. start of basic block or start of slow path). -    stack_map_stream->BeginStackMapEntry(outer_dex_pc, native_pc, 0, 0, 0, 0); +    stack_map_stream->BeginStackMapEntry(dex_pc, native_pc, 0, 0, 0, 0);      stack_map_stream->EndStackMapEntry();      return;    } -  LocationSummary* locations = instruction->GetLocations(); +  LocationSummary* locations = instruction->GetLocations();    uint32_t register_mask = locations->GetRegisterMask();    DCHECK_EQ(register_mask & ~locations->GetLiveRegisters()->GetCoreRegisters(), 0u);    if (locations->OnlyCallsOnSlowPath()) { @@ -1023,22 +1008,33 @@ void CodeGenerator::RecordPcInfo(HInstruction* instruction,      // The register mask must be a subset of callee-save registers.      DCHECK_EQ(register_mask & core_callee_save_mask_, register_mask);    } + +  uint32_t outer_dex_pc = dex_pc; +  uint32_t outer_environment_size = 0u; +  uint32_t inlining_depth = 0; +  HEnvironment* const environment = instruction->GetEnvironment(); +  if (environment != nullptr) { +    HEnvironment* outer_environment = environment; +    while (outer_environment->GetParent() != nullptr) { +      outer_environment = outer_environment->GetParent(); +      ++inlining_depth; +    } +    outer_dex_pc = outer_environment->GetDexPc(); +    outer_environment_size = outer_environment->Size(); +  }    stack_map_stream->BeginStackMapEntry(outer_dex_pc,                                         native_pc,                                         register_mask,                                         locations->GetStackMask(),                                         outer_environment_size,                                         inlining_depth); - -  HEnvironment* const environment = instruction->GetEnvironment();    EmitEnvironment(environment, slow_path);    // Record invoke info, the common case for the trampoline is super and static invokes. Only    // record these to reduce oat file size.    if (kEnableDexLayoutOptimizations) { -    if (environment != nullptr && -        instruction->IsInvoke() && -        instruction->IsInvokeStaticOrDirect()) { -      HInvoke* const invoke = instruction->AsInvoke(); +    if (instruction->IsInvokeStaticOrDirect()) { +      HInvoke* const invoke = instruction->AsInvokeStaticOrDirect(); +      DCHECK(environment != nullptr);        stack_map_stream->AddInvoke(invoke->GetInvokeType(), invoke->GetDexMethodIndex());      }    } |