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: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46472}
This commit is contained in:
Juliana Franco 2017-07-06 10:05:14 +02:00 committed by Commit Bot
parent 3aa9b26a8e
commit 5d15c4fd68
6 changed files with 30 additions and 30 deletions

View File

@ -587,18 +587,18 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> 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()));

View File

@ -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();

View File

@ -2663,24 +2663,23 @@ FixedTypedArray<Traits>::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<InliningPosition>)
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()));
}

View File

@ -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<Translation::Opcode>(iterator.Next()))) {
os << std::setw(31) << " " << Translation::StringFor(opcode) << " ";
os << std::setw(40) << " " << Translation::StringFor(opcode) << " ";
switch (opcode) {
case Translation::BEGIN:

View File

@ -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 {

View File

@ -265,7 +265,7 @@ BailoutId DetermineEntryAndDisarmOSRForBaseline(JavaScriptFrame* frame) {
// Return a BailoutId representing an AST id of the {IterationStatement}.
uint32_t pc_offset =
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) {
@ -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());