Commit 4254fbf3 authored by Georg Neis's avatar Georg Neis

[turbofan] Serialize Object::BooleanValue.

Bug: v8:7790
Change-Id: Ic48c7d869d98b64195f699c47b1a250ae6ad2440
Reviewed-on: https://chromium-review.googlesource.com/1227127Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55982}
parent 043dfe76
...@@ -52,17 +52,20 @@ class ObjectData : public ZoneObject { ...@@ -52,17 +52,20 @@ class ObjectData : public ZoneObject {
class HeapObjectData : public ObjectData { class HeapObjectData : public ObjectData {
public: public:
HeapObjectData(JSHeapBroker* broker, Handle<HeapObject> object,
HeapObjectType type);
static HeapObjectData* Serialize(JSHeapBroker* broker, static HeapObjectData* Serialize(JSHeapBroker* broker,
Handle<HeapObject> object); Handle<HeapObject> object);
HeapObjectType type() const { return type_; } HeapObjectType type() const { return type_; }
bool boolean_value() const { return boolean_value_; }
MapData* map() const { return map_; } MapData* map() const { return map_; }
HeapObjectData(JSHeapBroker* broker, Handle<HeapObject> object,
HeapObjectType type);
private: private:
HeapObjectType const type_; HeapObjectType const type_;
bool const boolean_value_;
MapData* const map_; MapData* const map_;
}; };
...@@ -605,6 +608,7 @@ HeapObjectData::HeapObjectData(JSHeapBroker* broker, Handle<HeapObject> object, ...@@ -605,6 +608,7 @@ HeapObjectData::HeapObjectData(JSHeapBroker* broker, Handle<HeapObject> object,
HeapObjectType type) HeapObjectType type)
: ObjectData(broker, object, false), : ObjectData(broker, object, false),
type_(type), type_(type),
boolean_value_(object->BooleanValue(broker->isolate())),
map_(broker->GetOrCreateData(object->map())->AsMap()) { map_(broker->GetOrCreateData(object->map())->AsMap()) {
CHECK(broker->SerializingAllowed()); CHECK(broker->SerializingAllowed());
} }
...@@ -1912,9 +1916,12 @@ MapRef NativeContextRef::GetInitialJSArrayMap(ElementsKind kind) const { ...@@ -1912,9 +1916,12 @@ MapRef NativeContextRef::GetInitialJSArrayMap(ElementsKind kind) const {
} }
} }
bool ObjectRef::BooleanValue() { bool ObjectRef::BooleanValue() const {
AllowHandleDereference allow_handle_dereference; if (broker()->mode() == JSHeapBroker::kDisabled) {
return object<Object>()->BooleanValue(broker()->isolate()); AllowHandleDereference allow_handle_dereference;
return object<Object>()->BooleanValue(broker()->isolate());
}
return IsSmi() ? (AsSmi() != 0) : data()->AsHeapObject()->boolean_value();
} }
double ObjectRef::OddballToNumber() const { double ObjectRef::OddballToNumber() const {
......
...@@ -80,15 +80,15 @@ class HeapObjectType { ...@@ -80,15 +80,15 @@ class HeapObjectType {
V(Cell) \ V(Cell) \
V(Code) \ V(Code) \
V(FeedbackVector) \ V(FeedbackVector) \
V(Map) \
V(Module) \
V(SharedFunctionInfo) \
V(FixedArrayBase) \ V(FixedArrayBase) \
V(HeapNumber) \ V(HeapNumber) \
V(JSObject) \ V(JSObject) \
V(Map) \
V(Module) \
V(MutableHeapNumber) \ V(MutableHeapNumber) \
V(Name) \ V(Name) \
V(PropertyCell) \ V(PropertyCell) \
V(SharedFunctionInfo) \
/* Subtypes of Object */ \ /* Subtypes of Object */ \
V(HeapObject) V(HeapObject)
...@@ -127,7 +127,7 @@ class ObjectRef { ...@@ -127,7 +127,7 @@ class ObjectRef {
HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL) HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL)
#undef HEAP_AS_METHOD_DECL #undef HEAP_AS_METHOD_DECL
bool BooleanValue(); bool BooleanValue() const;
double OddballToNumber() const; double OddballToNumber() const;
Isolate* isolate() const; Isolate* isolate() const;
......
...@@ -400,11 +400,9 @@ void init_memcopy_functions() { ...@@ -400,11 +400,9 @@ void init_memcopy_functions() {
#endif #endif
} }
// Returns false iff d is NaN, +0, or -0.
bool DoubleToBoolean(double d) { bool DoubleToBoolean(double d) {
// NaN, +0, and -0 should return the false object
IeeeDoubleArchType u; IeeeDoubleArchType u;
u.d = d; u.d = d;
if (u.bits.exp == 2047) { if (u.bits.exp == 2047) {
// Detect NaN for IEEE double precision floating point. // Detect NaN for IEEE double precision floating point.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment