Revision: 22511
Author:   [email protected]
Date:     Mon Jul 21 16:01:50 2014 UTC
Log:      Reduce usage of StoreMode.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/409603002
http://code.google.com/p/v8/source/detail?r=22511

Modified:
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Jul 21 15:59:05 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Jul 21 16:01:50 2014 UTC
@@ -1869,15 +1869,9 @@


 MaybeHandle<Object> JSObject::AddPropertyInternal(
-    Handle<JSObject> object,
-    Handle<Name> name,
-    Handle<Object> value,
-    PropertyAttributes attributes,
-    StrictMode strict_mode,
-    JSReceiver::StoreFromKeyed store_mode,
-    ExtensibilityCheck extensibility_check,
-    StoreMode mode,
-    TransitionFlag transition_flag) {
+    Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
+    PropertyAttributes attributes, JSReceiver::StoreFromKeyed store_mode,
+ ExtensibilityCheck extensibility_check, TransitionFlag transition_flag) {
   ASSERT(!object->IsJSGlobalProxy());
   Isolate* isolate = object->GetIsolate();

@@ -1888,14 +1882,10 @@

   if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK &&
       !object->map()->is_extensible()) {
-    if (strict_mode == SLOPPY) {
-      return value;
-    } else {
-      Handle<Object> args[1] = { name };
-      Handle<Object> error = isolate->factory()->NewTypeError(
-          "object_not_extensible", HandleVector(args, ARRAY_SIZE(args)));
-      return isolate->Throw<Object>(error);
-    }
+    Handle<Object> args[1] = {name};
+    Handle<Object> error = isolate->factory()->NewTypeError(
+        "object_not_extensible", HandleVector(args, ARRAY_SIZE(args)));
+    return isolate->Throw<Object>(error);
   }

   if (object->HasFastProperties()) {
@@ -2259,11 +2249,10 @@
 void JSObject::GeneralizeFieldRepresentation(Handle<JSObject> object,
                                              int modify_index,
Representation new_representation, - Handle<HeapType> new_field_type,
-                                             StoreMode store_mode) {
+ Handle<HeapType> new_field_type) {
   Handle<Map> new_map = Map::GeneralizeRepresentation(
-      handle(object->map()), modify_index, new_representation,
-      new_field_type, store_mode);
+ handle(object->map()), modify_index, new_representation, new_field_type,
+      FORCE_FIELD);
   MigrateToMap(object, new_map);
 }

@@ -3992,9 +3981,9 @@
     // fast copy of the map. If we get a fast copy of the map, all field
     // representations will be tagged since the transition is omitted.
     return JSObject::AddPropertyInternal(
-        object, name, value, attributes, SLOPPY,
+        object, name, value, attributes,
         JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED,
- JSReceiver::OMIT_EXTENSIBILITY_CHECK, FORCE_FIELD, OMIT_TRANSITION);
+        JSReceiver::OMIT_EXTENSIBILITY_CHECK, OMIT_TRANSITION);
   }

   // Keep the target CONSTANT if the same value is stored.
@@ -4051,8 +4040,7 @@
         lookup->isolate(), field_representation);
     JSObject::GeneralizeFieldRepresentation(handle(lookup->holder()),
                                             lookup->GetDescriptorIndex(),
- field_representation, field_type,
-                                            FORCE_FIELD);
+ field_representation, field_type);
   }
   lookup->holder()->WriteToField(lookup->GetDescriptorIndex(), *value);
 }
@@ -4074,9 +4062,9 @@

   int descriptor_index = lookup->GetDescriptorIndex();
   if (lookup->GetAttributes() == attributes) {
-    JSObject::GeneralizeFieldRepresentation(
-        object, descriptor_index, Representation::Tagged(),
-        HeapType::Any(lookup->isolate()), FORCE_FIELD);
+    JSObject::GeneralizeFieldRepresentation(object, descriptor_index,
+                                            Representation::Tagged(),
+ HeapType::Any(lookup->isolate()));
   } else {
     Handle<Map> old_map(object->map());
     Handle<Map> new_map = Map::CopyGeneralizeAllRepresentations(old_map,
@@ -4101,12 +4089,9 @@
 }


-void JSObject::AddProperty(
-    Handle<JSObject> object,
-    Handle<Name> name,
-    Handle<Object> value,
-    PropertyAttributes attributes,
-    StoreMode store_mode) {
+void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name,
+                           Handle<Object> value,
+                           PropertyAttributes attributes) {
 #ifdef DEBUG
   uint32_t index;
   ASSERT(!object->IsJSProxy());
@@ -4116,7 +4101,7 @@
   ASSERT(!it.IsFound());
   ASSERT(object->map()->is_extensible());
 #endif
- SetOwnPropertyIgnoreAttributes(object, name, value, attributes, store_mode,
+  SetOwnPropertyIgnoreAttributes(object, name, value, attributes,
                                  OMIT_EXTENSIBILITY_CHECK).Check();
 }

@@ -4128,7 +4113,6 @@
     Handle<Name> name,
     Handle<Object> value,
     PropertyAttributes attributes,
-    StoreMode mode,
     ExtensibilityCheck extensibility_check,
     StoreFromKeyed store_from_keyed,
     ExecutableAccessorInfoHandling handling) {
@@ -4159,7 +4143,7 @@
     ASSERT(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
     return SetOwnPropertyIgnoreAttributes(
         Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), name,
-        value, attributes, mode, extensibility_check);
+        value, attributes, extensibility_check);
   }

   if (lookup.IsInterceptor() ||
@@ -4173,9 +4157,8 @@
     TransitionFlag flag = lookup.IsFound()
         ? OMIT_TRANSITION : INSERT_TRANSITION;
     // Neither properties nor transitions found.
-    return AddPropertyInternal(object, name, value, attributes, SLOPPY,
-                               store_from_keyed, extensibility_check, mode,
-                               flag);
+    return AddPropertyInternal(object, name, value, attributes,
+ store_from_keyed, extensibility_check, flag);
   }

   Handle<Object> old_value = isolate->factory()->the_hole_value();
