| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // A control destination in case the expression has a control-flow | 266 // A control destination in case the expression has a control-flow |
| 267 // effect. | 267 // effect. |
| 268 ControlDestination* destination_; | 268 ControlDestination* destination_; |
| 269 | 269 |
| 270 // The previous state of the owning code generator, restored when | 270 // The previous state of the owning code generator, restored when |
| 271 // this state is destroyed. | 271 // this state is destroyed. |
| 272 CodeGenState* previous_; | 272 CodeGenState* previous_; |
| 273 }; | 273 }; |
| 274 | 274 |
| 275 | 275 |
| 276 // ------------------------------------------------------------------------- |
| 277 // Arguments allocation mode |
| 278 |
| 279 enum ArgumentsAllocationMode { |
| 280 NO_ARGUMENTS_ALLOCATION, |
| 281 EAGER_ARGUMENTS_ALLOCATION, |
| 282 LAZY_ARGUMENTS_ALLOCATION |
| 283 }; |
| 276 | 284 |
| 277 | 285 |
| 278 // ------------------------------------------------------------------------- | 286 // ------------------------------------------------------------------------- |
| 279 // CodeGenerator | 287 // CodeGenerator |
| 280 | 288 |
| 281 class CodeGenerator: public AstVisitor { | 289 class CodeGenerator: public AstVisitor { |
| 282 public: | 290 public: |
| 283 // Takes a function literal, generates code for it. This function should only | 291 // Takes a function literal, generates code for it. This function should only |
| 284 // be called by compiler.cc. | 292 // be called by compiler.cc. |
| 285 static Handle<Code> MakeCode(FunctionLiteral* fun, | 293 static Handle<Code> MakeCode(FunctionLiteral* fun, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | 384 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); |
| 377 | 385 |
| 378 // Main code generation function | 386 // Main code generation function |
| 379 void GenCode(FunctionLiteral* fun); | 387 void GenCode(FunctionLiteral* fun); |
| 380 | 388 |
| 381 // Generate the return sequence code. Should be called no more than | 389 // Generate the return sequence code. Should be called no more than |
| 382 // once per compiled function, immediately after binding the return | 390 // once per compiled function, immediately after binding the return |
| 383 // target (which can not be done more than once). | 391 // target (which can not be done more than once). |
| 384 void GenerateReturnSequence(Result* return_value); | 392 void GenerateReturnSequence(Result* return_value); |
| 385 | 393 |
| 394 // Returns the arguments allocation mode. |
| 395 ArgumentsAllocationMode ArgumentsMode() const; |
| 396 |
| 397 // Store the arguments object and allocate it if necessary. |
| 398 Result StoreArgumentsObject(bool initial); |
| 399 |
| 386 // The following are used by class Reference. | 400 // The following are used by class Reference. |
| 387 void LoadReference(Reference* ref); | 401 void LoadReference(Reference* ref); |
| 388 void UnloadReference(Reference* ref); | 402 void UnloadReference(Reference* ref); |
| 389 | 403 |
| 390 Operand ContextOperand(Register context, int index) const { | 404 Operand ContextOperand(Register context, int index) const { |
| 391 return Operand(context, Context::SlotOffset(index)); | 405 return Operand(context, Context::SlotOffset(index)); |
| 392 } | 406 } |
| 393 | 407 |
| 394 Operand SlotOperand(Slot* slot, Register tmp); | 408 Operand SlotOperand(Slot* slot, Register tmp); |
| 395 | 409 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 friend class Reference; | 649 friend class Reference; |
| 636 friend class Result; | 650 friend class Result; |
| 637 | 651 |
| 638 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 652 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 639 }; | 653 }; |
| 640 | 654 |
| 641 | 655 |
| 642 } } // namespace v8::internal | 656 } } // namespace v8::internal |
| 643 | 657 |
| 644 #endif // V8_X64_CODEGEN_X64_H_ | 658 #endif // V8_X64_CODEGEN_X64_H_ |
| OLD | NEW |