| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 current_block_(-1), | 50 current_block_(-1), |
| 51 current_instruction_(-1), | 51 current_instruction_(-1), |
| 52 instructions_(chunk->instructions()), | 52 instructions_(chunk->instructions()), |
| 53 deoptimizations_(4), | 53 deoptimizations_(4), |
| 54 deoptimization_literals_(8), | 54 deoptimization_literals_(8), |
| 55 inlined_function_count_(0), | 55 inlined_function_count_(0), |
| 56 scope_(chunk->graph()->info()->scope()), | 56 scope_(chunk->graph()->info()->scope()), |
| 57 status_(UNUSED), | 57 status_(UNUSED), |
| 58 deferred_(8), | 58 deferred_(8), |
| 59 osr_pc_offset_(-1), | 59 osr_pc_offset_(-1), |
| 60 resolver_(this) { | 60 resolver_(this), |
| 61 expected_safepoint_kind_(Safepoint::kSimple) { |
| 61 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 62 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 | 65 |
| 65 // Simple accessors. | 66 // Simple accessors. |
| 66 MacroAssembler* masm() const { return masm_; } | 67 MacroAssembler* masm() const { return masm_; } |
| 67 | 68 |
| 68 // Support for converting LOperands to assembler types. | 69 // Support for converting LOperands to assembler types. |
| 69 // LOperand must be a register. | 70 // LOperand must be a register. |
| 70 Register ToRegister(LOperand* op) const; | 71 Register ToRegister(LOperand* op) const; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 161 |
| 161 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } | 162 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } |
| 162 | 163 |
| 163 // Code generation passes. Returns true if code generation should | 164 // Code generation passes. Returns true if code generation should |
| 164 // continue. | 165 // continue. |
| 165 bool GeneratePrologue(); | 166 bool GeneratePrologue(); |
| 166 bool GenerateBody(); | 167 bool GenerateBody(); |
| 167 bool GenerateDeferredCode(); | 168 bool GenerateDeferredCode(); |
| 168 bool GenerateSafepointTable(); | 169 bool GenerateSafepointTable(); |
| 169 | 170 |
| 171 enum SafepointMode { |
| 172 RECORD_SIMPLE_SAFEPOINT, |
| 173 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS |
| 174 }; |
| 175 |
| 170 void CallCode(Handle<Code> code, | 176 void CallCode(Handle<Code> code, |
| 171 RelocInfo::Mode mode, | 177 RelocInfo::Mode mode, |
| 172 LInstruction* instr); | 178 LInstruction* instr); |
| 179 |
| 180 void CallCodeGeneric(Handle<Code> code, |
| 181 RelocInfo::Mode mode, |
| 182 LInstruction* instr, |
| 183 SafepointMode safepoint_mode); |
| 184 |
| 173 void CallRuntime(Runtime::Function* function, | 185 void CallRuntime(Runtime::Function* function, |
| 174 int num_arguments, | 186 int num_arguments, |
| 175 LInstruction* instr); | 187 LInstruction* instr); |
| 188 |
| 176 void CallRuntime(Runtime::FunctionId id, | 189 void CallRuntime(Runtime::FunctionId id, |
| 177 int num_arguments, | 190 int num_arguments, |
| 178 LInstruction* instr) { | 191 LInstruction* instr) { |
| 179 Runtime::Function* function = Runtime::FunctionForId(id); | 192 Runtime::Function* function = Runtime::FunctionForId(id); |
| 180 CallRuntime(function, num_arguments, instr); | 193 CallRuntime(function, num_arguments, instr); |
| 181 } | 194 } |
| 182 | 195 |
| 196 void CallRuntimeFromDeferred(Runtime::FunctionId id, |
| 197 int argc, |
| 198 LInstruction* instr); |
| 199 |
| 183 // Generate a direct call to a known function. Expects the function | 200 // Generate a direct call to a known function. Expects the function |
| 184 // to be in edi. | 201 // to be in edi. |
| 185 void CallKnownFunction(Handle<JSFunction> function, | 202 void CallKnownFunction(Handle<JSFunction> function, |
| 186 int arity, | 203 int arity, |
| 187 LInstruction* instr); | 204 LInstruction* instr); |
| 188 | 205 |
| 189 void LoadHeapObject(Register result, Handle<HeapObject> object); | 206 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 190 | 207 |
| 191 void RegisterLazyDeoptimization(LInstruction* instr); | 208 void RegisterLazyDeoptimization(LInstruction* instr, |
| 209 SafepointMode safepoint_mode); |
| 210 |
| 192 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 211 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); |
| 193 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 212 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
| 194 | 213 |
| 195 void AddToTranslation(Translation* translation, | 214 void AddToTranslation(Translation* translation, |
| 196 LOperand* op, | 215 LOperand* op, |
| 197 bool is_tagged); | 216 bool is_tagged); |
| 198 void PopulateDeoptimizationData(Handle<Code> code); | 217 void PopulateDeoptimizationData(Handle<Code> code); |
| 199 int DefineDeoptimizationLiteral(Handle<Object> literal); | 218 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 200 | 219 |
| 201 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 220 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 ZoneList<LDeferredCode*> deferred_; | 287 ZoneList<LDeferredCode*> deferred_; |
| 269 int osr_pc_offset_; | 288 int osr_pc_offset_; |
| 270 | 289 |
| 271 // Builder that keeps track of safepoints in the code. The table | 290 // Builder that keeps track of safepoints in the code. The table |
| 272 // itself is emitted at the end of the generated code. | 291 // itself is emitted at the end of the generated code. |
| 273 SafepointTableBuilder safepoints_; | 292 SafepointTableBuilder safepoints_; |
| 274 | 293 |
| 275 // Compiler from a set of parallel moves to a sequential list of moves. | 294 // Compiler from a set of parallel moves to a sequential list of moves. |
| 276 LGapResolver resolver_; | 295 LGapResolver resolver_; |
| 277 | 296 |
| 297 Safepoint::Kind expected_safepoint_kind_; |
| 298 |
| 299 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 300 public: |
| 301 PushSafepointRegistersScope(LCodeGen* codegen, |
| 302 Safepoint::Kind kind) |
| 303 : codegen_(codegen) { |
| 304 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 305 codegen_->expected_safepoint_kind_ = kind; |
| 306 |
| 307 switch (codegen_->expected_safepoint_kind_) { |
| 308 case Safepoint::kWithRegisters: |
| 309 codegen_->masm_->PushSafepointRegisters(); |
| 310 break; |
| 311 case Safepoint::kWithRegistersAndDoubles: |
| 312 codegen_->masm_->PushSafepointRegistersAndDoubles(); |
| 313 break; |
| 314 default: |
| 315 UNREACHABLE(); |
| 316 } |
| 317 } |
| 318 |
| 319 ~PushSafepointRegistersScope() { |
| 320 Safepoint::Kind kind = codegen_->expected_safepoint_kind_; |
| 321 ASSERT((kind & Safepoint::kWithRegisters) != 0); |
| 322 switch (kind) { |
| 323 case Safepoint::kWithRegisters: |
| 324 codegen_->masm_->PopSafepointRegisters(); |
| 325 break; |
| 326 case Safepoint::kWithRegistersAndDoubles: |
| 327 codegen_->masm_->PopSafepointRegistersAndDoubles(); |
| 328 break; |
| 329 default: |
| 330 UNREACHABLE(); |
| 331 } |
| 332 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
| 333 } |
| 334 |
| 335 private: |
| 336 LCodeGen* codegen_; |
| 337 }; |
| 338 |
| 278 friend class LDeferredCode; | 339 friend class LDeferredCode; |
| 279 friend class LEnvironment; | 340 friend class LEnvironment; |
| 280 friend class SafepointGenerator; | 341 friend class SafepointGenerator; |
| 281 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 342 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 282 }; | 343 }; |
| 283 | 344 |
| 284 | 345 |
| 285 class LDeferredCode: public ZoneObject { | 346 class LDeferredCode: public ZoneObject { |
| 286 public: | 347 public: |
| 287 explicit LDeferredCode(LCodeGen* codegen) | 348 explicit LDeferredCode(LCodeGen* codegen) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 303 private: | 364 private: |
| 304 LCodeGen* codegen_; | 365 LCodeGen* codegen_; |
| 305 Label entry_; | 366 Label entry_; |
| 306 Label exit_; | 367 Label exit_; |
| 307 Label* external_exit_; | 368 Label* external_exit_; |
| 308 }; | 369 }; |
| 309 | 370 |
| 310 } } // namespace v8::internal | 371 } } // namespace v8::internal |
| 311 | 372 |
| 312 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ | 373 #endif // V8_ARM_LITHIUM_CODEGEN_ARM_H_ |
| OLD | NEW |