Tiny change flags cleanups.

Introduced a getter for change flags, making a related helper function private.

Do not print a '*' at the end of hydrogen instruction mnemonics with side
effects, this is subsumed by the 'changes' info.
Review URL: http://codereview.chromium.org/7827009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9092 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e833f91e
......@@ -425,7 +425,7 @@ void HValue::PrintRangeTo(StringStream* stream) {
void HValue::PrintChangesTo(StringStream* stream) {
int changes_flags = (flags() & HValue::ChangesFlagsMask());
int changes_flags = ChangesFlags();
if (changes_flags == 0) return;
stream->Add(" changes[");
if (changes_flags == AllSideEffects()) {
......@@ -512,9 +512,7 @@ void HInstruction::PrintTo(StringStream* stream) {
void HInstruction::PrintMnemonicTo(StringStream* stream) {
stream->Add("%s", Mnemonic());
if (HasSideEffects()) stream->Add("*");
stream->Add(" ");
stream->Add("%s ", Mnemonic());
}
......
......@@ -513,19 +513,6 @@ class HValue: public ZoneObject {
static const int kChangesToDependsFlagsLeftShift = 1;
static int ChangesFlagsMask() {
int result = 0;
// Create changes mask.
#define DECLARE_DO(type) result |= (1 << kChanges##type);
GVN_FLAG_LIST(DECLARE_DO)
#undef DECLARE_DO
return result;
}
static int DependsFlagsMask() {
return ConvertChangesToDependsFlags(ChangesFlagsMask());
}
static int ConvertChangesToDependsFlags(int flags) {
return flags << kChangesToDependsFlagsLeftShift;
}
......@@ -629,6 +616,8 @@ class HValue: public ZoneObject {
void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); }
bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; }
int ChangesFlags() const { return flags_ & ChangesFlagsMask(); }
Range* range() const { return range_; }
bool HasRange() const { return range_ != NULL; }
void AddNewRange(Range* r);
......@@ -693,6 +682,15 @@ class HValue: public ZoneObject {
}
private:
static int ChangesFlagsMask() {
int result = 0;
// Create changes mask.
#define ADD_FLAG(type) result |= (1 << kChanges##type);
GVN_FLAG_LIST(ADD_FLAG)
#undef ADD_FLAG
return result;
}
// A flag mask to mark an instruction as having arbitrary side effects.
static int AllSideEffects() {
return ChangesFlagsMask() & ~(1 << kChangesOsrEntries);
......
......@@ -1382,7 +1382,7 @@ void HGlobalValueNumberer::ComputeBlockSideEffects() {
int id = block->block_id();
int side_effects = 0;
while (instr != NULL) {
side_effects |= (instr->flags() & HValue::ChangesFlagsMask());
side_effects |= instr->ChangesFlags();
instr = instr->next();
}
block_side_effects_[id] |= side_effects;
......@@ -1499,7 +1499,7 @@ void HGlobalValueNumberer::AnalyzeBlock(HBasicBlock* block, HValueMap* map) {
HInstruction* instr = block->first();
while (instr != NULL) {
HInstruction* next = instr->next();
int flags = (instr->flags() & HValue::ChangesFlagsMask());
int flags = instr->ChangesFlags();
if (flags != 0) {
ASSERT(!instr->CheckFlag(HValue::kUseGVN));
// Clear all instructions in the map that are affected by side effects.
......
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