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

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

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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_(chunk->graph()->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
68 // Support for converting LOperands to assembler types.
69 // LOperand must be a register.
70 Register ToRegister(LOperand* op) const;
71
72 // LOperand is loaded into scratch, unless already a register.
73 Register EmitLoadRegister(LOperand* op, Register scratch);
74
75 // LOperand must be a double register.
76 DoubleRegister ToDoubleRegister(LOperand* op) const;
77
78 // LOperand is loaded into dbl_scratch, unless already a double register.
79 DoubleRegister EmitLoadDoubleRegister(LOperand* op,
80 SwVfpRegister flt_scratch,
81 DoubleRegister dbl_scratch);
82 int ToInteger32(LConstantOperand* op) const;
83 Operand ToOperand(LOperand* op);
84 MemOperand ToMemOperand(LOperand* op) const;
85 // Returns a MemOperand pointing to the high word of a DoubleStackSlot.
86 MemOperand ToHighMemOperand(LOperand* op) const;
87
86 // Try to generate code for the entire chunk, but it may fail if the 88 // 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 89 // chunk contains constructs we cannot handle. Returns true if the
88 // code generation attempt succeeded. 90 // code generation attempt succeeded.
89 bool GenerateCode(); 91 bool GenerateCode();
90 92
91 // Finish the code by setting stack height, safepoint, and bailout 93 // Finish the code by setting stack height, safepoint, and bailout
92 // information on it. 94 // information on it.
93 void FinishCode(Handle<Code> code); 95 void FinishCode(Handle<Code> code);
94 96
95 // Deferred code support. 97 // Deferred code support.
96 template<int T> 98 template<int T>
97 void DoDeferredGenericBinaryStub(LTemplateInstruction<1, 2, T>* instr, 99 void DoDeferredBinaryOpStub(LTemplateInstruction<1, 2, T>* instr,
98 Token::Value op); 100 Token::Value op);
99 void DoDeferredNumberTagD(LNumberTagD* instr); 101 void DoDeferredNumberTagD(LNumberTagD* instr);
100 void DoDeferredNumberTagI(LNumberTagI* instr); 102 void DoDeferredNumberTagI(LNumberTagI* instr);
101 void DoDeferredTaggedToI(LTaggedToI* instr); 103 void DoDeferredTaggedToI(LTaggedToI* instr);
102 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); 104 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
103 void DoDeferredStackCheck(LGoto* instr); 105 void DoDeferredStackCheck(LGoto* instr);
104 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); 106 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr);
105 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 107 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
106 Label* map_check); 108 Label* map_check);
107 109
108 // Parallel move support. 110 // Parallel move support.
(...skipping 13 matching lines...) Expand all
122 GENERATING, 124 GENERATING,
123 DONE, 125 DONE,
124 ABORTED 126 ABORTED
125 }; 127 };
126 128
127 bool is_unused() const { return status_ == UNUSED; } 129 bool is_unused() const { return status_ == UNUSED; }
128 bool is_generating() const { return status_ == GENERATING; } 130 bool is_generating() const { return status_ == GENERATING; }
129 bool is_done() const { return status_ == DONE; } 131 bool is_done() const { return status_ == DONE; }
130 bool is_aborted() const { return status_ == ABORTED; } 132 bool is_aborted() const { return status_ == ABORTED; }
131 133
134 int strict_mode_flag() const {
135 return info_->is_strict() ? kStrictMode : kNonStrictMode;
136 }
137
132 LChunk* chunk() const { return chunk_; } 138 LChunk* chunk() const { return chunk_; }
133 Scope* scope() const { return scope_; } 139 Scope* scope() const { return scope_; }
134 HGraph* graph() const { return chunk_->graph(); } 140 HGraph* graph() const { return chunk_->graph(); }
135 MacroAssembler* masm() const { return masm_; }
136 141
137 Register scratch0() { return r9; } 142 Register scratch0() { return r9; }
138 DwVfpRegister double_scratch0() { return d0; } 143 DwVfpRegister double_scratch0() { return d0; }
139 144
140 int GetNextEmittedBlock(int block); 145 int GetNextEmittedBlock(int block);
141 LInstruction* GetNextInstruction(); 146 LInstruction* GetNextInstruction();
142 147
143 void EmitClassOfTest(Label* if_true, 148 void EmitClassOfTest(Label* if_true,
144 Label* if_false, 149 Label* if_false,
145 Handle<String> class_name, 150 Handle<String> class_name,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 LOperand* op, 196 LOperand* op,
192 bool is_tagged); 197 bool is_tagged);
193 void PopulateDeoptimizationData(Handle<Code> code); 198 void PopulateDeoptimizationData(Handle<Code> code);
194 int DefineDeoptimizationLiteral(Handle<Object> literal); 199 int DefineDeoptimizationLiteral(Handle<Object> literal);
195 200
196 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); 201 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
197 202
198 Register ToRegister(int index) const; 203 Register ToRegister(int index) const;
199 DoubleRegister ToDoubleRegister(int index) const; 204 DoubleRegister ToDoubleRegister(int index) const;
200 205
201 // LOperand must be a register.
202 Register ToRegister(LOperand* op) const;
203
204 // LOperand is loaded into scratch, unless already a register.
205 Register EmitLoadRegister(LOperand* op, Register scratch);
206
207 // LOperand must be a double register.
208 DoubleRegister ToDoubleRegister(LOperand* op) const;
209
210 // LOperand is loaded into dbl_scratch, unless already a double register.
211 DoubleRegister EmitLoadDoubleRegister(LOperand* op,
212 SwVfpRegister flt_scratch,
213 DoubleRegister dbl_scratch);
214
215 int ToInteger32(LConstantOperand* op) const;
216 Operand ToOperand(LOperand* op);
217 MemOperand ToMemOperand(LOperand* op) const;
218
219 // Specific math operations - used from DoUnaryMathOperation. 206 // Specific math operations - used from DoUnaryMathOperation.
220 void EmitIntegerMathAbs(LUnaryMathOperation* instr); 207 void EmitIntegerMathAbs(LUnaryMathOperation* instr);
221 void DoMathAbs(LUnaryMathOperation* instr); 208 void DoMathAbs(LUnaryMathOperation* instr);
222 void EmitVFPTruncate(VFPRoundingMode rounding_mode,
223 SwVfpRegister result,
224 DwVfpRegister double_input,
225 Register scratch1,
226 Register scratch2);
227 void DoMathFloor(LUnaryMathOperation* instr); 209 void DoMathFloor(LUnaryMathOperation* instr);
210 void DoMathRound(LUnaryMathOperation* instr);
228 void DoMathSqrt(LUnaryMathOperation* instr); 211 void DoMathSqrt(LUnaryMathOperation* instr);
212 void DoMathLog(LUnaryMathOperation* instr);
213 void DoMathCos(LUnaryMathOperation* instr);
214 void DoMathSin(LUnaryMathOperation* instr);
229 215
230 // Support for recording safepoint and position information. 216 // Support for recording safepoint and position information.
231 void RecordSafepoint(LPointerMap* pointers, 217 void RecordSafepoint(LPointerMap* pointers,
232 Safepoint::Kind kind, 218 Safepoint::Kind kind,
233 int arguments, 219 int arguments,
234 int deoptimization_index); 220 int deoptimization_index);
235 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); 221 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index);
222 void RecordSafepoint(int deoptimization_index);
236 void RecordSafepointWithRegisters(LPointerMap* pointers, 223 void RecordSafepointWithRegisters(LPointerMap* pointers,
237 int arguments, 224 int arguments,
238 int deoptimization_index); 225 int deoptimization_index);
239 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, 226 void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers,
240 int arguments, 227 int arguments,
241 int deoptimization_index); 228 int deoptimization_index);
242 void RecordPosition(int position); 229 void RecordPosition(int position);
243 230
244 static Condition TokenToCondition(Token::Value op, bool is_unsigned); 231 static Condition TokenToCondition(Token::Value op, bool is_unsigned);
245 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL); 232 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 private: 306 private:
320 LCodeGen* codegen_; 307 LCodeGen* codegen_;
321 Label entry_; 308 Label entry_;
322 Label exit_; 309 Label exit_;
323 Label* external_exit_; 310 Label* external_exit_;
324 }; 311 };
325 312
326 } } // namespace v8::internal 313 } } // namespace v8::internal
327 314
328 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ 315 #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