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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/ic-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) 49 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
50 : chunk_(chunk), 50 : chunk_(chunk),
51 masm_(assembler), 51 masm_(assembler),
52 info_(info), 52 info_(info),
53 current_block_(-1), 53 current_block_(-1),
54 current_instruction_(-1), 54 current_instruction_(-1),
55 instructions_(chunk->instructions()), 55 instructions_(chunk->instructions()),
56 deoptimizations_(4), 56 deoptimizations_(4),
57 deoptimization_literals_(8), 57 deoptimization_literals_(8),
58 inlined_function_count_(0), 58 inlined_function_count_(0),
59 scope_(chunk->graph()->info()->scope()), 59 scope_(info->scope()),
60 status_(UNUSED), 60 status_(UNUSED),
61 deferred_(8), 61 deferred_(8),
62 osr_pc_offset_(-1), 62 osr_pc_offset_(-1),
63 deoptimization_reloc_size(),
63 resolver_(this) { 64 resolver_(this) {
64 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 65 PopulateDeoptimizationLiteralsWithInlinedFunctions();
65 } 66 }
66 67
67 // Simple accessors. 68 // Simple accessors.
68 MacroAssembler* masm() const { return masm_; } 69 MacroAssembler* masm() const { return masm_; }
70 CompilationInfo* info() const { return info_; }
69 71
70 // Support for converting LOperands to assembler types. 72 // Support for converting LOperands to assembler types.
71 Operand ToOperand(LOperand* op) const; 73 Operand ToOperand(LOperand* op) const;
72 Register ToRegister(LOperand* op) const; 74 Register ToRegister(LOperand* op) const;
73 XMMRegister ToDoubleRegister(LOperand* op) const; 75 XMMRegister ToDoubleRegister(LOperand* op) const;
74 Immediate ToImmediate(LOperand* op); 76 Immediate ToImmediate(LOperand* op);
75 77
76 // The operand denoting the second word (the one with a higher address) of 78 // The operand denoting the second word (the one with a higher address) of
77 // a double stack slot. 79 // a double stack slot.
78 Operand HighOperand(LOperand* op); 80 Operand HighOperand(LOperand* op);
79 81
80 // Try to generate code for the entire chunk, but it may fail if the 82 // Try to generate code for the entire chunk, but it may fail if the
81 // chunk contains constructs we cannot handle. Returns true if the 83 // chunk contains constructs we cannot handle. Returns true if the
82 // code generation attempt succeeded. 84 // code generation attempt succeeded.
83 bool GenerateCode(); 85 bool GenerateCode();
84 86
85 // Finish the code by setting stack height, safepoint, and bailout 87 // Finish the code by setting stack height, safepoint, and bailout
86 // information on it. 88 // information on it.
87 void FinishCode(Handle<Code> code); 89 void FinishCode(Handle<Code> code);
88 90
89 // Deferred code support. 91 // Deferred code support.
90 void DoDeferredNumberTagD(LNumberTagD* instr); 92 void DoDeferredNumberTagD(LNumberTagD* instr);
91 void DoDeferredNumberTagI(LNumberTagI* instr); 93 void DoDeferredNumberTagI(LNumberTagI* instr);
92 void DoDeferredTaggedToI(LTaggedToI* instr); 94 void DoDeferredTaggedToI(LTaggedToI* instr);
93 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); 95 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
94 void DoDeferredStackCheck(LGoto* instr); 96 void DoDeferredStackCheck(LGoto* instr);
95 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); 97 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr);
98 void DoDeferredStringCharFromCode(LStringCharFromCode* instr);
96 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 99 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
97 Label* map_check); 100 Label* map_check);
98 101
99 // Parallel move support. 102 // Parallel move support.
100 void DoParallelMove(LParallelMove* move); 103 void DoParallelMove(LParallelMove* move);
101 104
102 // Emit frame translation commands for an environment. 105 // Emit frame translation commands for an environment.
103 void WriteTranslation(LEnvironment* environment, Translation* translation); 106 void WriteTranslation(LEnvironment* environment, Translation* translation);
104 107
108 void EnsureRelocSpaceForDeoptimization();
109
105 // Declare methods that deal with the individual node types. 110 // Declare methods that deal with the individual node types.
106 #define DECLARE_DO(type) void Do##type(L##type* node); 111 #define DECLARE_DO(type) void Do##type(L##type* node);
107 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 112 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
108 #undef DECLARE_DO 113 #undef DECLARE_DO
109 114
110 private: 115 private:
111 enum Status { 116 enum Status {
112 UNUSED, 117 UNUSED,
113 GENERATING, 118 GENERATING,
114 DONE, 119 DONE,
115 ABORTED 120 ABORTED
116 }; 121 };
117 122
118 bool is_unused() const { return status_ == UNUSED; } 123 bool is_unused() const { return status_ == UNUSED; }
119 bool is_generating() const { return status_ == GENERATING; } 124 bool is_generating() const { return status_ == GENERATING; }
120 bool is_done() const { return status_ == DONE; } 125 bool is_done() const { return status_ == DONE; }
121 bool is_aborted() const { return status_ == ABORTED; } 126 bool is_aborted() const { return status_ == ABORTED; }
122 127
123 int strict_mode_flag() const { 128 int strict_mode_flag() const {
124 return info_->is_strict() ? kStrictMode : kNonStrictMode; 129 return info()->is_strict() ? kStrictMode : kNonStrictMode;
125 } 130 }
126 131
127 LChunk* chunk() const { return chunk_; } 132 LChunk* chunk() const { return chunk_; }
128 Scope* scope() const { return scope_; } 133 Scope* scope() const { return scope_; }
129 HGraph* graph() const { return chunk_->graph(); } 134 HGraph* graph() const { return chunk_->graph(); }
130 135
131 int GetNextEmittedBlock(int block); 136 int GetNextEmittedBlock(int block);
132 LInstruction* GetNextInstruction(); 137 LInstruction* GetNextInstruction();
133 138
134 void EmitClassOfTest(Label* if_true, 139 void EmitClassOfTest(Label* if_true,
135 Label* if_false, 140 Label* if_false,
136 Handle<String> class_name, 141 Handle<String> class_name,
137 Register input, 142 Register input,
138 Register temporary, 143 Register temporary,
139 Register temporary2); 144 Register temporary2);
140 145
141 int StackSlotCount() const { return chunk()->spill_slot_count(); } 146 int StackSlotCount() const { return chunk()->spill_slot_count(); }
142 int ParameterCount() const { return scope()->num_parameters(); } 147 int ParameterCount() const { return scope()->num_parameters(); }
143 148
144 void Abort(const char* format, ...); 149 void Abort(const char* format, ...);
145 void Comment(const char* format, ...); 150 void Comment(const char* format, ...);
146 151
147 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } 152 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); }
148 153
149 // Code generation passes. Returns true if code generation should 154 // Code generation passes. Returns true if code generation should
150 // continue. 155 // continue.
151 bool GeneratePrologue(); 156 bool GeneratePrologue();
152 bool GenerateBody(); 157 bool GenerateBody();
153 bool GenerateDeferredCode(); 158 bool GenerateDeferredCode();
159 // Pad the reloc info to ensure that we have enough space to patch during
160 // deoptimization.
161 bool GenerateRelocPadding();
154 bool GenerateSafepointTable(); 162 bool GenerateSafepointTable();
155 163
156 void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr, 164 void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr,
157 bool adjusted = true); 165 bool adjusted = true);
158 void CallRuntime(Runtime::Function* fun, int argc, LInstruction* instr, 166 void CallRuntime(Runtime::Function* fun, int argc, LInstruction* instr,
159 bool adjusted = true); 167 bool adjusted = true);
160 void CallRuntime(Runtime::FunctionId id, int argc, LInstruction* instr, 168 void CallRuntime(Runtime::FunctionId id, int argc, LInstruction* instr,
161 bool adjusted = true) { 169 bool adjusted = true) {
162 Runtime::Function* function = Runtime::FunctionForId(id); 170 Runtime::Function* function = Runtime::FunctionForId(id);
163 CallRuntime(function, argc, instr, adjusted); 171 CallRuntime(function, argc, instr, adjusted);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void DoMathLog(LUnaryMathOperation* instr); 205 void DoMathLog(LUnaryMathOperation* instr);
198 void DoMathCos(LUnaryMathOperation* instr); 206 void DoMathCos(LUnaryMathOperation* instr);
199 void DoMathSin(LUnaryMathOperation* instr); 207 void DoMathSin(LUnaryMathOperation* instr);
200 208
201 // Support for recording safepoint and position information. 209 // Support for recording safepoint and position information.
202 void RecordSafepoint(LPointerMap* pointers, 210 void RecordSafepoint(LPointerMap* pointers,
203 Safepoint::Kind kind, 211 Safepoint::Kind kind,
204 int arguments, 212 int arguments,
205 int deoptimization_index); 213 int deoptimization_index);
206 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); 214 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index);
215 void RecordSafepoint(int deoptimization_index);
207 void RecordSafepointWithRegisters(LPointerMap* pointers, 216 void RecordSafepointWithRegisters(LPointerMap* pointers,
208 int arguments, 217 int arguments,
209 int deoptimization_index); 218 int deoptimization_index);
210 void RecordPosition(int position); 219 void RecordPosition(int position);
211 220
212 static Condition TokenToCondition(Token::Value op, bool is_unsigned); 221 static Condition TokenToCondition(Token::Value op, bool is_unsigned);
213 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL); 222 void EmitGoto(int block, LDeferredCode* deferred_stack_check = NULL);
214 void EmitBranch(int left_block, int right_block, Condition cc); 223 void EmitBranch(int left_block, int right_block, Condition cc);
215 void EmitCmpI(LOperand* left, LOperand* right); 224 void EmitCmpI(LOperand* left, LOperand* right);
216 void EmitNumberUntagD(Register input, XMMRegister result, LEnvironment* env); 225 void EmitNumberUntagD(Register input, XMMRegister result, LEnvironment* env);
(...skipping 27 matching lines...) Expand all
244 const ZoneList<LInstruction*>* instructions_; 253 const ZoneList<LInstruction*>* instructions_;
245 ZoneList<LEnvironment*> deoptimizations_; 254 ZoneList<LEnvironment*> deoptimizations_;
246 ZoneList<Handle<Object> > deoptimization_literals_; 255 ZoneList<Handle<Object> > deoptimization_literals_;
247 int inlined_function_count_; 256 int inlined_function_count_;
248 Scope* const scope_; 257 Scope* const scope_;
249 Status status_; 258 Status status_;
250 TranslationBuffer translations_; 259 TranslationBuffer translations_;
251 ZoneList<LDeferredCode*> deferred_; 260 ZoneList<LDeferredCode*> deferred_;
252 int osr_pc_offset_; 261 int osr_pc_offset_;
253 262
263 struct DeoptimizationRelocSize {
264 int min_size;
265 int last_pc_offset;
266 };
267
268 DeoptimizationRelocSize deoptimization_reloc_size;
269
254 // Builder that keeps track of safepoints in the code. The table 270 // Builder that keeps track of safepoints in the code. The table
255 // itself is emitted at the end of the generated code. 271 // itself is emitted at the end of the generated code.
256 SafepointTableBuilder safepoints_; 272 SafepointTableBuilder safepoints_;
257 273
258 // Compiler from a set of parallel moves to a sequential list of moves. 274 // Compiler from a set of parallel moves to a sequential list of moves.
259 LGapResolver resolver_; 275 LGapResolver resolver_;
260 276
261 friend class LDeferredCode; 277 friend class LDeferredCode;
262 friend class LEnvironment; 278 friend class LEnvironment;
263 friend class SafepointGenerator; 279 friend class SafepointGenerator;
(...skipping 22 matching lines...) Expand all
286 private: 302 private:
287 LCodeGen* codegen_; 303 LCodeGen* codegen_;
288 Label entry_; 304 Label entry_;
289 Label exit_; 305 Label exit_;
290 Label* external_exit_; 306 Label* external_exit_;
291 }; 307 };
292 308
293 } } // namespace v8::internal 309 } } // namespace v8::internal
294 310
295 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ 311 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698