| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index 11b231f1335b3bef0e4c4ca6c293627f12d33c65..5abae6d14f30947c0db1a2af54f7429e3d121e20 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -1060,16 +1060,28 @@ class Object : public MaybeObject {
|
| bool ToInt32(int32_t* value);
|
| bool ToUint32(uint32_t* value);
|
|
|
| - inline Representation OptimalRepresentation() {
|
| - if (FLAG_track_fields && IsSmi()) {
|
| + // Indicates to OptimalRepresentation what kind of value it is being invoked
|
| + // on. The representation of REAL_VALUEs is entirely dependent on the value.
|
| + // PLACEHOLDER_VALUEs have Representation::None(), so the actual
|
| + // representation can be determined later on. FORCE_TAGGED is used when
|
| + // initializing a field that will later be used for any kind of value without
|
| + // following the regular property assignments paths that will lead to
|
| + // generlization.
|
| + enum ValueType {
|
| + REAL_VALUE,
|
| + PLACEHOLDER_VALUE,
|
| + FORCE_TAGGED
|
| + };
|
| +
|
| + inline Representation OptimalRepresentation(ValueType type = REAL_VALUE) {
|
| + if (!FLAG_track_fields) return Representation::Tagged();
|
| + if (type == PLACEHOLDER_VALUE) return Representation::None();
|
| + if (type == FORCE_TAGGED) return Representation::Tagged();
|
| + if (IsSmi()) {
|
| return Representation::Smi();
|
| } else if (FLAG_track_double_fields && IsHeapNumber()) {
|
| return Representation::Double();
|
| - } else if (FLAG_track_heap_object_fields && !IsUndefined()) {
|
| - // Don't track undefined as heapobject because it's also used as temporary
|
| - // value for computed fields that may turn out to be Smi. That combination
|
| - // will go tagged, so go tagged immediately.
|
| - // TODO(verwaest): Change once we track computed boilerplate fields.
|
| + } else if (FLAG_track_heap_object_fields) {
|
| ASSERT(IsHeapObject());
|
| return Representation::HeapObject();
|
| } else {
|
| @@ -1078,7 +1090,9 @@ class Object : public MaybeObject {
|
| }
|
|
|
| inline bool FitsRepresentation(Representation representation) {
|
| - if (FLAG_track_fields && representation.IsSmi()) {
|
| + if (FLAG_track_fields && representation.IsNone()) {
|
| + return false;
|
| + } else if (FLAG_track_fields && representation.IsSmi()) {
|
| return IsSmi();
|
| } else if (FLAG_track_double_fields && representation.IsDouble()) {
|
| return IsNumber();
|
| @@ -1827,7 +1841,8 @@ class JSObject: public JSReceiver {
|
| Handle<JSObject> object,
|
| Handle<Name> key,
|
| Handle<Object> value,
|
| - PropertyAttributes attributes);
|
| + PropertyAttributes attributes,
|
| + ValueType value_type = REAL_VALUE);
|
|
|
| static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
|
| static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
|
| @@ -1854,7 +1869,8 @@ class JSObject: public JSReceiver {
|
| MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
|
| Name* key,
|
| Object* value,
|
| - PropertyAttributes attributes);
|
| + PropertyAttributes attributes,
|
| + ValueType value_type = REAL_VALUE);
|
|
|
| // Retrieve a value in a normalized object given a lookup result.
|
| // Handles the special representation of JS global objects.
|
| @@ -2216,7 +2232,8 @@ class JSObject: public JSReceiver {
|
| Name* name,
|
| Object* value,
|
| PropertyAttributes attributes,
|
| - StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
|
| + StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
|
| + ValueType value_type = REAL_VALUE);
|
|
|
| // Add a property to a slow-case object.
|
| MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name,
|
| @@ -2230,7 +2247,8 @@ class JSObject: public JSReceiver {
|
| PropertyAttributes attributes,
|
| StrictModeFlag strict_mode,
|
| StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
|
| - ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
|
| + ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
|
| + ValueType value_type = REAL_VALUE);
|
|
|
| // Convert the object to use the canonical dictionary
|
| // representation. If the object is expected to have additional properties
|
|
|