Commit 5d15c4fd authored by Juliana Franco's avatar Juliana Franco Committed by Commit Bot

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 <bmeurer@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46472}
parent 3aa9b26a
...@@ -587,18 +587,18 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) { ...@@ -587,18 +587,18 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
if (info->is_osr()) { if (info->is_osr()) {
DCHECK(osr_pc_offset_ >= 0); 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_)); data->SetOsrPcOffset(Smi::FromInt(osr_pc_offset_));
} else { } else {
BailoutId osr_ast_id = BailoutId::None(); 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)); data->SetOsrPcOffset(Smi::FromInt(-1));
} }
// Populate deoptimization entries. // Populate deoptimization entries.
for (int i = 0; i < deopt_count; i++) { for (int i = 0; i < deopt_count; i++) {
DeoptimizationState* deoptimization_state = deoptimization_states_[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]); CHECK(deoptimization_states_[i]);
data->SetTranslationIndex( data->SetTranslationIndex(
i, Smi::FromInt(deoptimization_states_[i]->translation_id())); i, Smi::FromInt(deoptimization_states_[i]->translation_id()));
......
...@@ -711,7 +711,7 @@ void Deoptimizer::DoComputeOutputFrames() { ...@@ -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(); ByteArray* translations = input_data->TranslationByteArray();
unsigned translation_index = unsigned translation_index =
input_data->TranslationIndex(bailout_id_)->value(); input_data->TranslationIndex(bailout_id_)->value();
......
...@@ -2663,24 +2663,23 @@ FixedTypedArray<Traits>::cast(const Object* object) { ...@@ -2663,24 +2663,23 @@ FixedTypedArray<Traits>::cast(const Object* object) {
DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) DEFINE_DEOPT_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray)
DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi)
DEFINE_DEOPT_ELEMENT_ACCESSORS(LiteralArray, FixedArray) 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(OsrPcOffset, Smi)
DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi) DEFINE_DEOPT_ELEMENT_ACCESSORS(OptimizationId, Smi)
DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object) DEFINE_DEOPT_ELEMENT_ACCESSORS(WeakCellCache, Object)
DEFINE_DEOPT_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>) DEFINE_DEOPT_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>)
DEFINE_DEOPT_ENTRY_ACCESSORS(AstIdRaw, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(BytecodeOffsetRaw, Smi)
DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(TranslationIndex, Smi)
DEFINE_DEOPT_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi)
DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi) DEFINE_DEOPT_ENTRY_ACCESSORS(Pc, Smi)
BailoutId DeoptimizationInputData::AstId(int i) { BailoutId DeoptimizationInputData::BytecodeOffset(int i) {
return BailoutId(AstIdRaw(i)->value()); return BailoutId(BytecodeOffsetRaw(i)->value());
} }
void DeoptimizationInputData::SetBytecodeOffset(int i, BailoutId value) {
void DeoptimizationInputData::SetAstId(int i, BailoutId value) { SetBytecodeOffsetRaw(i, Smi::FromInt(value.ToInt()));
SetAstIdRaw(i, Smi::FromInt(value.ToInt()));
} }
......
...@@ -13948,7 +13948,7 @@ void JSFunction::ClearTypeFeedbackInfo() { ...@@ -13948,7 +13948,7 @@ void JSFunction::ClearTypeFeedbackInfo() {
} }
} }
BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { BailoutId Code::TranslatePcOffsetToBytecodeOffset(uint32_t pc_offset) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
DCHECK(kind() == FUNCTION); DCHECK(kind() == FUNCTION);
BackEdgeTable back_edges(this, &no_gc); BackEdgeTable back_edges(this, &no_gc);
...@@ -13958,13 +13958,12 @@ BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) { ...@@ -13958,13 +13958,12 @@ BailoutId Code::TranslatePcOffsetToAstId(uint32_t pc_offset) {
return BailoutId::None(); return BailoutId::None();
} }
uint32_t Code::TranslateBytecodeOffsetToPcOffset(BailoutId bytecode_offset) {
uint32_t Code::TranslateAstIdToPcOffset(BailoutId ast_id) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
DCHECK(kind() == FUNCTION); DCHECK(kind() == FUNCTION);
BackEdgeTable back_edges(this, &no_gc); BackEdgeTable back_edges(this, &no_gc);
for (uint32_t i = 0; i < back_edges.length(); i++) { 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. UNREACHABLE(); // We expect to find the back edge.
return 0; return 0;
...@@ -14128,7 +14127,7 @@ bool Code::CanDeoptAt(Address pc) { ...@@ -14128,7 +14127,7 @@ bool Code::CanDeoptAt(Address pc) {
for (int i = 0; i < deopt_data->DeoptCount(); i++) { for (int i = 0; i < deopt_data->DeoptCount(); i++) {
if (deopt_data->Pc(i)->value() == -1) continue; if (deopt_data->Pc(i)->value() == -1) continue;
Address address = code_start_address + deopt_data->Pc(i)->value(); 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; return true;
} }
} }
...@@ -14227,19 +14226,21 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint( ...@@ -14227,19 +14226,21 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(
int deopt_count = DeoptCount(); int deopt_count = DeoptCount();
os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n"; os << "Deoptimization Input Data (deopt points = " << deopt_count << ")\n";
if (0 != deopt_count) { if (0 != deopt_count) {
os << " index ast id argc pc"; os << " index bytecode-offset argc pc";
if (FLAG_print_code_verbose) os << " commands"; if (FLAG_print_code_verbose) os << " commands";
os << "\n"; os << "\n";
} }
for (int i = 0; i < deopt_count; i++) { for (int i = 0; i < deopt_count; i++) {
os << std::setw(6) << i << " " << std::setw(6) << AstId(i).ToInt() << " " os << std::setw(6) << i << " " << std::setw(15)
<< std::setw(6) << ArgumentsStackHeight(i)->value() << " "; << BytecodeOffset(i).ToInt() << " " << std::setw(6)
<< ArgumentsStackHeight(i)->value() << " ";
int pc_value = Pc(i)->value(); int pc_value = Pc(i)->value();
if (pc_value != -1) { if (pc_value != -1) {
os << std::setw(6) << std::hex << pc_value; os << std::setw(6) << std::hex << pc_value;
} else { } else {
os << std::setw(6) << "NA"; os << std::setw(6) << "NA";
} }
os << std::dec;
if (!FLAG_print_code_verbose) { if (!FLAG_print_code_verbose) {
os << "\n"; os << "\n";
...@@ -14260,7 +14261,7 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint( ...@@ -14260,7 +14261,7 @@ void DeoptimizationInputData::DeoptimizationInputDataPrint(
while (iterator.HasNext() && while (iterator.HasNext() &&
Translation::BEGIN != Translation::BEGIN !=
(opcode = static_cast<Translation::Opcode>(iterator.Next()))) { (opcode = static_cast<Translation::Opcode>(iterator.Next()))) {
os << std::setw(31) << " " << Translation::StringFor(opcode) << " "; os << std::setw(40) << " " << Translation::StringFor(opcode) << " ";
switch (opcode) { switch (opcode) {
case Translation::BEGIN: case Translation::BEGIN:
......
...@@ -3446,7 +3446,7 @@ class DeoptimizationInputData: public FixedArray { ...@@ -3446,7 +3446,7 @@ class DeoptimizationInputData: public FixedArray {
static const int kTranslationByteArrayIndex = 0; static const int kTranslationByteArrayIndex = 0;
static const int kInlinedFunctionCountIndex = 1; static const int kInlinedFunctionCountIndex = 1;
static const int kLiteralArrayIndex = 2; static const int kLiteralArrayIndex = 2;
static const int kOsrAstIdIndex = 3; static const int kOsrBytecodeOffsetIndex = 3;
static const int kOsrPcOffsetIndex = 4; static const int kOsrPcOffsetIndex = 4;
static const int kOptimizationIdIndex = 5; static const int kOptimizationIdIndex = 5;
static const int kSharedFunctionInfoIndex = 6; static const int kSharedFunctionInfoIndex = 6;
...@@ -3455,7 +3455,7 @@ class DeoptimizationInputData: public FixedArray { ...@@ -3455,7 +3455,7 @@ class DeoptimizationInputData: public FixedArray {
static const int kFirstDeoptEntryIndex = 9; static const int kFirstDeoptEntryIndex = 9;
// Offsets of deopt entry elements relative to the start of the entry. // 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 kTranslationIndexOffset = 1;
static const int kArgumentsStackHeightOffset = 2; static const int kArgumentsStackHeightOffset = 2;
static const int kPcOffset = 3; static const int kPcOffset = 3;
...@@ -3469,7 +3469,7 @@ class DeoptimizationInputData: public FixedArray { ...@@ -3469,7 +3469,7 @@ class DeoptimizationInputData: public FixedArray {
DECL_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) DECL_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray)
DECL_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) DECL_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi)
DECL_ELEMENT_ACCESSORS(LiteralArray, FixedArray) DECL_ELEMENT_ACCESSORS(LiteralArray, FixedArray)
DECL_ELEMENT_ACCESSORS(OsrAstId, Smi) DECL_ELEMENT_ACCESSORS(OsrBytecodeOffset, Smi)
DECL_ELEMENT_ACCESSORS(OsrPcOffset, Smi) DECL_ELEMENT_ACCESSORS(OsrPcOffset, Smi)
DECL_ELEMENT_ACCESSORS(OptimizationId, Smi) DECL_ELEMENT_ACCESSORS(OptimizationId, Smi)
DECL_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) DECL_ELEMENT_ACCESSORS(SharedFunctionInfo, Object)
...@@ -3483,16 +3483,16 @@ class DeoptimizationInputData: public FixedArray { ...@@ -3483,16 +3483,16 @@ class DeoptimizationInputData: public FixedArray {
inline type* name(int i); \ inline type* name(int i); \
inline void Set##name(int i, type* value); 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(TranslationIndex, Smi)
DECL_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) DECL_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi)
DECL_ENTRY_ACCESSORS(Pc, Smi) DECL_ENTRY_ACCESSORS(Pc, Smi)
#undef DECL_ENTRY_ACCESSORS #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(); inline int DeoptCount();
...@@ -3913,8 +3913,8 @@ class Code: public HeapObject { ...@@ -3913,8 +3913,8 @@ class Code: public HeapObject {
void ClearInlineCaches(); void ClearInlineCaches();
BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); BailoutId TranslatePcOffsetToBytecodeOffset(uint32_t pc_offset);
uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); uint32_t TranslateBytecodeOffsetToPcOffset(BailoutId bytecode_offset);
#define DECL_CODE_AGE_ENUM(X) k##X##CodeAge, #define DECL_CODE_AGE_ENUM(X) k##X##CodeAge,
enum Age { enum Age {
......
...@@ -265,7 +265,7 @@ BailoutId DetermineEntryAndDisarmOSRForBaseline(JavaScriptFrame* frame) { ...@@ -265,7 +265,7 @@ BailoutId DetermineEntryAndDisarmOSRForBaseline(JavaScriptFrame* frame) {
// Return a BailoutId representing an AST id of the {IterationStatement}. // Return a BailoutId representing an AST id of the {IterationStatement}.
uint32_t pc_offset = uint32_t pc_offset =
static_cast<uint32_t>(frame->pc() - caller_code->instruction_start()); static_cast<uint32_t>(frame->pc() - caller_code->instruction_start());
return caller_code->TranslatePcOffsetToAstId(pc_offset); return caller_code->TranslatePcOffsetToBytecodeOffset(pc_offset);
} }
BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) { BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) {
...@@ -332,7 +332,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) { ...@@ -332,7 +332,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
DeoptimizationInputData::cast(result->deoptimization_data()); DeoptimizationInputData::cast(result->deoptimization_data());
if (data->OsrPcOffset()->value() >= 0) { if (data->OsrPcOffset()->value() >= 0) {
DCHECK(BailoutId(data->OsrAstId()->value()) == ast_id); DCHECK(BailoutId(data->OsrBytecodeOffset()->value()) == ast_id);
if (FLAG_trace_osr) { if (FLAG_trace_osr) {
PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n", PrintF("[OSR - Entry at AST id %d, offset %d in optimized code]\n",
ast_id.ToInt(), data->OsrPcOffset()->value()); ast_id.ToInt(), data->OsrPcOffset()->value());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment