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

Side by Side Diff: src/x64/lithium-codegen-x64.h

Issue 6366003: Port new version of ParallelMove's LGapResolver to X64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 16 matching lines...) Expand all
27 27
28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_ 28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_
29 #define V8_X64_LITHIUM_CODEGEN_X64_H_ 29 #define V8_X64_LITHIUM_CODEGEN_X64_H_
30 30
31 #include "x64/lithium-x64.h" 31 #include "x64/lithium-x64.h"
32 32
33 #include "checks.h" 33 #include "checks.h"
34 #include "deoptimizer.h" 34 #include "deoptimizer.h"
35 #include "safepoint-table.h" 35 #include "safepoint-table.h"
36 #include "scopes.h" 36 #include "scopes.h"
37 #include "x64/lithium-gap-resolver-x64.h"
37 38
38 namespace v8 { 39 namespace v8 {
39 namespace internal { 40 namespace internal {
40 41
41 // Forward declarations. 42 // Forward declarations.
42 class LDeferredCode; 43 class LDeferredCode;
43 class LGapNode; 44 class LGapNode;
Kevin Millikin (Chromium) 2011/01/24 14:57:12 No need for this forward declaration anymore.
William Hesse 2011/01/26 10:05:57 Done.
44 class SafepointGenerator; 45 class SafepointGenerator;
45 46
46 class LGapResolver BASE_EMBEDDED {
47 public:
48 LGapResolver();
49 const ZoneList<LMoveOperands>* Resolve(const ZoneList<LMoveOperands>* moves,
50 LOperand* marker_operand);
51
52 private:
53 LGapNode* LookupNode(LOperand* operand);
54 bool CanReach(LGapNode* a, LGapNode* b, int visited_id);
55 bool CanReach(LGapNode* a, LGapNode* b);
56 void RegisterMove(LMoveOperands move);
57 void AddResultMove(LOperand* from, LOperand* to);
58 void AddResultMove(LGapNode* from, LGapNode* to);
59 void ResolveCycle(LGapNode* start, LOperand* marker_operand);
60
61 ZoneList<LGapNode*> nodes_;
62 ZoneList<LGapNode*> identified_cycles_;
63 ZoneList<LMoveOperands> result_;
64 int next_visited_id_;
65 };
66
67
68 class LCodeGen BASE_EMBEDDED { 47 class LCodeGen BASE_EMBEDDED {
69 public: 48 public:
70 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) 49 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
71 : chunk_(chunk), 50 : chunk_(chunk),
72 masm_(assembler), 51 masm_(assembler),
73 info_(info), 52 info_(info),
74 current_block_(-1), 53 current_block_(-1),
75 current_instruction_(-1), 54 current_instruction_(-1),
76 instructions_(chunk->instructions()), 55 instructions_(chunk->instructions()),
77 deoptimizations_(4), 56 deoptimizations_(4),
78 deoptimization_literals_(8), 57 deoptimization_literals_(8),
79 inlined_function_count_(0), 58 inlined_function_count_(0),
80 scope_(chunk->graph()->info()->scope()), 59 scope_(chunk->graph()->info()->scope()),
81 status_(UNUSED), 60 status_(UNUSED),
82 deferred_(8), 61 deferred_(8),
83 osr_pc_offset_(-1) { 62 osr_pc_offset_(-1),
63 resolver_(this) {
84 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 64 PopulateDeoptimizationLiteralsWithInlinedFunctions();
85 } 65 }
86 66
67 // Simple accessors.
68 MacroAssembler* masm() const { return masm_; }
69
70 // Support for converting LOperands to assembler types.
71 Register ToRegister(LOperand* op) const;
72 XMMRegister ToDoubleRegister(LOperand* op) const;
73 bool IsInteger32Constant(LConstantOperand* op) const;
74 int ToInteger32(LConstantOperand* op) const;
75 bool IsTaggedConstant(LConstantOperand* op) const;
76 Handle<Object> ToHandle(LConstantOperand* op) const;
77 Operand ToOperand(LOperand* op) const;
78
79
87 // Try to generate code for the entire chunk, but it may fail if the 80 // Try to generate code for the entire chunk, but it may fail if the
88 // chunk contains constructs we cannot handle. Returns true if the 81 // chunk contains constructs we cannot handle. Returns true if the
89 // code generation attempt succeeded. 82 // code generation attempt succeeded.
90 bool GenerateCode(); 83 bool GenerateCode();
91 84
92 // Finish the code by setting stack height, safepoint, and bailout 85 // Finish the code by setting stack height, safepoint, and bailout
93 // information on it. 86 // information on it.
94 void FinishCode(Handle<Code> code); 87 void FinishCode(Handle<Code> code);
95 88
96 // Deferred code support. 89 // Deferred code support.
(...skipping 25 matching lines...) Expand all
122 }; 115 };
123 116
124 bool is_unused() const { return status_ == UNUSED; } 117 bool is_unused() const { return status_ == UNUSED; }
125 bool is_generating() const { return status_ == GENERATING; } 118 bool is_generating() const { return status_ == GENERATING; }
126 bool is_done() const { return status_ == DONE; } 119 bool is_done() const { return status_ == DONE; }
127 bool is_aborted() const { return status_ == ABORTED; } 120 bool is_aborted() const { return status_ == ABORTED; }
128 121
129 LChunk* chunk() const { return chunk_; } 122 LChunk* chunk() const { return chunk_; }
130 Scope* scope() const { return scope_; } 123 Scope* scope() const { return scope_; }
131 HGraph* graph() const { return chunk_->graph(); } 124 HGraph* graph() const { return chunk_->graph(); }
132 MacroAssembler* masm() const { return masm_; }
133 125
134 int GetNextEmittedBlock(int block); 126 int GetNextEmittedBlock(int block);
135 LInstruction* GetNextInstruction(); 127 LInstruction* GetNextInstruction();
136 128
137 void EmitClassOfTest(Label* if_true, 129 void EmitClassOfTest(Label* if_true,
138 Label* if_false, 130 Label* if_false,
139 Handle<String> class_name, 131 Handle<String> class_name,
140 Register input, 132 Register input,
141 Register temporary); 133 Register temporary);
142 134
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 void AddToTranslation(Translation* translation, 175 void AddToTranslation(Translation* translation,
184 LOperand* op, 176 LOperand* op,
185 bool is_tagged); 177 bool is_tagged);
186 void PopulateDeoptimizationData(Handle<Code> code); 178 void PopulateDeoptimizationData(Handle<Code> code);
187 int DefineDeoptimizationLiteral(Handle<Object> literal); 179 int DefineDeoptimizationLiteral(Handle<Object> literal);
188 180
189 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); 181 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
190 182
191 Register ToRegister(int index) const; 183 Register ToRegister(int index) const;
192 XMMRegister ToDoubleRegister(int index) const; 184 XMMRegister ToDoubleRegister(int index) const;
193 Register ToRegister(LOperand* op) const;
194 XMMRegister ToDoubleRegister(LOperand* op) const;
195 bool IsInteger32Constant(LConstantOperand* op) const;
196 int ToInteger32(LConstantOperand* op) const;
197 bool IsTaggedConstant(LConstantOperand* op) const;
198 Handle<Object> ToHandle(LConstantOperand* op) const;
199 Operand ToOperand(LOperand* op) const;
200 185
201 // Specific math operations - used from DoUnaryMathOperation. 186 // Specific math operations - used from DoUnaryMathOperation.
202 void DoMathAbs(LUnaryMathOperation* instr); 187 void DoMathAbs(LUnaryMathOperation* instr);
203 void DoMathFloor(LUnaryMathOperation* instr); 188 void DoMathFloor(LUnaryMathOperation* instr);
204 void DoMathRound(LUnaryMathOperation* instr); 189 void DoMathRound(LUnaryMathOperation* instr);
205 void DoMathSqrt(LUnaryMathOperation* instr); 190 void DoMathSqrt(LUnaryMathOperation* instr);
206 void DoMathPowHalf(LUnaryMathOperation* instr); 191 void DoMathPowHalf(LUnaryMathOperation* instr);
207 void DoMathLog(LUnaryMathOperation* instr); 192 void DoMathLog(LUnaryMathOperation* instr);
208 void DoMathCos(LUnaryMathOperation* instr); 193 void DoMathCos(LUnaryMathOperation* instr);
209 void DoMathSin(LUnaryMathOperation* instr); 194 void DoMathSin(LUnaryMathOperation* instr);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 private: 272 private:
288 LCodeGen* codegen_; 273 LCodeGen* codegen_;
289 Label entry_; 274 Label entry_;
290 Label exit_; 275 Label exit_;
291 Label* external_exit_; 276 Label* external_exit_;
292 }; 277 };
293 278
294 } } // namespace v8::internal 279 } } // namespace v8::internal
295 280
296 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ 281 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698