From 5d15c4fd68d32f369060fa98cc9e7e13d33c057c Mon Sep 17 00:00:00 2001 From: Juliana Franco Date: Thu, 6 Jul 2017 10:05:14 +0200 Subject: [PATCH] Renaming of AstId functions to BytecodeOffset Replaced all occurrences of AstId with BytecodeOffset Change-Id: I5bee2d35ccd6e404748ba352e35f5982a7a9b392 Reviewed-on: https://chromium-review.googlesource.com/561007 Commit-Queue: Benedikt Meurer Reviewed-by: Benedikt Meurer Cr-Commit-Position: refs/heads/master@{#46472} --- src/compiler/code-generator.cc | 6 +++--- src/deoptimizer.cc | 2 +- src/objects-inl.h | 13 ++++++------- src/objects.cc | 19 ++++++++++--------- src/objects.h | 16 ++++++++-------- src/runtime/runtime-compiler.cc | 4 ++-- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc index ed5c7d420d..eea8c2ebfc 100644 --- a/src/compiler/code-generator.cc +++ b/src/compiler/code-generator.cc @@ -587,18 +587,18 @@ void CodeGenerator::PopulateDeoptimizationData(Handle code_object) { if (info->is_osr()) { DCHECK(osr_pc_offset_ >= 0); - data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id().ToInt())); + data->SetOsrBytecodeOffset(Smi::FromInt(info_->osr_ast_id().ToInt())); data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_)); } else { BailoutId osr_ast_id = BailoutId::None(); - data->SetOsrAstId(Smi::FromInt(osr_ast_id.ToInt())); + data->SetOsrBytecodeOffset(Smi::FromInt(osr_ast_id.ToInt())); data->SetOsrPcOffset(Smi::FromInt(-1)); } // Populate deoptimization entries. for (int i = 0; i < deopt_count; i++) { DeoptimizationState* deoptimization_state = deoptimization_states_[i]; - data->SetAstId(i, deoptimization_state->bailout_id()); + data->SetBytecodeOffset(i, deoptimization_state->bailout_id()); CHECK(deoptimization_states_[i]); data->SetTranslationIndex( i, Smi::FromInt(deoptimization_states_[i]->translation_id())); diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index 1c504c313c..5b6b4b603e 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -711,7 +711,7 @@ void Deoptimizer::DoComputeOutputFrames() { } } - BailoutId node_id = input_data->AstId(bailout_id_); + BailoutId node_id = input_data->BytecodeOffset(bailout_id_); ByteArray* translations = input_data->TranslationByteArray(); unsigned translation_index = input_data->TranslationIndex(bailout_id_)->value(); diff --git a/src/objects-inl.h b/src/objects-inl.h index 0781949a3c..5c605f12e0 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -2663,24 +2663,23 @@ FixedTypedArray::cast(const Object* object) { DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) -DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrAstId, Smi) +DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrBytecodeOffset, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(OsrPcOffset, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) DEFINE_DEOPT_ELEMENT_ACCESSORS(InliningPositions, PodArray) -DEFINE_DEOPT_ENTRY_ACCESSORS(AstIdRaw, Smi) +DEFINE_DEOPT_ENTRY_ACCESSORS(BytecodeOffsetRaw, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi) -BailoutId DeoptimizationInputData::AstId(int i) { - return BailoutId(AstIdRaw(i)->value()); +BailoutId DeoptimizationInputData::BytecodeOffset(int i) { + return BailoutId(BytecodeOffsetRaw(i)->value()); } - -void DeoptimizationInputData::SetAstId(int i, BailoutId value) { - SetAstIdRaw(i, Smi::FromInt(value.ToInt())); +void DeoptimizationInputData::SetBytecodeOffset(int i, BailoutId value) { + SetBytecodeOffsetRaw(i, Smi::FromInt(value.ToInt())); } diff --git a/src/objects.cc b/src/objects.cc index 7179c8c3f7..5ea59e953b 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -13948,7 +13948,7 @@ void JSFunction::ClearTypeFeedbackInfo() { } } -BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { +BailoutId Code::TranslatePcOffsetToBytecodeOffset(uint32_t pc_offset) { DisallowHeapAllocation no_gc; DCHECK(kind() == FUNCTION); BackEdgeTable back_edges(this, &no_gc); @@ -13958,13 +13958,12 @@ BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { return BailoutId::None(); } - -uint32_t Code::TranslateAstIdToPcOffset(BailoutId ast_id) { +uint32_t Code::TranslateBytecodeOffsetToPcOffset(BailoutId bytecode_offset) { DisallowHeapAllocation no_gc; DCHECK(kind() == FUNCTION); BackEdgeTable back_edges(this, &no_gc); for (uint32_t i = 0; i < back_edges.length(); i++) { - if (back_edges.ast_id(i) == ast_id) return back_edges.pc_offset(i); + if (back_edges.ast_id(i) == bytecode_offset) return back_edges.pc_offset(i); } UNREACHABLE(); // We expect to find the back edge. return 0; @@ -14128,7 +14127,7 @@ bool Code::CanDeoptAt(Address pc) { for (int i = 0; i < deopt_data->DeoptCount(); i++) { if (deopt_data->Pc(i)->value() == -1) continue; Address address = code_start_address + deopt_data->Pc(i)->value(); - if (address == pc && deopt_data->AstId(i) != BailoutId::None()) { + if (address == pc && deopt_data->BytecodeOffset(i) != BailoutId::None()) { return true; } } @@ -14227,19 +14226,21 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint( int deopt_count = DeoptCount(); os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; if (0 != deopt_count) { - os << " index ast id argc pc"; + os << " index bytecode-offset argc pc"; if (FLAG_print_code_verbose) os << " commands"; os << "\n"; } for (int i = 0; i < deopt_count; i++) { - os << std::setw(6) << i << " " << std::setw(6) << AstId(i).ToInt() << " " - << std::setw(6) << ArgumentsStackHeight(i)->value() << " "; + os << std::setw(6) << i << " " << std::setw(15) + << BytecodeOffset(i).ToInt() << " " << std::setw(6) + << ArgumentsStackHeight(i)->value() << " "; int pc_value = Pc(i)->value(); if (pc_value != -1) { os << std::setw(6) << std::hex << pc_value; } else { os << std::setw(6) << "NA"; } + os << std::dec; if (!FLAG_print_code_verbose) { os << "\n"; @@ -14260,7 +14261,7 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint( while (iterator.HasNext() && Translation::BEGIN != (opcode = static_cast(iterator.Next()))) { - os << std::setw(31) << " " << Translation::StringFor(opcode) << " "; + os << std::setw(40) << " " << Translation::StringFor(opcode) << " "; switch (opcode) { case Translation::BEGIN: diff --git a/src/objects.h b/src/objects.h index 7e022a7191..3faa9c92d4 100644 --- a/src/objects.h +++ b/src/objects.h @@ -3446,7 +3446,7 @@ class DeoptimizationInputData: public FixedArray { static const int kTranslationByteArrayIndex = 0; static const int kInlinedFunctionCountIndex = 1; static const int kLiteralArrayIndex = 2; - static const int kOsrAstIdIndex = 3; + static const int kOsrBytecodeOffsetIndex = 3; static const int kOsrPcOffsetIndex = 4; static const int kOptimizationIdIndex = 5; static const int kSharedFunctionInfoIndex = 6; @@ -3455,7 +3455,7 @@ class DeoptimizationInputData: public FixedArray { static const int kFirstDeoptEntryIndex = 9; // Offsets of deopt entry elements relative to the start of the entry. - static const int kAstIdRawOffset = 0; + static const int kBytecodeOffsetRawOffset = 0; static const int kTranslationIndexOffset = 1; static const int kArgumentsStackHeightOffset = 2; static const int kPcOffset = 3; @@ -3469,7 +3469,7 @@ class DeoptimizationInputData: public FixedArray { DECL_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) DECL_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) DECL_ELEMENT_ACCESSORS(LiteralArray, FixedArray) - DECL_ELEMENT_ACCESSORS(OsrAstId, Smi) + DECL_ELEMENT_ACCESSORS(OsrBytecodeOffset, Smi) DECL_ELEMENT_ACCESSORS(OsrPcOffset, Smi) DECL_ELEMENT_ACCESSORS(OptimizationId, Smi) DECL_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) @@ -3483,16 +3483,16 @@ class DeoptimizationInputData: public FixedArray { inline type* name(int i); \ inline void Set##name(int i, type* value); - DECL_ENTRY_ACCESSORS(AstIdRaw, Smi) + DECL_ENTRY_ACCESSORS(BytecodeOffsetRaw, Smi) DECL_ENTRY_ACCESSORS(TranslationIndex, Smi) DECL_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) DECL_ENTRY_ACCESSORS(Pc, Smi) #undef DECL_ENTRY_ACCESSORS - inline BailoutId AstId(int i); + inline BailoutId BytecodeOffset(int i); - inline void SetAstId(int i, BailoutId value); + inline void SetBytecodeOffset(int i, BailoutId value); inline int DeoptCount(); @@ -3913,8 +3913,8 @@ class Code: public HeapObject { void ClearInlineCaches(); - BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); - uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); + BailoutId TranslatePcOffsetToBytecodeOffset(uint32_t pc_offset); + uint32_t TranslateBytecodeOffsetToPcOffset(BailoutId bytecode_offset); #define DECL_CODE_AGE_ENUM(X) k##X##CodeAge, enum Age { diff --git a/src/runtime/runtime-compiler.cc b/src/runtime/runtime-compiler.cc index 26e78c0fb7..4cb5c4c03d 100644 --- a/src/runtime/runtime-compiler.cc +++ b/src/runtime/runtime-compiler.cc @@ -265,7 +265,7 @@ BailoutId DetermineEntryAndDisarmOSRForBaseline(JavaScriptFrame* frame) { // Return a BailoutId representing an AST id of the {IterationStatement}. uint32_t pc_offset = static_cast(frame->pc() - caller_code->instruction_start()); - return caller_code->TranslatePcOffsetToAstId(pc_offset); + return caller_code->TranslatePcOffsetToBytecodeOffset(pc_offset); } BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) { @@ -332,7 +332,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { DeoptimizationInputData::cast(result->deoptimization_data()); if (data->OsrPcOffset()->value() >= 0) { - DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); + DCHECK(BailoutId(data->OsrBytecodeOffset()->value()) == ast_id); if (FLAG_trace_osr) { PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", ast_id.ToInt(), data->OsrPcOffset()->value());