Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: src/ic.h

Issue 16957004: Migrate BinaryOpICs and UnaryOpICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/ic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 public: 677 public:
678 // sorted: increasingly more unspecific (ignoring UNINITIALIZED) 678 // sorted: increasingly more unspecific (ignoring UNINITIALIZED)
679 // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead. 679 // TODO(svenpanne) Using enums+switch is an antipattern, use a class instead.
680 enum TypeInfo { 680 enum TypeInfo {
681 UNINITIALIZED, 681 UNINITIALIZED,
682 SMI, 682 SMI,
683 NUMBER, 683 NUMBER,
684 GENERIC 684 GENERIC
685 }; 685 };
686 686
687 static Handle<Type> TypeInfoToType(TypeInfo info, Isolate* isolate);
688
687 explicit UnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } 689 explicit UnaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
688 690
689 void patch(Code* code); 691 void patch(Code* code);
690 692
691 static const char* GetName(TypeInfo type_info); 693 static const char* GetName(TypeInfo type_info);
692 694
693 static State ToState(TypeInfo type_info); 695 static State ToState(TypeInfo type_info);
694 696
695 static TypeInfo GetTypeInfo(Handle<Object> operand); 697 static TypeInfo GetTypeInfo(Handle<Object> operand);
696 698
697 static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous); 699 static TypeInfo ComputeNewType(TypeInfo type, TypeInfo previous);
698 }; 700 };
699 701
700 702
701 // Type Recording BinaryOpIC, that records the types of the inputs and outputs. 703 // Type Recording BinaryOpIC, that records the types of the inputs and outputs.
702 class BinaryOpIC: public IC { 704 class BinaryOpIC: public IC {
703 public: 705 public:
704 enum TypeInfo { 706 enum TypeInfo {
705 UNINITIALIZED, 707 UNINITIALIZED,
706 SMI, 708 SMI,
707 INT32, 709 INT32,
708 NUMBER, 710 NUMBER,
709 ODDBALL, 711 ODDBALL,
710 STRING, // Only used for addition operation. 712 STRING, // Only used for addition operation.
711 GENERIC 713 GENERIC
712 }; 714 };
713 715
716 static void StubInfoToType(int minor_key,
717 Handle<Type>* left,
718 Handle<Type>* right,
719 Handle<Type>* result,
720 Isolate* isolate);
721
714 explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { } 722 explicit BinaryOpIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { }
715 723
716 void patch(Code* code); 724 void patch(Code* code);
717 725
718 static const char* GetName(TypeInfo type_info); 726 static const char* GetName(TypeInfo type_info);
719 727
720 static State ToState(TypeInfo type_info); 728 static State ToState(TypeInfo type_info);
729
730 private:
731 static Handle<Type> TypeInfoToType(TypeInfo binary_type, Isolate* isolate);
721 }; 732 };
722 733
723 734
724 class CompareIC: public IC { 735 class CompareIC: public IC {
725 public: 736 public:
726 // The type/state lattice is defined by the following inequations: 737 // The type/state lattice is defined by the following inequations:
727 // UNINITIALIZED < ... 738 // UNINITIALIZED < ...
728 // ... < GENERIC 739 // ... < GENERIC
729 // SMI < NUMBER 740 // SMI < NUMBER
730 // INTERNALIZED_STRING < STRING 741 // INTERNALIZED_STRING < STRING
731 // KNOWN_OBJECT < OBJECT 742 // KNOWN_OBJECT < OBJECT
732 enum State { 743 enum State {
733 UNINITIALIZED, 744 UNINITIALIZED,
734 SMI, 745 SMI,
735 NUMBER, 746 NUMBER,
736 STRING, 747 STRING,
737 INTERNALIZED_STRING, 748 INTERNALIZED_STRING,
738 UNIQUE_NAME, // Symbol or InternalizedString 749 UNIQUE_NAME, // Symbol or InternalizedString
739 OBJECT, // JSObject 750 OBJECT, // JSObject
740 KNOWN_OBJECT, // JSObject with specific map (faster check) 751 KNOWN_OBJECT, // JSObject with specific map (faster check)
741 GENERIC 752 GENERIC
742 }; 753 };
743 754
744 static Handle<Type> StateToType( 755 static State NewInputState(State old_state, Handle<Object> value);
745 Isolate* isolate, State state, Handle<Map> map = Handle<Map>()); 756
757 static Handle<Type> StateToType(Isolate* isolate,
758 State state,
759 Handle<Map> map = Handle<Map>());
760
761 static void StubInfoToType(int stub_minor_key,
762 Handle<Type>* left_type,
763 Handle<Type>* right_type,
764 Handle<Type>* overall_type,
765 Handle<Map> map,
766 Isolate* isolate);
746 767
747 CompareIC(Isolate* isolate, Token::Value op) 768 CompareIC(Isolate* isolate, Token::Value op)
748 : IC(EXTRA_CALL_FRAME, isolate), op_(op) { } 769 : IC(EXTRA_CALL_FRAME, isolate), op_(op) { }
749 770
750 // Update the inline cache for the given operands. 771 // Update the inline cache for the given operands.
751 void UpdateCaches(Handle<Object> x, Handle<Object> y); 772 void UpdateCaches(Handle<Object> x, Handle<Object> y);
752 773
753 774
754 // Factory method for getting an uninitialized compare stub. 775 // Factory method for getting an uninitialized compare stub.
755 static Handle<Code> GetUninitialized(Isolate* isolate, Token::Value op); 776 static Handle<Code> GetUninitialized(Isolate* isolate, Token::Value op);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 832
812 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure); 833 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_MissFromStubFailure);
813 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); 834 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure);
814 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); 835 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss);
815 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); 836 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss);
816 837
817 838
818 } } // namespace v8::internal 839 } } // namespace v8::internal
819 840
820 #endif // V8_IC_H_ 841 #endif // V8_IC_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698