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

Unified Diff: src/code-stubs.h

Issue 1202973003: Expand ToBoolean stub so it can handle more types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index e6a3e3a2b9feb48a658b86338e8496c5a8d7959e..528bde15d73c57cc81a7eb8e9fd4e935a02ff053 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -2737,16 +2737,15 @@ class ToBooleanStub: public HydrogenCodeStub {
RESULT_AS_INVERSE_ODDBALL // For {false} on truthy value, {true} otherwise.
};
- // At most 8 different types can be distinguished, because the Code object
- // only has room for a single byte to hold a set of these types. :-P
- STATIC_ASSERT(NUMBER_OF_TYPES <= 8);
+ // At most 16 different types can be distinguished, because the Code object
+ // only has room for two bytes to hold a set of these types. :-P
+ STATIC_ASSERT(NUMBER_OF_TYPES <= 16);
- class Types : public EnumSet<Type, byte> {
+ class Types : public EnumSet<Type, uint16_t> {
public:
- Types() : EnumSet<Type, byte>(0) {}
- explicit Types(byte bits) : EnumSet<Type, byte>(bits) {}
+ Types() : EnumSet<Type, uint16_t>(0) {}
+ explicit Types(uint16_t bits) : EnumSet<Type, uint16_t>(bits) {}
- byte ToByte() const { return ToIntegral(); }
bool UpdateStatus(Handle<Object> object);
bool NeedsMap() const;
bool CanBeUndetectable() const;
@@ -2757,13 +2756,13 @@ class ToBooleanStub: public HydrogenCodeStub {
ToBooleanStub(Isolate* isolate, ResultMode mode, Types types = Types())
: HydrogenCodeStub(isolate) {
- set_sub_minor_key(TypesBits::encode(types.ToByte()) |
+ set_sub_minor_key(TypesBits::encode(types.ToIntegral()) |
ResultModeBits::encode(mode));
}
ToBooleanStub(Isolate* isolate, ExtraICState state)
: HydrogenCodeStub(isolate) {
- set_sub_minor_key(TypesBits::encode(static_cast<byte>(state)) |
+ set_sub_minor_key(TypesBits::encode(static_cast<uint16_t>(state)) |
ResultModeBits::encode(RESULT_AS_SMI));
}
@@ -2796,7 +2795,7 @@ class ToBooleanStub: public HydrogenCodeStub {
set_sub_minor_key(ResultModeBits::encode(RESULT_AS_SMI));
}
- class TypesBits : public BitField<byte, 0, NUMBER_OF_TYPES> {};
+ class TypesBits : public BitField<uint16_t, 0, NUMBER_OF_TYPES> {};
class ResultModeBits : public BitField<ResultMode, NUMBER_OF_TYPES, 2> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(ToBoolean);
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698