Reviewers: Jakob,
Description:
Merged r18754 into 3.23 branch.
Ensure we don't overwrite transitions in SetPropertyIgnoreAttributes.
BUG=326155
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/149503004/
SVN Base: https://v8.googlecode.com/svn/branches/3.23
Affected files (+31, -2 lines):
M src/objects-inl.h
M src/objects.cc
M src/version.cc
M test/cctest/test-api.cc
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
02e3160c9364326c0d027ad1c8a57873319a27fa..0e72ec1b004812e8dc4a822756c10394f4b50a09
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4469,6 +4469,17 @@ void Map::set_transitions(TransitionArray*
transition_array,
// 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();
}
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
cfb554bc76247b7553967a233c8406b7c226f5ac..832ddc1520bd59fa727bceddc179277b79472866
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4206,9 +4206,12 @@ Handle<Object>
JSObject::SetLocalPropertyIgnoreAttributes(
// 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();
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index
c704427cdf21405798104ee726e27c7e57c901f3..1cc96956359fa379800243c567391d1c9d8659ec
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -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
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
57c98d06dd557a51f1e458d5929e26842b532a91..00cc8bccc294a6e139d7ed8b62a136e1e3798e27
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -1950,6 +1950,21 @@ void AddInterceptor(Handle<FunctionTemplate> templ,
}
+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::HandleScope scope(CcTest::isolate());
Handle<FunctionTemplate> parent = FunctionTemplate::New();
--
--
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.