OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 EAGER_ARGUMENTS_ALLOCATION, | 287 EAGER_ARGUMENTS_ALLOCATION, |
288 LAZY_ARGUMENTS_ALLOCATION | 288 LAZY_ARGUMENTS_ALLOCATION |
289 }; | 289 }; |
290 | 290 |
291 | 291 |
292 // ------------------------------------------------------------------------- | 292 // ------------------------------------------------------------------------- |
293 // CodeGenerator | 293 // CodeGenerator |
294 | 294 |
295 class CodeGenerator: public AstVisitor { | 295 class CodeGenerator: public AstVisitor { |
296 public: | 296 public: |
297 // Compilation mode. Either the compiler is used as the primary | |
298 // compiler and needs to setup everything or the compiler is used as | |
299 // the secondary compiler for split compilation and has to handle | |
300 // bailouts. | |
301 enum Mode { | |
302 PRIMARY, | |
303 SECONDARY | |
304 }; | |
305 | |
306 // Takes a function literal, generates code for it. This function should only | 297 // Takes a function literal, generates code for it. This function should only |
307 // be called by compiler.cc. | 298 // be called by compiler.cc. |
308 static Handle<Code> MakeCode(CompilationInfo* info); | 299 static Handle<Code> MakeCode(CompilationInfo* info); |
309 | 300 |
310 // Printing of AST, etc. as requested by flags. | 301 // Printing of AST, etc. as requested by flags. |
311 static void MakeCodePrologue(CompilationInfo* info); | 302 static void MakeCodePrologue(CompilationInfo* info); |
312 | 303 |
313 // Allocate and install the code. | 304 // Allocate and install the code. |
314 static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, | 305 static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, |
315 Code::Flags flags, | 306 Code::Flags flags, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 // reach the end of the statement (ie, it does not exit via break, | 368 // reach the end of the statement (ie, it does not exit via break, |
378 // continue, return, or throw). This function is used temporarily while | 369 // continue, return, or throw). This function is used temporarily while |
379 // the code generator is being transformed. | 370 // the code generator is being transformed. |
380 void VisitAndSpill(Statement* statement); | 371 void VisitAndSpill(Statement* statement); |
381 | 372 |
382 // Visit a list of statements and then spill the virtual frame if control | 373 // Visit a list of statements and then spill the virtual frame if control |
383 // flow can reach the end of the list. | 374 // flow can reach the end of the list. |
384 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 375 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
385 | 376 |
386 // Main code generation function | 377 // Main code generation function |
387 void Generate(CompilationInfo* info, Mode mode); | 378 void Generate(CompilationInfo* info); |
388 | 379 |
389 // Generate the return sequence code. Should be called no more than | 380 // Generate the return sequence code. Should be called no more than |
390 // once per compiled function, immediately after binding the return | 381 // once per compiled function, immediately after binding the return |
391 // target (which can not be done more than once). | 382 // target (which can not be done more than once). |
392 void GenerateReturnSequence(Result* return_value); | 383 void GenerateReturnSequence(Result* return_value); |
393 | 384 |
394 // Returns the arguments allocation mode. | 385 // Returns the arguments allocation mode. |
395 ArgumentsAllocationMode ArgumentsMode(); | 386 ArgumentsAllocationMode ArgumentsMode(); |
396 | 387 |
397 // Store the arguments object and allocate it if necessary. | 388 // Store the arguments object and allocate it if necessary. |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 void Print() { | 896 void Print() { |
906 PrintF("NumberToStringStub\n"); | 897 PrintF("NumberToStringStub\n"); |
907 } | 898 } |
908 #endif | 899 #endif |
909 }; | 900 }; |
910 | 901 |
911 | 902 |
912 } } // namespace v8::internal | 903 } } // namespace v8::internal |
913 | 904 |
914 #endif // V8_IA32_CODEGEN_IA32_H_ | 905 #endif // V8_IA32_CODEGEN_IA32_H_ |
OLD | NEW |