@@ -5141,7 +5124,7 @@
   }

SetOwnPropertyIgnoreAttributes(object, isolate->factory()->hidden_string(),
-                                 value, DONT_ENUM, ALLOW_AS_CONSTANT,
+                                 value, DONT_ENUM,
                                  OMIT_EXTENSIBILITY_CHECK).Assert();
   return object;
 }
=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Jul 21 15:59:05 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Mon Jul 21 16:01:50 2014 UTC
@@ -2157,16 +2157,12 @@
       Handle<Name> key,
       Handle<Object> value,
       PropertyAttributes attributes,
-      StoreMode mode = ALLOW_AS_CONSTANT,
       ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
       StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
       ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);

-  static void AddProperty(Handle<JSObject> object,
-                          Handle<Name> key,
-                          Handle<Object> value,
-                          PropertyAttributes attributes,
-                          StoreMode mode = ALLOW_AS_CONSTANT);
+  static void AddProperty(Handle<JSObject> object, Handle<Name> key,
+ Handle<Object> value, PropertyAttributes attributes);

   // Extend the receiver with a single fast property appeared first in the
   // passed map. This also extends the property backing store if necessary.
@@ -2650,8 +2646,7 @@
   static void GeneralizeFieldRepresentation(Handle<JSObject> object,
                                             int modify_index,
Representation new_representation, - Handle<HeapType> new_field_type,
-                                            StoreMode store_mode);
+ Handle<HeapType> new_field_type);

   static void UpdateAllocationSite(Handle<JSObject> object,
                                    ElementsKind to_kind);
@@ -2733,15 +2728,9 @@

   // Add a property to an object.
   MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal(
-      Handle<JSObject> object,
-      Handle<Name> name,
-      Handle<Object> value,
-      PropertyAttributes attributes,
-      StrictMode strict_mode,
-      StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
-      ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
-      StoreMode mode = ALLOW_AS_CONSTANT,
-      TransitionFlag flag = INSERT_TRANSITION);
+      Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
+      PropertyAttributes attributes, StoreFromKeyed store_mode,
+      ExtensibilityCheck extensibility_check, TransitionFlag flag);

   // Add a property to a fast-case object.
   static void AddFastProperty(Handle<JSObject> object,
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Mon Jul 21 10:20:54 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Mon Jul 21 16:01:50 2014 UTC
@@ -267,7 +267,6 @@
     }
     MaybeHandle<Object> maybe_result;
     uint32_t element_index = 0;
-    StoreMode mode = value->IsJSObject() ? FORCE_FIELD : ALLOW_AS_CONSTANT;
     if (key->IsInternalizedString()) {
       if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
         // Array index as string (uint32).
@@ -278,7 +277,7 @@
         Handle<String> name(String::cast(*key));
         ASSERT(!name->AsArrayIndex(&element_index));
         maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
-            boilerplate, name, value, NONE, mode);
+            boilerplate, name, value, NONE);
       }
     } else if (key->ToArrayIndex(&element_index)) {
       // Array index (uint32).
@@ -293,8 +292,8 @@
       Vector<char> buffer(arr, ARRAY_SIZE(arr));
       const char* str = DoubleToCString(num, buffer);
Handle<String> name = isolate->factory()->NewStringFromAsciiChecked(str);
-      maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(
-          boilerplate, name, value, NONE, mode);
+ maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate, name,
+                                                              value, NONE);
     }
     // If setting the property on the boilerplate throws an
     // exception, the exception is converted to an empty handle in
@@ -4979,7 +4978,6 @@
         isolate, result,
         JSObject::SetOwnPropertyIgnoreAttributes(
             js_object, name, obj_value, attr,
-            ALLOW_AS_CONSTANT,
             JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
             JSReceiver::MAY_BE_STORE_FROM_KEYED,
             JSObject::DONT_FORCE_FIELD));
@@ -5132,8 +5130,8 @@
     } else {
if (name->IsString()) name = String::Flatten(Handle<String>::cast(name));
       return JSObject::SetOwnPropertyIgnoreAttributes(
-          js_object, name, value, attr, ALLOW_AS_CONSTANT,
-          JSReceiver::PERFORM_EXTENSIBILITY_CHECK, store_from_keyed);
+ js_object, name, value, attr, JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
+          store_from_keyed);
     }
   }

@@ -5148,8 +5146,8 @@
                                 SLOPPY, false, DEFINE_PROPERTY);
   } else {
     return JSObject::SetOwnPropertyIgnoreAttributes(
-        js_object, name, value, attr, ALLOW_AS_CONSTANT,
-        JSReceiver::PERFORM_EXTENSIBILITY_CHECK, store_from_keyed);
+ js_object, name, value, attr, JSReceiver::PERFORM_EXTENSIBILITY_CHECK,
+        store_from_keyed);
   }
 }

--
--
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.

Reply via email to