Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 78062a772b1daf2bb1321ffbe4a6dd46c2ae669c..9d3a2cfcbbb549793dff30d6ab784c62c13c7a40 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -10004,6 +10004,22 @@ Handle<DescriptorArray> DescriptorArray::CopyUpToAddAttributes( |
} |
+bool DescriptorArray::IsEqualUpTo(DescriptorArray* desc, int nof_descriptors) { |
+ for (int i = 0; i < nof_descriptors; i++) { |
+ if (GetKey(i) != desc->GetKey(i) || GetValue(i) != desc->GetValue(i)) { |
+ return false; |
+ } |
+ PropertyDetails details = GetDetails(i); |
+ PropertyDetails other_details = desc->GetDetails(i); |
+ if (details.type() != other_details.type() || |
+ !details.representation().Equals(other_details.representation())) { |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
+ |
Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map, |
Handle<DescriptorArray> descriptors, |
Descriptor* descriptor, |
@@ -12180,7 +12196,15 @@ bool CheckEquivalent(Map* first, Map* second) { |
bool Map::EquivalentToForTransition(Map* other) { |
- return CheckEquivalent(this, other); |
+ if (!CheckEquivalent(this, other)) return false; |
+ if (instance_type() == JS_FUNCTION_TYPE) { |
+ // JSFunctions require more checks to ensure that sloppy function is |
+ // not equvalent to strict function. |
+ int nof = Min(NumberOfOwnDescriptors(), other->NumberOfOwnDescriptors()); |
+ return instance_descriptors()->IsEqualUpTo(other->instance_descriptors(), |
+ nof); |
+ } |
+ return true; |
} |