Reviewers: jarin, Benedikt Meurer,
Description:
Expand ToBoolean stub so it can handle more types.
LOG=N
BUG=v8:4124
Please review this at https://codereview.chromium.org/1202973003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+10, -11 lines):
M src/code-stubs.h
M src/code-stubs.cc
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index
c00719969147a033e801f33d3bb691d0d959b80c..2441f7340b586de59317f961f3e786fee5168ac3
100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -924,7 +924,7 @@ bool ToBooleanStub::UpdateStatus(Handle<Object> object)
{
Types old_types = new_types;
bool to_boolean_value = new_types.UpdateStatus(object);
TraceTransition(old_types, new_types);
- set_sub_minor_key(TypesBits::update(sub_minor_key(),
new_types.ToByte()));
+ set_sub_minor_key(TypesBits::update(sub_minor_key(),
new_types.ToIntegral()));
return to_boolean_value;
}
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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.