Bug 1026905 - IonMonkey: Remove the instruction counters from the script counters. r=bhackett, a=sledru
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -3205,29 +3205,19 @@ CodeGenerator::maybeCreateScriptCounts()
// Structure for managing the state tracked for a block by script counters.
struct ScriptCountBlockState
{
IonBlockCounts █
MacroAssembler &masm;
Sprinter printer;
- uint32_t instructionBytes;
- uint32_t spillBytes;
-
- // Pointer to instructionBytes, spillBytes, or nullptr, depending on the
- // last instruction processed.
- uint32_t *last;
- uint32_t lastLength;
-
public:
ScriptCountBlockState(IonBlockCounts *block, MacroAssembler *masm)
- : block(*block), masm(*masm),
- printer(GetIonContext()->cx),
- instructionBytes(0), spillBytes(0), last(nullptr), lastLength(0)
+ : block(*block), masm(*masm), printer(GetIonContext()->cx)
{
}
bool init()
{
if (!printer.init())
return false;
@@ -3239,39 +3229,29 @@ struct ScriptCountBlockState
// Collect human readable assembly for the code generated in the block.
masm.setPrinter(&printer);
return true;
}
void visitInstruction(LInstruction *ins)
{
- if (last)
- *last += masm.size() - lastLength;
- lastLength = masm.size();
- last = ins->isMoveGroup() ? &spillBytes : &instructionBytes;
-
// Prefix stream of assembly instructions with their LIR instruction
// name and any associated high level info.
if (const char *extra = ins->extraName())
printer.printf("[%s:%s]\n", ins->opName(), extra);
else
printer.printf("[%s]\n", ins->opName());
}
~ScriptCountBlockState()
{
masm.setPrinter(nullptr);
- if (last)
- *last += masm.size() - lastLength;
-
block.setCode(printer.string());
- block.setInstructionBytes(instructionBytes);
- block.setSpillBytes(spillBytes);
}
};
#ifdef DEBUG
bool
CodeGenerator::branchIfInvalidated(Register temp, Label *invalidated)
{
CodeOffsetLabel label = masm.movWithPatch(ImmWord(uintptr_t(-1)), temp);
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -632,21 +632,16 @@ struct IonBlockCounts
uint32_t *successors_;
// Hit count for this block.
uint64_t hitCount_;
// Text information about the code generated for this block.
char *code_;
- // Number of bytes of code generated in this block. Spill code is counted
- // separately from other, instruction implementing code.
- uint32_t instructionBytes_;
- uint32_t spillBytes_;
-
public:
bool init(uint32_t id, uint32_t offset, uint32_t numSuccessors) {
id_ = id;
offset_ = offset;
numSuccessors_ = numSuccessors;
if (numSuccessors) {
successors_ = js_pod_calloc<uint32_t>(numSuccessors);
@@ -697,32 +692,16 @@ struct IonBlockCounts
strcpy(ncode, code);
code_ = ncode;
}
}
const char *code() const {
return code_;
}
-
- void setInstructionBytes(uint32_t bytes) {
- instructionBytes_ = bytes;
- }
-
- uint32_t instructionBytes() const {
- return instructionBytes_;
- }
-
- void setSpillBytes(uint32_t bytes) {
- spillBytes_ = bytes;
- }
-
- uint32_t spillBytes() const {
- return spillBytes_;
- }
};
// Execution information for a compiled script which may persist after the
// IonScript is destroyed, for use during profiling.
struct IonScriptCounts
{
private:
// Any previous invalidated compilation(s) for the script.
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -225,18 +225,17 @@ js::DumpIonScriptCounts(Sprinter *sp, ji
Sprint(sp, "IonScript [%lu blocks]:\n", ionCounts->numBlocks());
for (size_t i = 0; i < ionCounts->numBlocks(); i++) {
const jit::IonBlockCounts &block = ionCounts->block(i);
if (block.hitCount() < 10)
continue;
Sprint(sp, "BB #%lu [%05u]", block.id(), block.offset());
for (size_t j = 0; j < block.numSuccessors(); j++)
Sprint(sp, " -> #%lu", block.successor(j));
- Sprint(sp, " :: %llu hits %u instruction bytes %u spill bytes\n",
- block.hitCount(), block.instructionBytes(), block.spillBytes());
+ Sprint(sp, " :: %llu hits\n", block.hitCount());
Sprint(sp, "%s\n", block.code());
}
}
#endif
void
js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
{
@@ -2309,23 +2308,16 @@ GetPCCountJSON(JSContext *cx, const Scri
AppendJSONProperty(buf, "hits");
NumberValueToStringBuffer(cx, DoubleValue(block.hitCount()), buf);
AppendJSONProperty(buf, "code");
JSString *str = JS_NewStringCopyZ(cx, block.code());
if (!str || !(str = StringToSource(cx, str)))
return false;
buf.append(str);
-
- AppendJSONProperty(buf, "instructionBytes");
- NumberValueToStringBuffer(cx, Int32Value(block.instructionBytes()), buf);
-
- AppendJSONProperty(buf, "spillBytes");
- NumberValueToStringBuffer(cx, Int32Value(block.spillBytes()), buf);
-
buf.append('}');
}
buf.append(']');
ionCounts = ionCounts->previous();
}
buf.append(']');
}