Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: src/hydrogen-gvn.h

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-gvn.h
diff --git a/src/hydrogen-gvn.h b/src/hydrogen-gvn.h
index ad97c155887136f2ff36df3a55c843d2d0c8676f..11f4a3859728f4ef35141dfe113d94b1ea6ff8f9 100644
--- a/src/hydrogen-gvn.h
+++ b/src/hydrogen-gvn.h
@@ -5,9 +5,10 @@
#ifndef V8_HYDROGEN_GVN_H_
#define V8_HYDROGEN_GVN_H_
+#include "src/compiler.h"
#include "src/hydrogen.h"
#include "src/hydrogen-instructions.h"
-#include "src/compiler.h"
+#include "src/ostreams.h"
#include "src/zone.h"
namespace v8 {
@@ -38,7 +39,6 @@ class SideEffects V8_FINAL {
void RemoveFlag(GVNFlag flag) { bits_ &= ~MaskFlag(flag); }
void RemoveAll() { bits_ = 0; }
uint64_t ToIntegral() const { return bits_; }
- void PrintTo(StringStream* stream) const;
private:
uint64_t MaskFlag(GVNFlag flag) const {
@@ -55,6 +55,8 @@ class SideEffects V8_FINAL {
};
+class TrackedEffects;
+
// Tracks global variable and inobject field loads/stores in a fine grained
// fashion, and represents them using the "special" dynamic side effects of the
// SideEffects class (see above). This way unrelated global variable/inobject
@@ -65,9 +67,9 @@ class SideEffectsTracker V8_FINAL BASE_EMBEDDED {
SideEffectsTracker() : num_global_vars_(0), num_inobject_fields_(0) {}
SideEffects ComputeChanges(HInstruction* instr);
SideEffects ComputeDependsOn(HInstruction* instr);
- void PrintSideEffectsTo(StringStream* stream, SideEffects side_effects) const;
private:
+ friend OStream& operator<<(OStream& os, const TrackedEffects& f);
bool ComputeGlobalVar(Unique<Cell> cell, int* index);
bool ComputeInobjectField(HObjectAccess access, int* index);
@@ -95,6 +97,18 @@ class SideEffectsTracker V8_FINAL BASE_EMBEDDED {
};
+// Helper class for printing, because the effects don't know their tracker.
+struct TrackedEffects {
+ TrackedEffects(SideEffectsTracker* t, SideEffects e)
+ : tracker(t), effects(e) {}
+ SideEffectsTracker* tracker;
+ SideEffects effects;
+};
+
+
+OStream& operator<<(OStream& os, const TrackedEffects& f);
+
+
// Perform common subexpression elimination and loop-invariant code motion.
class HGlobalValueNumberingPhase V8_FINAL : public HPhase {
public:
@@ -114,6 +128,9 @@ class HGlobalValueNumberingPhase V8_FINAL : public HPhase {
SideEffects loop_kills);
bool AllowCodeMotion();
bool ShouldMove(HInstruction* instr, HBasicBlock* loop_header);
+ TrackedEffects Print(SideEffects side_effects) {
+ return TrackedEffects(&side_effects_tracker_, side_effects);
+ }
SideEffectsTracker side_effects_tracker_;
bool removed_side_effects_;
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-gvn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698