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 |
297 // Takes a function literal, generates code for it. This function should only | 306 // Takes a function literal, generates code for it. This function should only |
298 // be called by compiler.cc. | 307 // be called by compiler.cc. |
299 static Handle<Code> MakeCode(FunctionLiteral* fun, | 308 static Handle<Code> MakeCode(FunctionLiteral* fun, |
300 Handle<Script> script, | 309 Handle<Script> script, |
301 bool is_eval, | 310 bool is_eval, |
302 CompilationInfo* info); | 311 CompilationInfo* info); |
303 | 312 |
304 // Printing of AST, etc. as requested by flags. | 313 // Printing of AST, etc. as requested by flags. |
305 static void MakeCodePrologue(FunctionLiteral* fun); | 314 static void MakeCodePrologue(FunctionLiteral* fun); |
306 | 315 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // reach the end of the statement (ie, it does not exit via break, | 381 // reach the end of the statement (ie, it does not exit via break, |
373 // continue, return, or throw). This function is used temporarily while | 382 // continue, return, or throw). This function is used temporarily while |
374 // the code generator is being transformed. | 383 // the code generator is being transformed. |
375 void VisitAndSpill(Statement* statement); | 384 void VisitAndSpill(Statement* statement); |
376 | 385 |
377 // Visit a list of statements and then spill the virtual frame if control | 386 // Visit a list of statements and then spill the virtual frame if control |
378 // flow can reach the end of the list. | 387 // flow can reach the end of the list. |
379 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 388 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
380 | 389 |
381 // Main code generation function | 390 // Main code generation function |
382 void GenCode(FunctionLiteral* fun, CompilationInfo* info); | 391 void Generate(FunctionLiteral* fun, Mode mode, CompilationInfo* info); |
383 | 392 |
384 // Generate the return sequence code. Should be called no more than | 393 // Generate the return sequence code. Should be called no more than |
385 // once per compiled function, immediately after binding the return | 394 // once per compiled function, immediately after binding the return |
386 // target (which can not be done more than once). | 395 // target (which can not be done more than once). |
387 void GenerateReturnSequence(Result* return_value); | 396 void GenerateReturnSequence(Result* return_value); |
388 | 397 |
389 // Returns the arguments allocation mode. | 398 // Returns the arguments allocation mode. |
390 ArgumentsAllocationMode ArgumentsMode() const; | 399 ArgumentsAllocationMode ArgumentsMode() const; |
391 | 400 |
392 // Store the arguments object and allocate it if necessary. | 401 // Store the arguments object and allocate it if necessary. |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 Major MajorKey() { return StringCompare; } | 829 Major MajorKey() { return StringCompare; } |
821 int MinorKey() { return 0; } | 830 int MinorKey() { return 0; } |
822 | 831 |
823 void Generate(MacroAssembler* masm); | 832 void Generate(MacroAssembler* masm); |
824 }; | 833 }; |
825 | 834 |
826 | 835 |
827 } } // namespace v8::internal | 836 } } // namespace v8::internal |
828 | 837 |
829 #endif // V8_IA32_CODEGEN_IA32_H_ | 838 #endif // V8_IA32_CODEGEN_IA32_H_ |
OLD | NEW |