| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 current_instruction_(-1), | 53 current_instruction_(-1), |
| 54 instructions_(chunk->instructions()), | 54 instructions_(chunk->instructions()), |
| 55 deoptimizations_(4), | 55 deoptimizations_(4), |
| 56 jump_table_(4), | 56 jump_table_(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_(chunk->graph()->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 resolver_(this) { | 63 resolver_(this), |
| 64 expected_safepoint_kind_(Safepoint::kSimple) { |
| 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_; } |
| 69 | 70 |
| 70 // Support for converting LOperands to assembler types. | 71 // Support for converting LOperands to assembler types. |
| 71 Register ToRegister(LOperand* op) const; | 72 Register ToRegister(LOperand* op) const; |
| 72 XMMRegister ToDoubleRegister(LOperand* op) const; | 73 XMMRegister ToDoubleRegister(LOperand* op) const; |
| 73 bool IsInteger32Constant(LConstantOperand* op) const; | 74 bool IsInteger32Constant(LConstantOperand* op) const; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } | 145 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } |
| 145 | 146 |
| 146 // Code generation passes. Returns true if code generation should | 147 // Code generation passes. Returns true if code generation should |
| 147 // continue. | 148 // continue. |
| 148 bool GeneratePrologue(); | 149 bool GeneratePrologue(); |
| 149 bool GenerateBody(); | 150 bool GenerateBody(); |
| 150 bool GenerateDeferredCode(); | 151 bool GenerateDeferredCode(); |
| 151 bool GenerateJumpTable(); | 152 bool GenerateJumpTable(); |
| 152 bool GenerateSafepointTable(); | 153 bool GenerateSafepointTable(); |
| 153 | 154 |
| 155 enum SafepointMode { |
| 156 RECORD_SIMPLE_SAFEPOINT, |
| 157 RECORD_SAFEPOINT_WITH_REGISTERS |
| 158 }; |
| 159 |
| 160 void CallCodeGeneric(Handle<Code> code, |
| 161 RelocInfo::Mode mode, |
| 162 LInstruction* instr, |
| 163 SafepointMode safepoint_mode, |
| 164 int argc); |
| 165 |
| 166 |
| 154 void CallCode(Handle<Code> code, | 167 void CallCode(Handle<Code> code, |
| 155 RelocInfo::Mode mode, | 168 RelocInfo::Mode mode, |
| 156 LInstruction* instr); | 169 LInstruction* instr); |
| 170 |
| 157 void CallRuntime(Runtime::Function* function, | 171 void CallRuntime(Runtime::Function* function, |
| 158 int num_arguments, | 172 int num_arguments, |
| 159 LInstruction* instr); | 173 LInstruction* instr); |
| 174 |
| 160 void CallRuntime(Runtime::FunctionId id, | 175 void CallRuntime(Runtime::FunctionId id, |
| 161 int num_arguments, | 176 int num_arguments, |
| 162 LInstruction* instr) { | 177 LInstruction* instr) { |
| 163 Runtime::Function* function = Runtime::FunctionForId(id); | 178 Runtime::Function* function = Runtime::FunctionForId(id); |
| 164 CallRuntime(function, num_arguments, instr); | 179 CallRuntime(function, num_arguments, instr); |
| 165 } | 180 } |
| 166 | 181 |
| 182 void CallRuntimeFromDeferred(Runtime::FunctionId id, |
| 183 int argc, |
| 184 LInstruction* instr); |
| 185 |
| 186 |
| 167 // Generate a direct call to a known function. Expects the function | 187 // Generate a direct call to a known function. Expects the function |
| 168 // to be in edi. | 188 // to be in edi. |
| 169 void CallKnownFunction(Handle<JSFunction> function, | 189 void CallKnownFunction(Handle<JSFunction> function, |
| 170 int arity, | 190 int arity, |
| 171 LInstruction* instr); | 191 LInstruction* instr); |
| 172 | 192 |
| 173 void LoadHeapObject(Register result, Handle<HeapObject> object); | 193 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 174 | 194 |
| 175 void RegisterLazyDeoptimization(LInstruction* instr); | 195 void RegisterLazyDeoptimization(LInstruction* instr, |
| 196 SafepointMode safepoint_mode, |
| 197 int argc); |
| 176 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 198 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); |
| 177 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 199 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
| 178 | 200 |
| 179 void AddToTranslation(Translation* translation, | 201 void AddToTranslation(Translation* translation, |
| 180 LOperand* op, | 202 LOperand* op, |
| 181 bool is_tagged); | 203 bool is_tagged); |
| 182 void PopulateDeoptimizationData(Handle<Code> code); | 204 void PopulateDeoptimizationData(Handle<Code> code); |
| 183 int DefineDeoptimizationLiteral(Handle<Object> literal); | 205 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 184 | 206 |
| 185 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 207 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 ZoneList<LDeferredCode*> deferred_; | 283 ZoneList<LDeferredCode*> deferred_; |
| 262 int osr_pc_offset_; | 284 int osr_pc_offset_; |
| 263 | 285 |
| 264 // Builder that keeps track of safepoints in the code. The table | 286 // Builder that keeps track of safepoints in the code. The table |
| 265 // itself is emitted at the end of the generated code. | 287 // itself is emitted at the end of the generated code. |
| 266 SafepointTableBuilder safepoints_; | 288 SafepointTableBuilder safepoints_; |
| 267 | 289 |
| 268 // Compiler from a set of parallel moves to a sequential list of moves. | 290 // Compiler from a set of parallel moves to a sequential list of moves. |
| 269 LGapResolver resolver_; | 291 LGapResolver resolver_; |
| 270 | 292 |
| 293 Safepoint::Kind expected_safepoint_kind_; |
| 294 |
| 295 class PushSafepointRegistersScope BASE_EMBEDDED { |
| 296 public: |
| 297 explicit PushSafepointRegistersScope(LCodeGen* codegen) |
| 298 : codegen_(codegen) { |
| 299 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); |
| 300 codegen_->masm_->PushSafepointRegisters(); |
| 301 codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; |
| 302 } |
| 303 |
| 304 ~PushSafepointRegistersScope() { |
| 305 ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); |
| 306 codegen_->masm_->PopSafepointRegisters(); |
| 307 codegen_->expected_safepoint_kind_ = Safepoint::kSimple; |
| 308 } |
| 309 |
| 310 private: |
| 311 LCodeGen* codegen_; |
| 312 }; |
| 313 |
| 271 friend class LDeferredCode; | 314 friend class LDeferredCode; |
| 272 friend class LEnvironment; | 315 friend class LEnvironment; |
| 273 friend class SafepointGenerator; | 316 friend class SafepointGenerator; |
| 274 DISALLOW_COPY_AND_ASSIGN(LCodeGen); | 317 DISALLOW_COPY_AND_ASSIGN(LCodeGen); |
| 275 }; | 318 }; |
| 276 | 319 |
| 277 | 320 |
| 278 class LDeferredCode: public ZoneObject { | 321 class LDeferredCode: public ZoneObject { |
| 279 public: | 322 public: |
| 280 explicit LDeferredCode(LCodeGen* codegen) | 323 explicit LDeferredCode(LCodeGen* codegen) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 296 private: | 339 private: |
| 297 LCodeGen* codegen_; | 340 LCodeGen* codegen_; |
| 298 Label entry_; | 341 Label entry_; |
| 299 Label exit_; | 342 Label exit_; |
| 300 Label* external_exit_; | 343 Label* external_exit_; |
| 301 }; | 344 }; |
| 302 | 345 |
| 303 } } // namespace v8::internal | 346 } } // namespace v8::internal |
| 304 | 347 |
| 305 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 348 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
| OLD | NEW |