OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 private: | 893 private: |
894 bool is_js_array_; | 894 bool is_js_array_; |
895 JSObject::ElementsKind elements_kind_; | 895 JSObject::ElementsKind elements_kind_; |
896 | 896 |
897 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); | 897 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); |
898 }; | 898 }; |
899 | 899 |
900 | 900 |
901 class ToBooleanStub: public CodeStub { | 901 class ToBooleanStub: public CodeStub { |
902 public: | 902 public: |
903 explicit ToBooleanStub(Register tos) : tos_(tos) { } | 903 enum Type { |
| 904 UNDEFINED, |
| 905 BOOLEAN, |
| 906 NULL_TYPE, |
| 907 SMI, |
| 908 UNDETECTABLE, |
| 909 SPEC_OBJECT, |
| 910 STRING, |
| 911 HEAP_NUMBER, |
| 912 INTERNAL_OBJECT, |
| 913 NUMBER_OF_TYPES |
| 914 }; |
| 915 |
| 916 class Types { |
| 917 public: |
| 918 Types() {} |
| 919 explicit Types(int bits) : set_(bits) {} |
| 920 |
| 921 bool IsEmpty() const { return set_.IsEmpty(); } |
| 922 bool Contains(Type type) const { return set_.Contains(type); } |
| 923 void Add(Type type) { set_.Add(type); } |
| 924 int ToInt() const { return set_.ToIntegral(); } |
| 925 void Print(StringStream* stream); |
| 926 void TraceTransition(Types to); |
| 927 bool Record(Handle<Object> object); |
| 928 |
| 929 private: |
| 930 EnumSet<Type> set_; |
| 931 }; |
| 932 |
| 933 explicit ToBooleanStub(Register tos, Types types = Types()) |
| 934 : tos_(tos), types_(types) { } |
904 | 935 |
905 void Generate(MacroAssembler* masm); | 936 void Generate(MacroAssembler* masm); |
| 937 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } |
| 938 virtual void PrintName(StringStream* stream); |
906 | 939 |
907 private: | 940 private: |
| 941 Major MajorKey() { return ToBoolean; } |
| 942 int MinorKey() { return (tos_.code() << NUMBER_OF_TYPES) | types_.ToInt(); } |
| 943 |
| 944 void CheckOddball(MacroAssembler* masm, |
| 945 Type type, |
| 946 Handle<Object> value, |
| 947 bool result, |
| 948 Label* patch); |
| 949 void GenerateTypeTransition(MacroAssembler* masm); |
| 950 |
908 Register tos_; | 951 Register tos_; |
909 Major MajorKey() { return ToBoolean; } | 952 Types types_; |
910 int MinorKey() { return tos_.code(); } | |
911 }; | 953 }; |
912 | 954 |
913 } } // namespace v8::internal | 955 } } // namespace v8::internal |
914 | 956 |
915 #endif // V8_CODE_STUBS_H_ | 957 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |