OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 public: | 608 public: |
609 explicit ConstructStubCompiler() {} | 609 explicit ConstructStubCompiler() {} |
610 | 610 |
611 Object* CompileConstructStub(SharedFunctionInfo* shared); | 611 Object* CompileConstructStub(SharedFunctionInfo* shared); |
612 | 612 |
613 private: | 613 private: |
614 Object* GetCode(); | 614 Object* GetCode(); |
615 }; | 615 }; |
616 | 616 |
617 | 617 |
| 618 // Holds information about possible function call optimizations. |
| 619 class CallOptimization BASE_EMBEDDED { |
| 620 public: |
| 621 explicit CallOptimization(LookupResult* lookup); |
| 622 |
| 623 explicit CallOptimization(JSFunction* function); |
| 624 |
| 625 bool is_constant_call() const { |
| 626 return constant_function_ != NULL; |
| 627 } |
| 628 |
| 629 JSFunction* constant_function() const { |
| 630 ASSERT(constant_function_ != NULL); |
| 631 return constant_function_; |
| 632 } |
| 633 |
| 634 bool is_simple_api_call() const { |
| 635 return is_simple_api_call_; |
| 636 } |
| 637 |
| 638 FunctionTemplateInfo* expected_receiver_type() const { |
| 639 ASSERT(is_simple_api_call_); |
| 640 return expected_receiver_type_; |
| 641 } |
| 642 |
| 643 CallHandlerInfo* api_call_info() const { |
| 644 ASSERT(is_simple_api_call_); |
| 645 return api_call_info_; |
| 646 } |
| 647 |
| 648 // Returns the depth of the object having the expected type in the |
| 649 // prototype chain between the two arguments. |
| 650 int GetPrototypeDepthOfExpectedType(JSObject* object, |
| 651 JSObject* holder) const; |
| 652 |
| 653 private: |
| 654 void Initialize(JSFunction* function); |
| 655 |
| 656 // Determines whether the given function can be called using the |
| 657 // fast api call builtin. |
| 658 void AnalyzePossibleApiFunction(JSFunction* function); |
| 659 |
| 660 JSFunction* constant_function_; |
| 661 bool is_simple_api_call_; |
| 662 FunctionTemplateInfo* expected_receiver_type_; |
| 663 CallHandlerInfo* api_call_info_; |
| 664 }; |
| 665 |
| 666 |
618 typedef Object* (*CustomCallGenerator)(CallStubCompiler* compiler, | 667 typedef Object* (*CustomCallGenerator)(CallStubCompiler* compiler, |
619 Object* object, | 668 Object* object, |
620 JSObject* holder, | 669 JSObject* holder, |
621 JSFunction* function, | 670 JSFunction* function, |
622 String* name, | 671 String* name, |
623 StubCompiler::CheckType check); | 672 StubCompiler::CheckType check); |
624 | 673 |
625 | 674 |
626 Object* CompileArrayPushCall(CallStubCompiler* compiler, | 675 Object* CompileArrayPushCall(CallStubCompiler* compiler, |
627 Object* object, | 676 Object* object, |
628 JSObject* holder, | 677 JSObject* holder, |
629 JSFunction* function, | 678 JSFunction* function, |
630 String* name, | 679 String* name, |
631 StubCompiler::CheckType check); | 680 StubCompiler::CheckType check); |
632 | 681 |
633 | 682 |
634 Object* CompileArrayPopCall(CallStubCompiler* compiler, | 683 Object* CompileArrayPopCall(CallStubCompiler* compiler, |
635 Object* object, | 684 Object* object, |
636 JSObject* holder, | 685 JSObject* holder, |
637 JSFunction* function, | 686 JSFunction* function, |
638 String* name, | 687 String* name, |
639 StubCompiler::CheckType check); | 688 StubCompiler::CheckType check); |
640 | 689 |
641 | 690 |
642 } } // namespace v8::internal | 691 } } // namespace v8::internal |
643 | 692 |
644 #endif // V8_STUB_CACHE_H_ | 693 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |