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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class LCodeGen BASE_EMBEDDED { | 46 class LCodeGen BASE_EMBEDDED { |
47 public: | 47 public: |
48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) | 48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) |
49 : chunk_(chunk), | 49 : chunk_(chunk), |
50 masm_(assembler), | 50 masm_(assembler), |
51 info_(info), | 51 info_(info), |
52 current_block_(-1), | 52 current_block_(-1), |
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 deoptimization_literals_(8), | 57 deoptimization_literals_(8), |
57 inlined_function_count_(0), | 58 inlined_function_count_(0), |
58 scope_(chunk->graph()->info()->scope()), | 59 scope_(chunk->graph()->info()->scope()), |
59 status_(UNUSED), | 60 status_(UNUSED), |
60 deferred_(8), | 61 deferred_(8), |
61 osr_pc_offset_(-1), | 62 osr_pc_offset_(-1), |
62 resolver_(this) { | 63 resolver_(this) { |
63 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 64 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
64 } | 65 } |
65 | 66 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void Abort(const char* format, ...); | 141 void Abort(const char* format, ...); |
141 void Comment(const char* format, ...); | 142 void Comment(const char* format, ...); |
142 | 143 |
143 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } | 144 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } |
144 | 145 |
145 // Code generation passes. Returns true if code generation should | 146 // Code generation passes. Returns true if code generation should |
146 // continue. | 147 // continue. |
147 bool GeneratePrologue(); | 148 bool GeneratePrologue(); |
148 bool GenerateBody(); | 149 bool GenerateBody(); |
149 bool GenerateDeferredCode(); | 150 bool GenerateDeferredCode(); |
| 151 bool GenerateJumpTable(); |
150 bool GenerateSafepointTable(); | 152 bool GenerateSafepointTable(); |
151 | 153 |
152 void CallCode(Handle<Code> code, | 154 void CallCode(Handle<Code> code, |
153 RelocInfo::Mode mode, | 155 RelocInfo::Mode mode, |
154 LInstruction* instr); | 156 LInstruction* instr); |
155 void CallRuntime(Runtime::Function* function, | 157 void CallRuntime(Runtime::Function* function, |
156 int num_arguments, | 158 int num_arguments, |
157 LInstruction* instr); | 159 LInstruction* instr); |
158 void CallRuntime(Runtime::FunctionId id, | 160 void CallRuntime(Runtime::FunctionId id, |
159 int num_arguments, | 161 int num_arguments, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 Label* is_not_object, | 229 Label* is_not_object, |
228 Label* is_object); | 230 Label* is_object); |
229 | 231 |
230 // Emits optimized code for %_IsConstructCall(). | 232 // Emits optimized code for %_IsConstructCall(). |
231 // Caller should branch on equal condition. | 233 // Caller should branch on equal condition. |
232 void EmitIsConstructCall(Register temp); | 234 void EmitIsConstructCall(Register temp); |
233 | 235 |
234 // Emits code for pushing a constant operand. | 236 // Emits code for pushing a constant operand. |
235 void EmitPushConstantOperand(LOperand* operand); | 237 void EmitPushConstantOperand(LOperand* operand); |
236 | 238 |
| 239 struct JumpTableEntry { |
| 240 inline JumpTableEntry(Address address) |
| 241 : label_(), |
| 242 address_(address) { } |
| 243 Label label_; |
| 244 Address address_; |
| 245 }; |
| 246 |
237 LChunk* const chunk_; | 247 LChunk* const chunk_; |
238 MacroAssembler* const masm_; | 248 MacroAssembler* const masm_; |
239 CompilationInfo* const info_; | 249 CompilationInfo* const info_; |
240 | 250 |
241 int current_block_; | 251 int current_block_; |
242 int current_instruction_; | 252 int current_instruction_; |
243 const ZoneList<LInstruction*>* instructions_; | 253 const ZoneList<LInstruction*>* instructions_; |
244 ZoneList<LEnvironment*> deoptimizations_; | 254 ZoneList<LEnvironment*> deoptimizations_; |
| 255 ZoneList<JumpTableEntry*> jump_table_; |
245 ZoneList<Handle<Object> > deoptimization_literals_; | 256 ZoneList<Handle<Object> > deoptimization_literals_; |
246 int inlined_function_count_; | 257 int inlined_function_count_; |
247 Scope* const scope_; | 258 Scope* const scope_; |
248 Status status_; | 259 Status status_; |
249 TranslationBuffer translations_; | 260 TranslationBuffer translations_; |
250 ZoneList<LDeferredCode*> deferred_; | 261 ZoneList<LDeferredCode*> deferred_; |
251 int osr_pc_offset_; | 262 int osr_pc_offset_; |
252 | 263 |
253 // Builder that keeps track of safepoints in the code. The table | 264 // Builder that keeps track of safepoints in the code. The table |
254 // itself is emitted at the end of the generated code. | 265 // itself is emitted at the end of the generated code. |
(...skipping 30 matching lines...) Expand all Loading... |
285 private: | 296 private: |
286 LCodeGen* codegen_; | 297 LCodeGen* codegen_; |
287 Label entry_; | 298 Label entry_; |
288 Label exit_; | 299 Label exit_; |
289 Label* external_exit_; | 300 Label* external_exit_; |
290 }; | 301 }; |
291 | 302 |
292 } } // namespace v8::internal | 303 } } // namespace v8::internal |
293 | 304 |
294 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 305 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
OLD | NEW |