| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // reach the end of the statement (ie, it does not exit via break, | 383 // reach the end of the statement (ie, it does not exit via break, |
| 375 // continue, return, or throw). This function is used temporarily while | 384 // continue, return, or throw). This function is used temporarily while |
| 376 // the code generator is being transformed. | 385 // the code generator is being transformed. |
| 377 void VisitAndSpill(Statement* statement); | 386 void VisitAndSpill(Statement* statement); |
| 378 | 387 |
| 379 // Visit a list of statements and then spill the virtual frame if control | 388 // Visit a list of statements and then spill the virtual frame if control |
| 380 // flow can reach the end of the list. | 389 // flow can reach the end of the list. |
| 381 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 390 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
| 382 | 391 |
| 383 // Main code generation function | 392 // Main code generation function |
| 384 void GenCode(FunctionLiteral* fun, CompilationInfo* info); | 393 void Generate(FunctionLiteral* fun, Mode mode, CompilationInfo* info); |
| 385 | 394 |
| 386 // Generate the return sequence code. Should be called no more than | 395 // Generate the return sequence code. Should be called no more than |
| 387 // once per compiled function, immediately after binding the return | 396 // once per compiled function, immediately after binding the return |
| 388 // target (which can not be done more than once). | 397 // target (which can not be done more than once). |
| 389 void GenerateReturnSequence(Result* return_value); | 398 void GenerateReturnSequence(Result* return_value); |
| 390 | 399 |
| 391 // Returns the arguments allocation mode. | 400 // Returns the arguments allocation mode. |
| 392 ArgumentsAllocationMode ArgumentsMode() const; | 401 ArgumentsAllocationMode ArgumentsMode() const; |
| 393 | 402 |
| 394 // Store the arguments object and allocate it if necessary. | 403 // Store the arguments object and allocate it if necessary. |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 Major MajorKey() { return StringCompare; } | 823 Major MajorKey() { return StringCompare; } |
| 815 int MinorKey() { return 0; } | 824 int MinorKey() { return 0; } |
| 816 | 825 |
| 817 void Generate(MacroAssembler* masm); | 826 void Generate(MacroAssembler* masm); |
| 818 }; | 827 }; |
| 819 | 828 |
| 820 | 829 |
| 821 } } // namespace v8::internal | 830 } } // namespace v8::internal |
| 822 | 831 |
| 823 #endif // V8_X64_CODEGEN_X64_H_ | 832 #endif // V8_X64_CODEGEN_X64_H_ |
| OLD | NEW |