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

Unified Diff: src/compiler/instruction-selector.h

Issue 441883004: [turbofan] Improve testability of the InstructionSelector. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also add sample test for ia32. Created 6 years, 4 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/compiler/arm/instruction-selector-arm.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction-selector.h
diff --git a/src/compiler/instruction-selector.h b/src/compiler/instruction-selector.h
index b6c7039aefd709d5c0f21d438bd3832756a5d947..015879f8603e394f73bfc50fab0843824dedff32 100644
--- a/src/compiler/instruction-selector.h
+++ b/src/compiler/instruction-selector.h
@@ -22,8 +22,12 @@ class FlagsContinuation;
class InstructionSelector V8_FINAL {
public:
- explicit InstructionSelector(InstructionSequence* sequence,
- SourcePositionTable* source_positions);
+ // Forward declarations.
+ class Features;
+
+ InstructionSelector(InstructionSequence* sequence,
+ SourcePositionTable* source_positions,
+ Features features = SupportedFeatures());
// Visit code for the entire graph with the included schedule.
void SelectInstructions();
@@ -54,6 +58,32 @@ class InstructionSelector V8_FINAL {
InstructionOperand* *temps = NULL);
Instruction* Emit(Instruction* instr);
+ // ===========================================================================
+ // ============== Architecture-independent CPU feature methods. ==============
+ // ===========================================================================
+
+ class Features V8_FINAL {
+ public:
+ Features() : bits_(0) {}
+ explicit Features(unsigned bits) : bits_(bits) {}
+ explicit Features(CpuFeature f) : bits_(1u << f) {}
+ Features(CpuFeature f1, CpuFeature f2) : bits_((1u << f1) | (1u << f2)) {}
+
+ bool Contains(CpuFeature f) const { return (bits_ & (1u << f)); }
+
+ private:
+ unsigned bits_;
+ };
+
+ bool IsSupported(CpuFeature feature) const {
+ return features_.Contains(feature);
+ }
+
+ // Returns the features supported on the target platform.
+ static Features SupportedFeatures() {
+ return Features(CpuFeatures::SupportedFeatures());
+ }
+
private:
friend class OperandGenerator;
@@ -168,6 +198,7 @@ class InstructionSelector V8_FINAL {
Zone zone_;
InstructionSequence* sequence_;
SourcePositionTable* source_positions_;
+ Features features_;
BasicBlock* current_block_;
Instructions instructions_;
BoolVector defined_;
« no previous file with comments | « src/compiler/arm/instruction-selector-arm.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698