OLD | NEW |
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 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 HEAP_NUMBER, | 1966 HEAP_NUMBER, |
1967 NUMBER_OF_TYPES | 1967 NUMBER_OF_TYPES |
1968 }; | 1968 }; |
1969 | 1969 |
1970 // At most 8 different types can be distinguished, because the Code object | 1970 // At most 8 different types can be distinguished, because the Code object |
1971 // only has room for a single byte to hold a set of these types. :-P | 1971 // only has room for a single byte to hold a set of these types. :-P |
1972 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); | 1972 STATIC_ASSERT(NUMBER_OF_TYPES <= 8); |
1973 | 1973 |
1974 class Types : public EnumSet<Type, byte> { | 1974 class Types : public EnumSet<Type, byte> { |
1975 public: | 1975 public: |
1976 Types() {} | 1976 Types() : EnumSet<Type, byte>(0) {} |
1977 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} | 1977 explicit Types(byte bits) : EnumSet<Type, byte>(bits) {} |
1978 | 1978 |
1979 byte ToByte() const { return ToIntegral(); } | 1979 byte ToByte() const { return ToIntegral(); } |
1980 void Print(StringStream* stream) const; | 1980 void Print(StringStream* stream) const; |
1981 void TraceTransition(Types to) const; | 1981 void TraceTransition(Types to) const; |
1982 bool Record(Handle<Object> object); | 1982 bool Record(Handle<Object> object); |
1983 bool NeedsMap() const; | 1983 bool NeedsMap() const; |
1984 bool CanBeUndetectable() const; | 1984 bool CanBeUndetectable() const; |
| 1985 bool IsGeneric() const { return ToIntegral() == Generic().ToIntegral(); } |
| 1986 |
| 1987 static Types Generic() { return Types((1 << NUMBER_OF_TYPES) - 1); } |
1985 }; | 1988 }; |
1986 | 1989 |
1987 static Types no_types() { return Types(); } | |
1988 static Types all_types() { return Types((1 << NUMBER_OF_TYPES) - 1); } | |
1989 | |
1990 explicit ToBooleanStub(Types types = Types()) | 1990 explicit ToBooleanStub(Types types = Types()) |
1991 : types_(types) { } | 1991 : types_(types) { } |
1992 explicit ToBooleanStub(Code::ExtraICState state) | 1992 explicit ToBooleanStub(Code::ExtraICState state) |
1993 : types_(static_cast<byte>(state)) { } | 1993 : types_(static_cast<byte>(state)) { } |
1994 | 1994 |
1995 bool Record(Handle<Object> object); | 1995 bool Record(Handle<Object> object); |
1996 Types GetTypes() { return types_; } | 1996 Types GetTypes() { return types_; } |
1997 | 1997 |
1998 virtual Handle<Code> GenerateCode(); | 1998 virtual Handle<Code> GenerateCode(); |
1999 virtual void InitializeInterfaceDescriptor( | 1999 virtual void InitializeInterfaceDescriptor( |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 | 2155 |
2156 // The current function entry hook. | 2156 // The current function entry hook. |
2157 static FunctionEntryHook entry_hook_; | 2157 static FunctionEntryHook entry_hook_; |
2158 | 2158 |
2159 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2159 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2160 }; | 2160 }; |
2161 | 2161 |
2162 } } // namespace v8::internal | 2162 } } // namespace v8::internal |
2163 | 2163 |
2164 #endif // V8_CODE_STUBS_H_ | 2164 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |