| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 467 |
| 468 // To prevent long attacker-controlled byte sequences, integer constants | 468 // To prevent long attacker-controlled byte sequences, integer constants |
| 469 // from the JavaScript source are loaded in two parts if they are larger | 469 // from the JavaScript source are loaded in two parts if they are larger |
| 470 // than 16 bits. | 470 // than 16 bits. |
| 471 static const int kMaxSmiInlinedBits = 16; | 471 static const int kMaxSmiInlinedBits = 16; |
| 472 bool IsUnsafeSmi(Handle<Object> value); | 472 bool IsUnsafeSmi(Handle<Object> value); |
| 473 // Load an integer constant x into a register target using | 473 // Load an integer constant x into a register target using |
| 474 // at most 16 bits of user-controlled data per assembly operation. | 474 // at most 16 bits of user-controlled data per assembly operation. |
| 475 void LoadUnsafeSmi(Register target, Handle<Object> value); | 475 void LoadUnsafeSmi(Register target, Handle<Object> value); |
| 476 | 476 |
| 477 void CallWithArguments(ZoneList<Expression*>* arguments, int position); | 477 void CallWithArguments(ZoneList<Expression*>* arguments, |
| 478 CallFunctionFlags flags, |
| 479 int position); |
| 478 | 480 |
| 479 // Use an optimized version of Function.prototype.apply that avoid | 481 // Use an optimized version of Function.prototype.apply that avoid |
| 480 // allocating the arguments object and just copies the arguments | 482 // allocating the arguments object and just copies the arguments |
| 481 // from the stack. | 483 // from the stack. |
| 482 void CallApplyLazy(Property* apply, | 484 void CallApplyLazy(Property* apply, |
| 483 Expression* receiver, | 485 Expression* receiver, |
| 484 VariableProxy* arguments, | 486 VariableProxy* arguments, |
| 485 int position); | 487 int position); |
| 486 | 488 |
| 487 void CheckStack(); | 489 void CheckStack(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 friend class Result; | 612 friend class Result; |
| 611 friend class FastCodeGenerator; | 613 friend class FastCodeGenerator; |
| 612 friend class CodeGenSelector; | 614 friend class CodeGenSelector; |
| 613 | 615 |
| 614 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc | 616 friend class CodeGeneratorPatcher; // Used in test-log-stack-tracer.cc |
| 615 | 617 |
| 616 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 618 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 617 }; | 619 }; |
| 618 | 620 |
| 619 | 621 |
| 620 // ------------------------------------------------------------------------- | |
| 621 // Code stubs | |
| 622 // | |
| 623 // These independent code objects are created once, and used multiple | |
| 624 // times by generated code to perform common tasks, often the slow | |
| 625 // case of a JavaScript operation. They are all subclasses of CodeStub, | |
| 626 // which is declared in code-stubs.h. | |
| 627 class CallFunctionStub: public CodeStub { | |
| 628 public: | |
| 629 CallFunctionStub(int argc, InLoopFlag in_loop) | |
| 630 : argc_(argc), in_loop_(in_loop) { } | |
| 631 | |
| 632 void Generate(MacroAssembler* masm); | |
| 633 | |
| 634 private: | |
| 635 int argc_; | |
| 636 InLoopFlag in_loop_; | |
| 637 | |
| 638 #ifdef DEBUG | |
| 639 void Print() { PrintF("CallFunctionStub (args %d)\n", argc_); } | |
| 640 #endif | |
| 641 | |
| 642 Major MajorKey() { return CallFunction; } | |
| 643 int MinorKey() { return argc_; } | |
| 644 InLoopFlag InLoop() { return in_loop_; } | |
| 645 }; | |
| 646 | |
| 647 | |
| 648 class ToBooleanStub: public CodeStub { | |
| 649 public: | |
| 650 ToBooleanStub() { } | |
| 651 | |
| 652 void Generate(MacroAssembler* masm); | |
| 653 | |
| 654 private: | |
| 655 Major MajorKey() { return ToBoolean; } | |
| 656 int MinorKey() { return 0; } | |
| 657 }; | |
| 658 | |
| 659 | |
| 660 // Flag that indicates how to generate code for the stub GenericBinaryOpStub. | 622 // Flag that indicates how to generate code for the stub GenericBinaryOpStub. |
| 661 enum GenericBinaryFlags { | 623 enum GenericBinaryFlags { |
| 662 NO_GENERIC_BINARY_FLAGS = 0, | 624 NO_GENERIC_BINARY_FLAGS = 0, |
| 663 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. | 625 NO_SMI_CODE_IN_STUB = 1 << 0 // Omit smi code in stub. |
| 664 }; | 626 }; |
| 665 | 627 |
| 666 | 628 |
| 667 class GenericBinaryOpStub: public CodeStub { | 629 class GenericBinaryOpStub: public CodeStub { |
| 668 public: | 630 public: |
| 669 GenericBinaryOpStub(Token::Value op, | 631 GenericBinaryOpStub(Token::Value op, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 bool ascii); | 738 bool ascii); |
| 777 | 739 |
| 778 // Should the stub check whether arguments are strings? | 740 // Should the stub check whether arguments are strings? |
| 779 bool string_check_; | 741 bool string_check_; |
| 780 }; | 742 }; |
| 781 | 743 |
| 782 | 744 |
| 783 } } // namespace v8::internal | 745 } } // namespace v8::internal |
| 784 | 746 |
| 785 #endif // V8_X64_CODEGEN_X64_H_ | 747 #endif // V8_X64_CODEGEN_X64_H_ |
| OLD | NEW |