OLD | NEW |
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // Code generation passes. Returns true if code generation should | 157 // Code generation passes. Returns true if code generation should |
158 // continue. | 158 // continue. |
159 bool GeneratePrologue(); | 159 bool GeneratePrologue(); |
160 bool GenerateBody(); | 160 bool GenerateBody(); |
161 bool GenerateDeferredCode(); | 161 bool GenerateDeferredCode(); |
162 // Pad the reloc info to ensure that we have enough space to patch during | 162 // Pad the reloc info to ensure that we have enough space to patch during |
163 // deoptimization. | 163 // deoptimization. |
164 bool GenerateRelocPadding(); | 164 bool GenerateRelocPadding(); |
165 bool GenerateSafepointTable(); | 165 bool GenerateSafepointTable(); |
166 | 166 |
167 void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr, | 167 enum ContextMode { |
168 bool adjusted = true); | 168 RESTORE_CONTEXT, |
169 void CallRuntime(const Runtime::Function* fun, int argc, LInstruction* instr, | 169 CONTEXT_ADJUSTED |
170 bool adjusted = true); | 170 }; |
171 void CallRuntime(Runtime::FunctionId id, int argc, LInstruction* instr, | 171 |
172 bool adjusted = true) { | 172 enum SafepointMode { |
| 173 RECORD_SIMPLE_SAFEPOINT, |
| 174 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS |
| 175 }; |
| 176 |
| 177 void CallCode(Handle<Code> code, |
| 178 RelocInfo::Mode mode, |
| 179 LInstruction* instr, |
| 180 ContextMode context_mode); |
| 181 |
| 182 void CallCodeGeneric(Handle<Code> code, |
| 183 RelocInfo::Mode mode, |
| 184 LInstruction* instr, |
| 185 ContextMode context_mode, |
| 186 SafepointMode safepoint_mode); |
| 187 |
| 188 void CallRuntime(const Runtime::Function* fun, |
| 189 int argc, |
| 190 LInstruction* instr, |
| 191 ContextMode context_mode); |
| 192 |
| 193 void CallRuntime(Runtime::FunctionId id, |
| 194 int argc, |
| 195 LInstruction* instr, |
| 196 ContextMode context_mode) { |
173 const Runtime::Function* function = Runtime::FunctionForId(id); | 197 const Runtime::Function* function = Runtime::FunctionForId(id); |
174 CallRuntime(function, argc, instr, adjusted); | 198 CallRuntime(function, argc, instr, context_mode); |
175 } | 199 } |
176 | 200 |
| 201 void CallRuntimeFromDeferred(Runtime::FunctionId id, |
| 202 int argc, |
| 203 LInstruction* instr); |
| 204 |
177 // Generate a direct call to a known function. Expects the function | 205 // Generate a direct call to a known function. Expects the function |
178 // to be in edi. | 206 // to be in edi. |
179 void CallKnownFunction(Handle<JSFunction> function, | 207 void CallKnownFunction(Handle<JSFunction> function, |
180 int arity, | 208 int arity, |
181 LInstruction* instr); | 209 LInstruction* instr); |
182 | 210 |
183 void LoadHeapObject(Register result, Handle<HeapObject> object); | 211 void LoadHeapObject(Register result, Handle<HeapObject> object); |
184 | 212 |
185 void RegisterLazyDeoptimization(LInstruction* instr); | 213 void RegisterLazyDeoptimization(LInstruction* instr, |
| 214 SafepointMode safepoint_mode); |
| 215 |
186 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 216 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); |
187 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 217 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
188 | 218 |
189 void AddToTranslation(Translation* translation, | 219 void AddToTranslation(Translation* translation, |
190 LOperand* op, | 220 LOperand* op, |
191 bool is_tagged); | 221 bool is_tagged); |
192 void PopulateDeoptimizationData(Handle<Code> code); | 222 void PopulateDeoptimizationData(Handle<Code> code); |
193 int DefineDeoptimizationLiteral(Handle<Object> literal); | 223 int DefineDeoptimizationLiteral(Handle<Object> literal); |
194 | 224 |
195 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 225 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 304 |
275 DeoptimizationRelocSize deoptimization_reloc_size; | 305 DeoptimizationRelocSize deoptimization_reloc_size; |
276 | 306 |
277 // Builder that keeps track of safepoints in the code. The table | 307 // Builder that keeps track of safepoints in the code. The table |
278 // itself is emitted at the end of the generated code. | 308 // itself is emitted at the end of the generated code. |
279 SafepointTableBuilder safepoints_; | 309 SafepointTableBuilder safepoints_; |
280 | 310 |
281 // Compiler from a set of parallel moves to a sequential list of moves. | 311 // Compiler from a set of parallel moves to a sequential list of moves. |
282 LGapResolver resolver_; | 312 LGapResolver resolver_; |
283 | 313 |
| 314 bool safepoint_registers_pushed_; |
| 315 |
| 316 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 317 public: |
| 318 PushSafepointRegistersScope(LCodeGen* codegen) : codegen_(codegen) { |
| 319 ASSERT(!codegen_->safepoint_registers_pushed_); |
| 320 codegen_->safepoint_registers_pushed_ = true; |
| 321 codegen_->masm_->PushSafepointRegisters(); |
| 322 } |
| 323 |
| 324 ~PushSafepointRegistersScope() { |
| 325 ASSERT(codegen_->safepoint_registers_pushed_); |
| 326 codegen_->safepoint_registers_pushed_ = false; |
| 327 codegen_->masm_->PopSafepointRegisters(); |
| 328 } |
| 329 |
| 330 private: |
| 331 LCodeGen* codegen_; |
| 332 }; |
| 333 |
284 friend class LDeferredCode; | 334 friend class LDeferredCode; |
285 friend class LEnvironment; | 335 friend class LEnvironment; |
286 friend class SafepointGenerator; | 336 friend class SafepointGenerator; |
287 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 337 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
288 }; | 338 }; |
289 | 339 |
290 | 340 |
291 class LDeferredCode: public ZoneObject { | 341 class LDeferredCode: public ZoneObject { |
292 public: | 342 public: |
293 explicit LDeferredCode(LCodeGen* codegen) | 343 explicit LDeferredCode(LCodeGen* codegen) |
(...skipping 15 matching lines...) Expand all Loading... |
309 private: | 359 private: |
310 LCodeGen* codegen_; | 360 LCodeGen* codegen_; |
311 Label entry_; | 361 Label entry_; |
312 Label exit_; | 362 Label exit_; |
313 Label* external_exit_; | 363 Label* external_exit_; |
314 }; | 364 }; |
315 | 365 |
316 } } // namespace v8::internal | 366 } } // namespace v8::internal |
317 | 367 |
318 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 368 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
OLD | NEW |