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

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

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 9 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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_ARM_LITHIUM_CODEGEN_ARM_H_ 28 #ifndef V8_ARM_LITHIUM_CODEGEN_ARM_H_
29 #define V8_ARM_LITHIUM_CODEGEN_ARM_H_ 29 #define V8_ARM_LITHIUM_CODEGEN_ARM_H_
30 30
31 #include "arm/lithium-arm.h" 31 #include "arm/lithium-arm.h"
32 32 #include "arm/lithium-gap-resolver-arm.h"
33 #include "deoptimizer.h" 33 #include "deoptimizer.h"
34 #include "safepoint-table.h" 34 #include "safepoint-table.h"
35 #include "scopes.h" 35 #include "scopes.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 // Forward declarations. 40 // Forward declarations.
41 class LDeferredCode; 41 class LDeferredCode;
42 class LGapNode;
43 class SafepointGenerator; 42 class SafepointGenerator;
44 43
45 class LGapResolver BASE_EMBEDDED {
46 public:
47 LGapResolver();
48 const ZoneList<LMoveOperands>* Resolve(const ZoneList<LMoveOperands>* moves,
49 LOperand* marker_operand);
50
51 private:
52 LGapNode* LookupNode(LOperand* operand);
53 bool CanReach(LGapNode* a, LGapNode* b, int visited_id);
54 bool CanReach(LGapNode* a, LGapNode* b);
55 void RegisterMove(LMoveOperands move);
56 void AddResultMove(LOperand* from, LOperand* to);
57 void AddResultMove(LGapNode* from, LGapNode* to);
58 void ResolveCycle(LGapNode* start, LOperand* marker_operand);
59
60 ZoneList<LGapNode*> nodes_;
61 ZoneList<LGapNode*> identified_cycles_;
62 ZoneList<LMoveOperands> result_;
63 int next_visited_id_;
64 };
65
66
67 class LCodeGen BASE_EMBEDDED { 44 class LCodeGen BASE_EMBEDDED {
68 public: 45 public:
69 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) 46 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
70 : chunk_(chunk), 47 : chunk_(chunk),
71 masm_(assembler), 48 masm_(assembler),
72 info_(info), 49 info_(info),
73 current_block_(-1), 50 current_block_(-1),
74 current_instruction_(-1), 51 current_instruction_(-1),
75 instructions_(chunk->instructions()), 52 instructions_(chunk->instructions()),
76 deoptimizations_(4), 53 deoptimizations_(4),
77 deoptimization_literals_(8), 54 deoptimization_literals_(8),
78 inlined_function_count_(0), 55 inlined_function_count_(0),
79 scope_(chunk->graph()->info()->scope()), 56 scope_(info->scope()),
80 status_(UNUSED), 57 status_(UNUSED),
81 deferred_(8), 58 deferred_(8),
82 osr_pc_offset_(-1) { 59 osr_pc_offset_(-1),
60 resolver_(this) {
83 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 61 PopulateDeoptimizationLiteralsWithInlinedFunctions();
84 } 62 }
85 63
64
65 // Simple accessors.
66 MacroAssembler* masm() const { return masm_; }
67 CompilationInfo* info() const { return info_; }
68
69 // Support for converting LOperands to assembler types.
70 // LOperand must be a register.
71 Register ToRegister(LOperand* op) const;
72
73 // LOperand is loaded into scratch, unless already a register.
74 Register EmitLoadRegister(LOperand* op, Register scratch);
75
76 // LOperand must be a double register.
77 DoubleRegister ToDoubleRegister(LOperand* op) const;
78
79 // LOperand is loaded into dbl_scratch, unless already a double register.
80 DoubleRegister EmitLoadDoubleRegister(LOperand* op,
81 SwVfpRegister flt_scratch,
82 DoubleRegister dbl_scratch);
83 int ToInteger32(LConstantOperand* op) const;
84 Operand ToOperand(LOperand* op);
85 MemOperand ToMemOperand(LOperand* op) const;
86 // Returns a MemOperand pointing to the high word of a DoubleStackSlot.
87 MemOperand ToHighMemOperand(LOperand* op) const;
88
86 // Try to generate code for the entire chunk, but it may fail if the 89 // Try to generate code for the entire chunk, but it may fail if the
87 // chunk contains constructs we cannot handle. Returns true if the 90 // chunk contains constructs we cannot handle. Returns true if the
88 // code generation attempt succeeded. 91 // code generation attempt succeeded.
89 bool GenerateCode(); 92 bool GenerateCode();
90 93
91 // Finish the code by setting stack height, safepoint, and bailout 94 // Finish the code by setting stack height, safepoint, and bailout
92 // information on it. 95 // information on it.
93 void FinishCode(Handle<Code> code); 96 void FinishCode(Handle<Code> code);
94 97
95 // Deferred code support. 98 // Deferred code support.
96 template<int T> 99 template<int T>
97 void DoDeferredGenericBinaryStub(LTemplateInstruction<1, 2, T>* instr, 100 void DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
98 Token::Value op); 101 Token::Value op);
99 void DoDeferredNumberTagD(LNumberTagD* instr); 102 void DoDeferredNumberTagD(LNumberTagD* instr);
100 void DoDeferredNumberTagI(LNumberTagI* instr); 103 void DoDeferredNumberTagI(LNumberTagI* instr);
101 void DoDeferredTaggedToI(LTaggedToI* instr); 104 void DoDeferredTaggedToI(LTaggedToI* instr);
102 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); 105 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
103 void DoDeferredStackCheck(LGoto* instr); 106 void DoDeferredStackCheck(LGoto* instr);
104 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); 107 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr);
108 void DoDeferredStringCharFromCode(LStringCharFromCode* instr);
105 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 109 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
106 Label* map_check); 110 Label* map_check);
107 111
108 // Parallel move support. 112 // Parallel move support.
109 void DoParallelMove(LParallelMove* move); 113 void DoParallelMove(LParallelMove* move);
110 114
111 // Emit frame translation commands for an environment. 115 // Emit frame translation commands for an environment.
112 void WriteTranslation(LEnvironment* environment, Translation* translation); 116 void WriteTranslation(LEnvironment* environment, Translation* translation);
113 117
114 // Declare methods that deal with the individual node types. 118 // Declare methods that deal with the individual node types.
115 #define DECLARE_DO(type) void Do##type(L##type* node); 119 #define DECLARE_DO(type) void Do##type(L##type* node);
116 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 120 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
117 #undef DECLARE_DO 121 #undef DECLARE_DO
118 122
119 private: 123 private:
120 enum Status { 124 enum Status {
121 UNUSED, 125 UNUSED,
122 GENERATING, 126 GENERATING,
123 DONE, 127 DONE,
124 ABORTED 128 ABORTED
125 }; 129 };
126 130
127 bool is_unused() const { return status_ == UNUSED; } 131 bool is_unused() const { return status_ == UNUSED; }
128 bool is_generating() const { return status_ == GENERATING; } 132 bool is_generating() const { return status_ == GENERATING; }
129 bool is_done() const { return status_ == DONE; } 133 bool is_done() const { return status_ == DONE; }
130 bool is_aborted() const { return status_ == ABORTED; } 134 bool is_aborted() const { return status_ == ABORTED; }
131 135
132 int strict_mode_flag() const { 136 int strict_mode_flag() const {
133 return info_->is_strict() ? kStrictMode : kNonStrictMode; 137 return info()->is_strict() ? kStrictMode : kNonStrictMode;
134 } 138 }
135 139
136 LChunk* chunk() const { return chunk_; } 140 LChunk* chunk() const { return chunk_; }
137 Scope* scope() const { return scope_; } 141 Scope* scope() const { return scope_; }
138 HGraph* graph() const { return chunk_->graph(); } 142 HGraph* graph() const { return chunk_->graph(); }
139 MacroAssembler* masm() const { return masm_; }
140 143
141 Register scratch0() { return r9; } 144 Register scratch0() { return r9; }
142 DwVfpRegister double_scratch0() { return d0; } 145 DwVfpRegister double_scratch0() { return d0; }
143 146
144 int GetNextEmittedBlock(int block); 147 int GetNextEmittedBlock(int block);
145 LInstruction* GetNextInstruction(); 148 LInstruction* GetNextInstruction();
146 149
147 void EmitClassOfTest(Label* if_true, 150 void EmitClassOfTest(Label* if_true,
148 Label* if_false, 151 Label* if_false,
149 Handle<String> class_name, 152 Handle<String> class_name,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 LOperand* op, 198 LOperand* op,
196 bool is_tagged); 199 bool is_tagged);
197 void PopulateDeoptimizationData(Handle<Code> code); 200 void PopulateDeoptimizationData(Handle<Code> code);
198 int DefineDeoptimizationLiteral(Handle<Object> literal); 201 int DefineDeoptimizationLiteral(Handle<Object> literal);
199 202
200 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); 203 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
201 204
202 Register ToRegister(int index) const; 205 Register ToRegister(int index) const;
203 DoubleRegister ToDoubleRegister(int index) const; 206 DoubleRegister ToDoubleRegister(int index) const;
204 207
205 // LOperand must be a register.
206 Register ToRegister(LOperand* op) const;
207
208 // LOperand is loaded into scratch, unless already a register.
209 Register EmitLoadRegister(LOperand* op, Register scratch);
210
211 // LOperand must be a double register.
212 DoubleRegister ToDoubleRegister(LOperand* op) const;
213
214 // LOperand is loaded into dbl_scratch, unless already a double register.
215 DoubleRegister EmitLoadDoubleRegister(LOperand* op,
216 SwVfpRegister flt_scratch,
217 DoubleRegister dbl_scratch);
218
219 int ToInteger32(LConstantOperand* op) const;
220 Operand ToOperand(LOperand* op);
221 MemOperand ToMemOperand(LOperand* op) const;
222
223 // Specific math operations - used from DoUnaryMathOperation. 208 // Specific math operations - used from DoUnaryMathOperation.
224 void EmitIntegerMathAbs(LUnaryMathOperation* instr); 209 void EmitIntegerMathAbs(LUnaryMathOperation* instr);
225 void DoMathAbs(LUnaryMathOperation* instr); 210 void DoMathAbs(LUnaryMathOperation* instr);
226 void EmitVFPTruncate(VFPRoundingMode rounding_mode,
227 SwVfpRegister result,
228 DwVfpRegister double_input,
229 Register scratch1,
230 Register scratch2);
231 void DoMathFloor(LUnaryMathOperation* instr); 211 void DoMathFloor(LUnaryMathOperation* instr);
212 void DoMathRound(LUnaryMathOperation* instr);
232 void DoMathSqrt(LUnaryMathOperation* instr); 213 void DoMathSqrt(LUnaryMathOperation* instr);
214 void DoMathPowHalf(LUnaryMathOperation* instr);
215 void DoMathLog(LUnaryMathOperation* instr);
216 void DoMathCos(LUnaryMathOperation* instr);
217 void DoMathSin(LUnaryMathOperation* instr);
233 218
234 // Support for recording safepoint and position information. 219 // Support for recording safepoint and position information.
235 void RecordSafepoint(LPointerMap* pointers, 220 void RecordSafepoint(LPointerMap* pointers,
236 Safepoint::Kind kind, 221 Safepoint::Kind kind,
237 int arguments, 222 int arguments,
238 int deoptimization_index); 223 int deoptimization_index);
239 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); 224 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index);
225 void RecordSafepoint(int deoptimization_index);
240 void RecordSafepointWithRegisters(LPointerMap* pointers, 226 void RecordSafepointWithRegisters(LPointerMap* pointers,
241 int arguments, 227 int arguments,
242 int deoptimization_index); 228 int deoptimization_index);
243 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, 229 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers,
244 int arguments, 230 int arguments,
245 int deoptimization_index); 231 int deoptimization_index);
246 void RecordPosition(int position); 232 void RecordPosition(int position);
233 int LastSafepointEnd() {
234 return static_cast<int>(safepoints_.GetPcAfterGap());
235 }
247 236
248 static Condition TokenToCondition(Token::Value op, bool is_unsigned); 237 static Condition TokenToCondition(Token::Value op, bool is_unsigned);
249 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL); 238 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL);
250 void EmitBranch(int left_block, int right_block, Condition cc); 239 void EmitBranch(int left_block, int right_block, Condition cc);
251 void EmitCmpI(LOperand* left, LOperand* right); 240 void EmitCmpI(LOperand* left, LOperand* right);
252 void EmitNumberUntagD(Register input, 241 void EmitNumberUntagD(Register input,
253 DoubleRegister result, 242 DoubleRegister result,
254 LEnvironment* env); 243 LEnvironment* env);
255 244
256 // Emits optimized code for typeof x == "y". Modifies input register. 245 // Emits optimized code for typeof x == "y". Modifies input register.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 private: 312 private:
324 LCodeGen* codegen_; 313 LCodeGen* codegen_;
325 Label entry_; 314 Label entry_;
326 Label exit_; 315 Label exit_;
327 Label* external_exit_; 316 Label* external_exit_;
328 }; 317 };
329 318
330 } } // namespace v8::internal 319 } } // namespace v8::internal
331 320
332 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ 321 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698