Revision: 18917
Author:   [email protected]
Date:     Wed Jan 29 15:14:12 2014 UTC
Log:      Merged r18754 into 3.23 branch.

Ensure we don't overwrite transitions in SetPropertyIgnoreAttributes.

BUG=326155
LOG=N
[email protected]

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

Modified:
 /branches/3.23/src/objects-inl.h
 /branches/3.23/src/objects.cc
 /branches/3.23/src/version.cc
 /branches/3.23/test/cctest/test-api.cc

=======================================
--- /branches/3.23/src/objects-inl.h    Wed Jan 15 16:25:55 2014 UTC
+++ /branches/3.23/src/objects-inl.h    Wed Jan 29 15:14:12 2014 UTC
@@ -4469,6 +4469,17 @@
// When there is another reference to the array somewhere (e.g. a handle),
   // not zapping turns from a waste of memory into a source of crashes.
   if (HasTransitionArray()) {
+#ifdef DEBUG
+    for (int i = 0; i < transitions()->number_of_transitions(); i++) {
+      Map* target = transitions()->GetTarget(i);
+      if (target->instance_descriptors() == instance_descriptors()) {
+        Name* key = transitions()->GetKey(i);
+        int new_target_index = transition_array->Search(key);
+        ASSERT(new_target_index != TransitionArray::kNotFound);
+        ASSERT(transition_array->GetTarget(new_target_index) == target);
+      }
+    }
+#endif
     ASSERT(transitions() != transition_array);
     ZapTransitions();
   }
=======================================
--- /branches/3.23/src/objects.cc       Fri Jan 10 13:13:22 2014 UTC
+++ /branches/3.23/src/objects.cc       Wed Jan 29 15:14:12 2014 UTC
@@ -4206,9 +4206,12 @@

   // Check for accessor in prototype chain removed here in clone.
   if (!lookup.IsFound()) {
+    object->map()->LookupTransition(*object, *name, &lookup);
+    TransitionFlag flag = lookup.IsFound()
+        ? OMIT_TRANSITION : INSERT_TRANSITION;
     // Neither properties nor transitions found.
     return AddProperty(object, name, value, attributes, kNonStrictMode,
-        MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode);
+ MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag);
   }

   Handle<Object> old_value = isolate->factory()->the_hole_value();
=======================================
--- /branches/3.23/src/version.cc       Tue Jan 28 10:48:19 2014 UTC
+++ /branches/3.23/src/version.cc       Wed Jan 29 15:14:12 2014 UTC
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     23
 #define BUILD_NUMBER      17
-#define PATCH_LEVEL       11
+#define PATCH_LEVEL       12
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
=======================================
--- /branches/3.23/test/cctest/test-api.cc      Wed Jan 15 16:25:55 2014 UTC
+++ /branches/3.23/test/cctest/test-api.cc      Wed Jan 29 15:14:12 2014 UTC
@@ -1948,6 +1948,21 @@
                     v8::NamedPropertySetterCallback setter) {
   templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
 }
+
+
+THREADED_TEST(EmptyInterceptorBreakTransitions) {
+  v8::HandleScope scope(CcTest::isolate());
+  Handle<FunctionTemplate> templ = FunctionTemplate::New();
+  AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
+  LocalContext env;
+  env->Global()->Set(v8_str("Constructor"), templ->GetFunction());
+  CompileRun("var o1 = new Constructor;"
+             "o1.a = 1;"  // Ensure a and x share the descriptor array.
+             "Object.defineProperty(o1, 'x', {value: 10});");
+  CompileRun("var o2 = new Constructor;"
+             "o2.a = 1;"
+             "Object.defineProperty(o2, 'x', {value: 10});");
+}


 THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) {

--
--
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/groups/opt_out.

Reply via email to