Reviewers: Jakob,
Message:
PTAL
Description:
Don't overwrite transitions in SetPropertyIgnoreAttributes.
BUG=326155
Please review this at https://codereview.chromium.org/134733011/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+15, -1 lines):
M src/objects-inl.h
M src/objects.cc
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index
fb996a219e28df171504916345c496394ab4c3c1..a825166de4d873abcb154cd573fcc13e5238838a
100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4780,6 +4780,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
6007558cb33111a54d2e7bf6d8cf5f16cd81d8b8..681a49dd9757ac19648370be3183ef1884444682
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -4218,9 +4218,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();
--
--
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.