OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5648 } else if (object->map()->CanHaveMoreTransitions()) { | 5648 } else if (object->map()->CanHaveMoreTransitions()) { |
5649 new_map = Map::CopyForObserved(handle(object->map())); | 5649 new_map = Map::CopyForObserved(handle(object->map())); |
5650 } else { | 5650 } else { |
5651 new_map = Map::Copy(handle(object->map())); | 5651 new_map = Map::Copy(handle(object->map())); |
5652 new_map->set_is_observed(); | 5652 new_map->set_is_observed(); |
5653 } | 5653 } |
5654 object->set_map(*new_map); | 5654 object->set_map(*new_map); |
5655 } | 5655 } |
5656 | 5656 |
5657 | 5657 |
5658 Handle<JSObject> JSObject::Copy(Handle<JSObject> object, | |
5659 Handle<AllocationSite> site) { | |
5660 Isolate* isolate = object->GetIsolate(); | |
5661 CALL_HEAP_FUNCTION(isolate, | |
5662 isolate->heap()->CopyJSObject(*object, *site), JSObject); | |
5663 } | |
5664 | |
5665 | |
5666 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) { | 5658 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) { |
5667 Isolate* isolate = object->GetIsolate(); | 5659 Isolate* isolate = object->GetIsolate(); |
5668 CALL_HEAP_FUNCTION(isolate, | 5660 CALL_HEAP_FUNCTION(isolate, |
5669 isolate->heap()->CopyJSObject(*object), JSObject); | 5661 isolate->heap()->CopyJSObject(*object), JSObject); |
5670 } | 5662 } |
5671 | 5663 |
5672 | 5664 |
| 5665 template<class ContextObject> |
5673 class JSObjectWalkVisitor { | 5666 class JSObjectWalkVisitor { |
5674 public: | 5667 public: |
5675 explicit JSObjectWalkVisitor(AllocationSiteContext* site_context) : | 5668 JSObjectWalkVisitor(ContextObject* site_context, bool copying, |
5676 site_context_(site_context) {} | 5669 JSObject::DeepCopyHints hints) |
5677 virtual ~JSObjectWalkVisitor() {} | 5670 : site_context_(site_context), |
5678 | 5671 copying_(copying), |
5679 Handle<JSObject> Visit(Handle<JSObject> object) { | 5672 hints_(hints) {} |
5680 return StructureWalk(object); | 5673 |
5681 } | 5674 Handle<JSObject> StructureWalk(Handle<JSObject> object); |
5682 | |
5683 virtual bool is_copying() = 0; | |
5684 | 5675 |
5685 protected: | 5676 protected: |
5686 Handle<JSObject> StructureWalk(Handle<JSObject> object); | 5677 inline Handle<JSObject> VisitElementOrProperty(Handle<JSObject> object, |
5687 | 5678 Handle<JSObject> value) { |
5688 // The returned handle will be used for the object in all subsequent usages. | 5679 Handle<AllocationSite> current_site = site_context()->EnterNewScope(); |
5689 // This allows VisitObject to make a copy of the object if desired. | 5680 Handle<JSObject> copy_of_value = StructureWalk(value); |
5690 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) = 0; | 5681 site_context()->ExitScope(current_site, value); |
5691 virtual Handle<JSObject> VisitElementOrProperty(Handle<JSObject> object, | 5682 return copy_of_value; |
5692 Handle<JSObject> value) = 0; | 5683 } |
5693 | 5684 |
5694 AllocationSiteContext* site_context() { return site_context_; } | 5685 inline ContextObject* site_context() { return site_context_; } |
| 5686 inline Isolate* isolate() { return site_context()->isolate(); } |
| 5687 |
| 5688 inline bool copying() const { return copying_; } |
5695 | 5689 |
5696 private: | 5690 private: |
5697 AllocationSiteContext* site_context_; | 5691 ContextObject* site_context_; |
| 5692 const bool copying_; |
| 5693 const JSObject::DeepCopyHints hints_; |
5698 }; | 5694 }; |
5699 | 5695 |
5700 | 5696 |
5701 class JSObjectCopyVisitor: public JSObjectWalkVisitor { | 5697 template <class ContextObject> |
5702 public: | 5698 Handle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( |
5703 explicit JSObjectCopyVisitor(AllocationSiteContext* site_context) | 5699 Handle<JSObject> object) { |
5704 : JSObjectWalkVisitor(site_context) {} | 5700 Isolate* isolate = this->isolate(); |
5705 | 5701 bool copying = this->copying(); |
5706 virtual bool is_copying() V8_OVERRIDE { return true; } | 5702 bool shallow = hints_ == JSObject::kObjectIsShallowArray; |
5707 | 5703 |
5708 // The returned handle will be used for the object in all | 5704 if (!shallow) { |
5709 // subsequent usages. This allows VisitObject to make a copy | 5705 StackLimitCheck check(isolate); |
5710 // of the object if desired. | 5706 |
5711 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { | 5707 if (check.HasOverflowed()) { |
5712 // Only create a memento if | 5708 isolate->StackOverflow(); |
5713 // 1) we have a JSArray, and | 5709 return Handle<JSObject>::null(); |
5714 // 2) the elements kind is palatable | 5710 } |
5715 // 3) allow_mementos is true | 5711 } |
5716 Handle<JSObject> copy; | 5712 |
| 5713 if (object->map()->is_deprecated()) { |
| 5714 JSObject::MigrateInstance(object); |
| 5715 } |
| 5716 |
| 5717 Handle<JSObject> copy; |
| 5718 if (copying) { |
| 5719 Handle<AllocationSite> site_to_pass; |
5717 if (site_context()->activated() && | 5720 if (site_context()->activated() && |
5718 AllocationSite::CanTrack(object->map()->instance_type()) && | 5721 AllocationSite::CanTrack(object->map()->instance_type()) && |
5719 AllocationSite::GetMode(object->GetElementsKind()) == | 5722 AllocationSite::GetMode(object->GetElementsKind()) == |
5720 TRACK_ALLOCATION_SITE) { | 5723 TRACK_ALLOCATION_SITE) { |
5721 copy = JSObject::Copy(object, site_context()->current()); | 5724 site_to_pass = site_context()->current(); |
| 5725 } |
| 5726 CALL_AND_RETRY_OR_DIE(isolate, |
| 5727 isolate->heap()->CopyJSObject(*object, |
| 5728 site_to_pass.is_null() ? NULL : *site_to_pass), |
| 5729 { copy = Handle<JSObject>(JSObject::cast(__object__), |
| 5730 isolate); |
| 5731 break; |
| 5732 }, |
| 5733 return Handle<JSObject>()); |
| 5734 } else { |
| 5735 copy = object; |
| 5736 } |
| 5737 |
| 5738 ASSERT(copying || copy.is_identical_to(object)); |
| 5739 |
| 5740 if (!shallow) { |
| 5741 HandleScope scope(isolate); |
| 5742 |
| 5743 // Deep copy local properties. |
| 5744 if (copy->HasFastProperties()) { |
| 5745 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); |
| 5746 int limit = copy->map()->NumberOfOwnDescriptors(); |
| 5747 for (int i = 0; i < limit; i++) { |
| 5748 PropertyDetails details = descriptors->GetDetails(i); |
| 5749 if (details.type() != FIELD) continue; |
| 5750 int index = descriptors->GetFieldIndex(i); |
| 5751 Handle<Object> value(object->RawFastPropertyAt(index), isolate); |
| 5752 if (value->IsJSObject()) { |
| 5753 value = VisitElementOrProperty(copy, Handle<JSObject>::cast(value)); |
| 5754 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>()); |
| 5755 } else { |
| 5756 Representation representation = details.representation(); |
| 5757 value = NewStorageFor(isolate, value, representation); |
| 5758 } |
| 5759 if (copying) { |
| 5760 copy->FastPropertyAtPut(index, *value); |
| 5761 } |
| 5762 } |
5722 } else { | 5763 } else { |
5723 copy = JSObject::Copy(object); | 5764 Handle<FixedArray> names = |
5724 } | 5765 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties()); |
5725 | 5766 copy->GetLocalPropertyNames(*names, 0); |
5726 return copy; | 5767 for (int i = 0; i < names->length(); i++) { |
5727 } | 5768 ASSERT(names->get(i)->IsString()); |
5728 | 5769 Handle<String> key_string(String::cast(names->get(i))); |
5729 virtual Handle<JSObject> VisitElementOrProperty( | 5770 PropertyAttributes attributes = |
5730 Handle<JSObject> object, | 5771 copy->GetLocalPropertyAttribute(*key_string); |
5731 Handle<JSObject> value) V8_OVERRIDE { | 5772 // Only deep copy fields from the object literal expression. |
5732 Handle<AllocationSite> current_site = site_context()->EnterNewScope(); | 5773 // In particular, don't try to copy the length attribute of |
5733 Handle<JSObject> copy_of_value = StructureWalk(value); | 5774 // an array. |
5734 site_context()->ExitScope(current_site, value); | 5775 if (attributes != NONE) continue; |
5735 return copy_of_value; | 5776 Handle<Object> value( |
5736 } | 5777 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(), |
5737 }; | 5778 isolate); |
5738 | 5779 if (value->IsJSObject()) { |
5739 | 5780 Handle<JSObject> result = VisitElementOrProperty( |
5740 class JSObjectCreateAllocationSitesVisitor: public JSObjectWalkVisitor { | 5781 copy, Handle<JSObject>::cast(value)); |
5741 public: | 5782 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); |
5742 explicit JSObjectCreateAllocationSitesVisitor( | 5783 if (copying) { |
5743 AllocationSiteContext* site_context) | 5784 // Creating object copy for literals. No strict mode needed. |
5744 : JSObjectWalkVisitor(site_context) {} | 5785 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty( |
5745 | 5786 copy, key_string, result, NONE, kNonStrictMode)); |
5746 virtual bool is_copying() V8_OVERRIDE { return false; } | 5787 } |
5747 | 5788 } |
5748 // The returned handle will be used for the object in all | 5789 } |
5749 // subsequent usages. This allows VisitObject to make a copy | 5790 } |
5750 // of the object if desired. | 5791 |
5751 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { | 5792 // Deep copy local elements. |
5752 return object; | 5793 // Pixel elements cannot be created using an object literal. |
5753 } | 5794 ASSERT(!copy->HasExternalArrayElements()); |
5754 | 5795 switch (copy->GetElementsKind()) { |
5755 virtual Handle<JSObject> VisitElementOrProperty( | 5796 case FAST_SMI_ELEMENTS: |
5756 Handle<JSObject> object, | 5797 case FAST_ELEMENTS: |
5757 Handle<JSObject> value) V8_OVERRIDE { | 5798 case FAST_HOLEY_SMI_ELEMENTS: |
5758 Handle<AllocationSite> current_site = site_context()->EnterNewScope(); | 5799 case FAST_HOLEY_ELEMENTS: { |
5759 value = StructureWalk(value); | 5800 Handle<FixedArray> elements(FixedArray::cast(copy->elements())); |
5760 site_context()->ExitScope(current_site, value); | 5801 if (elements->map() == isolate->heap()->fixed_cow_array_map()) { |
5761 return value; | 5802 if (copying) { |
5762 } | 5803 isolate->counters()->cow_arrays_created_runtime()->Increment(); |
5763 }; | 5804 } |
5764 | |
5765 | |
5766 Handle<JSObject> JSObjectWalkVisitor::StructureWalk(Handle<JSObject> object) { | |
5767 bool copying = is_copying(); | |
5768 Isolate* isolate = object->GetIsolate(); | |
5769 StackLimitCheck check(isolate); | |
5770 if (check.HasOverflowed()) { | |
5771 isolate->StackOverflow(); | |
5772 return Handle<JSObject>::null(); | |
5773 } | |
5774 | |
5775 if (object->map()->is_deprecated()) { | |
5776 JSObject::MigrateInstance(object); | |
5777 } | |
5778 | |
5779 Handle<JSObject> copy = VisitObject(object); | |
5780 ASSERT(copying || copy.is_identical_to(object)); | |
5781 | |
5782 HandleScope scope(isolate); | |
5783 | |
5784 // Deep copy local properties. | |
5785 if (copy->HasFastProperties()) { | |
5786 Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors()); | |
5787 int limit = copy->map()->NumberOfOwnDescriptors(); | |
5788 for (int i = 0; i < limit; i++) { | |
5789 PropertyDetails details = descriptors->GetDetails(i); | |
5790 if (details.type() != FIELD) continue; | |
5791 int index = descriptors->GetFieldIndex(i); | |
5792 Handle<Object> value(object->RawFastPropertyAt(index), isolate); | |
5793 if (value->IsJSObject()) { | |
5794 value = VisitElementOrProperty(copy, Handle<JSObject>::cast(value)); | |
5795 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>()); | |
5796 } else { | |
5797 Representation representation = details.representation(); | |
5798 value = NewStorageFor(isolate, value, representation); | |
5799 } | |
5800 if (copying) { | |
5801 copy->FastPropertyAtPut(index, *value); | |
5802 } | |
5803 } | |
5804 } else { | |
5805 Handle<FixedArray> names = | |
5806 isolate->factory()->NewFixedArray(copy->NumberOfLocalProperties()); | |
5807 copy->GetLocalPropertyNames(*names, 0); | |
5808 for (int i = 0; i < names->length(); i++) { | |
5809 ASSERT(names->get(i)->IsString()); | |
5810 Handle<String> key_string(String::cast(names->get(i))); | |
5811 PropertyAttributes attributes = | |
5812 copy->GetLocalPropertyAttribute(*key_string); | |
5813 // Only deep copy fields from the object literal expression. | |
5814 // In particular, don't try to copy the length attribute of | |
5815 // an array. | |
5816 if (attributes != NONE) continue; | |
5817 Handle<Object> value( | |
5818 copy->GetProperty(*key_string, &attributes)->ToObjectUnchecked(), | |
5819 isolate); | |
5820 if (value->IsJSObject()) { | |
5821 Handle<JSObject> result = VisitElementOrProperty( | |
5822 copy, Handle<JSObject>::cast(value)); | |
5823 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); | |
5824 if (copying) { | |
5825 // Creating object copy for literals. No strict mode needed. | |
5826 CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty( | |
5827 copy, key_string, result, NONE, kNonStrictMode)); | |
5828 } | |
5829 } | |
5830 } | |
5831 } | |
5832 | |
5833 // Deep copy local elements. | |
5834 // Pixel elements cannot be created using an object literal. | |
5835 ASSERT(!copy->HasExternalArrayElements()); | |
5836 switch (copy->GetElementsKind()) { | |
5837 case FAST_SMI_ELEMENTS: | |
5838 case FAST_ELEMENTS: | |
5839 case FAST_HOLEY_SMI_ELEMENTS: | |
5840 case FAST_HOLEY_ELEMENTS: { | |
5841 Handle<FixedArray> elements(FixedArray::cast(copy->elements())); | |
5842 if (elements->map() == isolate->heap()->fixed_cow_array_map()) { | |
5843 if (copying) { | |
5844 isolate->counters()->cow_arrays_created_runtime()->Increment(); | |
5845 } | |
5846 #ifdef DEBUG | 5805 #ifdef DEBUG |
5847 for (int i = 0; i < elements->length(); i++) { | 5806 for (int i = 0; i < elements->length(); i++) { |
5848 ASSERT(!elements->get(i)->IsJSObject()); | 5807 ASSERT(!elements->get(i)->IsJSObject()); |
5849 } | 5808 } |
5850 #endif | 5809 #endif |
5851 } else { | 5810 } else { |
5852 for (int i = 0; i < elements->length(); i++) { | 5811 for (int i = 0; i < elements->length(); i++) { |
5853 Handle<Object> value(elements->get(i), isolate); | 5812 Handle<Object> value(elements->get(i), isolate); |
5854 ASSERT(value->IsSmi() || | 5813 ASSERT(value->IsSmi() || |
5855 value->IsTheHole() || | 5814 value->IsTheHole() || |
5856 (IsFastObjectElementsKind(copy->GetElementsKind()))); | 5815 (IsFastObjectElementsKind(copy->GetElementsKind()))); |
5857 if (value->IsJSObject()) { | 5816 if (value->IsJSObject()) { |
5858 Handle<JSObject> result = VisitElementOrProperty( | 5817 Handle<JSObject> result = VisitElementOrProperty( |
5859 copy, Handle<JSObject>::cast(value)); | 5818 copy, Handle<JSObject>::cast(value)); |
5860 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); | 5819 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); |
5861 if (copying) { | 5820 if (copying) { |
5862 elements->set(i, *result); | 5821 elements->set(i, *result); |
| 5822 } |
5863 } | 5823 } |
5864 } | 5824 } |
5865 } | 5825 } |
5866 } | 5826 break; |
5867 break; | 5827 } |
5868 } | 5828 case DICTIONARY_ELEMENTS: { |
5869 case DICTIONARY_ELEMENTS: { | 5829 Handle<SeededNumberDictionary> element_dictionary( |
5870 Handle<SeededNumberDictionary> element_dictionary( | 5830 copy->element_dictionary()); |
5871 copy->element_dictionary()); | 5831 int capacity = element_dictionary->Capacity(); |
5872 int capacity = element_dictionary->Capacity(); | 5832 for (int i = 0; i < capacity; i++) { |
5873 for (int i = 0; i < capacity; i++) { | 5833 Object* k = element_dictionary->KeyAt(i); |
5874 Object* k = element_dictionary->KeyAt(i); | 5834 if (element_dictionary->IsKey(k)) { |
5875 if (element_dictionary->IsKey(k)) { | 5835 Handle<Object> value(element_dictionary->ValueAt(i), isolate); |
5876 Handle<Object> value(element_dictionary->ValueAt(i), isolate); | 5836 if (value->IsJSObject()) { |
5877 if (value->IsJSObject()) { | 5837 Handle<JSObject> result = VisitElementOrProperty( |
5878 Handle<JSObject> result = VisitElementOrProperty( | 5838 copy, Handle<JSObject>::cast(value)); |
5879 copy, Handle<JSObject>::cast(value)); | 5839 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); |
5880 RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<JSObject>()); | 5840 if (copying) { |
5881 if (copying) { | 5841 element_dictionary->ValueAtPut(i, *result); |
5882 element_dictionary->ValueAtPut(i, *result); | 5842 } |
5883 } | 5843 } |
5884 } | 5844 } |
5885 } | 5845 } |
5886 } | 5846 break; |
5887 break; | 5847 } |
5888 } | 5848 case NON_STRICT_ARGUMENTS_ELEMENTS: |
5889 case NON_STRICT_ARGUMENTS_ELEMENTS: | 5849 UNIMPLEMENTED(); |
5890 UNIMPLEMENTED(); | 5850 break; |
5891 break; | 5851 case EXTERNAL_PIXEL_ELEMENTS: |
5892 case EXTERNAL_PIXEL_ELEMENTS: | 5852 case EXTERNAL_BYTE_ELEMENTS: |
5893 case EXTERNAL_BYTE_ELEMENTS: | 5853 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
5894 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 5854 case EXTERNAL_SHORT_ELEMENTS: |
5895 case EXTERNAL_SHORT_ELEMENTS: | 5855 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
5896 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 5856 case EXTERNAL_INT_ELEMENTS: |
5897 case EXTERNAL_INT_ELEMENTS: | 5857 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
5898 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 5858 case EXTERNAL_FLOAT_ELEMENTS: |
5899 case EXTERNAL_FLOAT_ELEMENTS: | 5859 case EXTERNAL_DOUBLE_ELEMENTS: |
5900 case EXTERNAL_DOUBLE_ELEMENTS: | 5860 case FAST_DOUBLE_ELEMENTS: |
5901 case FAST_DOUBLE_ELEMENTS: | 5861 case FAST_HOLEY_DOUBLE_ELEMENTS: |
5902 case FAST_HOLEY_DOUBLE_ELEMENTS: | 5862 // No contained objects, nothing to do. |
5903 // No contained objects, nothing to do. | 5863 break; |
5904 break; | 5864 } |
5905 } | 5865 } |
| 5866 |
5906 return copy; | 5867 return copy; |
5907 } | 5868 } |
5908 | 5869 |
5909 | 5870 |
5910 Handle<JSObject> JSObject::DeepWalk(Handle<JSObject> object, | 5871 Handle<JSObject> JSObject::DeepWalk( |
5911 AllocationSiteContext* site_context) { | 5872 Handle<JSObject> object, |
5912 JSObjectCreateAllocationSitesVisitor v(site_context); | 5873 AllocationSiteCreationContext* site_context) { |
5913 Handle<JSObject> result = v.Visit(object); | 5874 JSObjectWalkVisitor<AllocationSiteCreationContext> v(site_context, false, |
5914 ASSERT(!v.is_copying() && | 5875 kNoHints); |
5915 (result.is_null() || result.is_identical_to(object))); | 5876 Handle<JSObject> result = v.StructureWalk(object); |
| 5877 ASSERT(result.is_null() || result.is_identical_to(object)); |
5916 return result; | 5878 return result; |
5917 } | 5879 } |
5918 | 5880 |
5919 | 5881 |
5920 Handle<JSObject> JSObject::DeepCopy(Handle<JSObject> object, | 5882 Handle<JSObject> JSObject::DeepCopy(Handle<JSObject> object, |
5921 AllocationSiteContext* site_context) { | 5883 AllocationSiteUsageContext* site_context, |
5922 JSObjectCopyVisitor v(site_context); | 5884 DeepCopyHints hints) { |
5923 Handle<JSObject> copy = v.Visit(object); | 5885 JSObjectWalkVisitor<AllocationSiteUsageContext> v(site_context, true, hints); |
5924 ASSERT(v.is_copying() && !copy.is_identical_to(object)); | 5886 Handle<JSObject> copy = v.StructureWalk(object); |
| 5887 ASSERT(!copy.is_identical_to(object)); |
5925 return copy; | 5888 return copy; |
5926 } | 5889 } |
5927 | 5890 |
5928 | 5891 |
5929 // Tests for the fast common case for property enumeration: | 5892 // Tests for the fast common case for property enumeration: |
5930 // - This object and all prototypes has an enum cache (which means that | 5893 // - This object and all prototypes has an enum cache (which means that |
5931 // it is no proxy, has no interceptors and needs no access checks). | 5894 // it is no proxy, has no interceptors and needs no access checks). |
5932 // - This object has no elements. | 5895 // - This object has no elements. |
5933 // - No prototype has enumerable properties/elements. | 5896 // - No prototype has enumerable properties/elements. |
5934 bool JSReceiver::IsSimpleEnum() { | 5897 bool JSReceiver::IsSimpleEnum() { |
(...skipping 10733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16668 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16631 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16669 static const char* error_messages_[] = { | 16632 static const char* error_messages_[] = { |
16670 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16633 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16671 }; | 16634 }; |
16672 #undef ERROR_MESSAGES_TEXTS | 16635 #undef ERROR_MESSAGES_TEXTS |
16673 return error_messages_[reason]; | 16636 return error_messages_[reason]; |
16674 } | 16637 } |
16675 | 16638 |
16676 | 16639 |
16677 } } // namespace v8::internal | 16640 } } // namespace v8::internal |
OLD | NEW |