Chromium Code Reviews| 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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 | 914 |
| 915 // At most 8 different types can be distinguished, because the Code object | 915 // At most 8 different types can be distinguished, because the Code object |
| 916 // only has room for a single byte to hold a set of these types. :-P | 916 // only has room for a single byte to hold a set of these types. :-P |
| 917 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); | 917 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); |
| 918 | 918 |
| 919 class Types { | 919 class Types { |
| 920 public: | 920 public: |
| 921 Types() {} | 921 Types() {} |
| 922 explicit Types(byte bits) : set_(bits) {} | 922 explicit Types(byte bits) : set_(bits) {} |
| 923 | 923 |
| 924 bool IsEmpty() const { return set_.IsEmpty(); } | 924 bool IsEmpty() const { return set_.IsEmpty(); } |
|
Vitaly Repeshko
2011/07/27 14:49:38
Maybe add IsAll()?
fschneider
2011/07/27 14:56:19
Done.
| |
| 925 bool Contains(Type type) const { return set_.Contains(type); } | 925 bool Contains(Type type) const { return set_.Contains(type); } |
| 926 void Add(Type type) { set_.Add(type); } | 926 void Add(Type type) { set_.Add(type); } |
| 927 byte ToByte() const { return set_.ToIntegral(); } | 927 byte ToByte() const { return set_.ToIntegral(); } |
| 928 void Print(StringStream* stream); | 928 void Print(StringStream* stream); |
| 929 void TraceTransition(Types to); | 929 void TraceTransition(Types to); |
| 930 bool Record(Handle<Object> object); | 930 bool Record(Handle<Object> object); |
| 931 | 931 |
| 932 private: | 932 private: |
| 933 EnumSet<Type, byte> set_; | 933 EnumSet<Type, byte> set_; |
| 934 }; | 934 }; |
| 935 | 935 |
| 936 static Types no_types() { return Types(); } | 936 static Types no_types() { return Types(); } |
| 937 static const byte kAllTypes = 0xff; | |
| 938 static Types all_types() { return Types(kAllTypes); } | |
|
Sven Panne
2011/07/27 14:46:33
Removing kAllTypes and directly using
(1 << NUMB
Vitaly Repeshko
2011/07/27 14:49:38
I agree.
fschneider
2011/07/27 14:56:19
Done.
| |
| 937 | 939 |
| 938 explicit ToBooleanStub(Register tos, Types types = Types()) | 940 explicit ToBooleanStub(Register tos, Types types = Types()) |
| 939 : tos_(tos), types_(types) { } | 941 : tos_(tos), types_(types) { } |
| 940 | 942 |
| 941 void Generate(MacroAssembler* masm); | 943 void Generate(MacroAssembler* masm); |
| 942 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } | 944 virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } |
| 943 virtual void PrintName(StringStream* stream); | 945 virtual void PrintName(StringStream* stream); |
| 944 | 946 |
| 945 private: | 947 private: |
| 946 Major MajorKey() { return ToBoolean; } | 948 Major MajorKey() { return ToBoolean; } |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 957 Label* patch); | 959 Label* patch); |
| 958 void GenerateTypeTransition(MacroAssembler* masm); | 960 void GenerateTypeTransition(MacroAssembler* masm); |
| 959 | 961 |
| 960 Register tos_; | 962 Register tos_; |
| 961 Types types_; | 963 Types types_; |
| 962 }; | 964 }; |
| 963 | 965 |
| 964 } } // namespace v8::internal | 966 } } // namespace v8::internal |
| 965 | 967 |
| 966 #endif // V8_CODE_STUBS_H_ | 968 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |