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