Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1807 ConstantDescriptor new_constant_desc(name, constant, attributes); | 1807 ConstantDescriptor new_constant_desc(name, constant, attributes); |
| 1808 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); | 1808 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); |
| 1809 } | 1809 } |
| 1810 | 1810 |
| 1811 | 1811 |
| 1812 void JSObject::AddFastProperty(Handle<JSObject> object, | 1812 void JSObject::AddFastProperty(Handle<JSObject> object, |
| 1813 Handle<Name> name, | 1813 Handle<Name> name, |
| 1814 Handle<Object> value, | 1814 Handle<Object> value, |
| 1815 PropertyAttributes attributes, | 1815 PropertyAttributes attributes, |
| 1816 StoreFromKeyed store_mode, | 1816 StoreFromKeyed store_mode, |
| 1817 ValueType value_type, | |
| 1818 TransitionFlag flag) { | 1817 TransitionFlag flag) { |
| 1819 ASSERT(!object->IsJSGlobalProxy()); | 1818 ASSERT(!object->IsJSGlobalProxy()); |
| 1820 | 1819 |
| 1821 MaybeHandle<Map> maybe_map; | 1820 MaybeHandle<Map> maybe_map; |
| 1822 if (value->IsJSFunction()) { | 1821 if (value->IsJSFunction()) { |
| 1823 maybe_map = Map::CopyWithConstant( | 1822 maybe_map = Map::CopyWithConstant( |
| 1824 handle(object->map()), name, value, attributes, flag); | 1823 handle(object->map()), name, value, attributes, flag); |
| 1825 } else if (!object->TooManyFastProperties(store_mode)) { | 1824 } else if (!object->TooManyFastProperties(store_mode)) { |
| 1826 Isolate* isolate = object->GetIsolate(); | 1825 Isolate* isolate = object->GetIsolate(); |
| 1827 Representation representation = value->OptimalRepresentation(value_type); | 1826 Representation representation = value->OptimalRepresentation(); |
| 1828 maybe_map = Map::CopyWithField( | 1827 maybe_map = Map::CopyWithField( |
| 1829 handle(object->map(), isolate), name, | 1828 handle(object->map(), isolate), name, |
| 1830 value->OptimalType(isolate, representation), | 1829 value->OptimalType(isolate, representation), |
| 1831 attributes, representation, flag); | 1830 attributes, representation, flag); |
| 1832 } | 1831 } |
| 1833 | 1832 |
| 1834 Handle<Map> new_map; | 1833 Handle<Map> new_map; |
| 1835 if (!maybe_map.ToHandle(&new_map)) { | 1834 if (!maybe_map.ToHandle(&new_map)) { |
| 1836 NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0); | 1835 NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0); |
| 1837 return; | 1836 return; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1874 | 1873 |
| 1875 | 1874 |
| 1876 MaybeHandle<Object> JSObject::AddPropertyInternal( | 1875 MaybeHandle<Object> JSObject::AddPropertyInternal( |
| 1877 Handle<JSObject> object, | 1876 Handle<JSObject> object, |
| 1878 Handle<Name> name, | 1877 Handle<Name> name, |
| 1879 Handle<Object> value, | 1878 Handle<Object> value, |
| 1880 PropertyAttributes attributes, | 1879 PropertyAttributes attributes, |
| 1881 StrictMode strict_mode, | 1880 StrictMode strict_mode, |
| 1882 JSReceiver::StoreFromKeyed store_mode, | 1881 JSReceiver::StoreFromKeyed store_mode, |
| 1883 ExtensibilityCheck extensibility_check, | 1882 ExtensibilityCheck extensibility_check, |
| 1884 ValueType value_type, | |
| 1885 StoreMode mode, | 1883 StoreMode mode, |
| 1886 TransitionFlag transition_flag) { | 1884 TransitionFlag transition_flag) { |
| 1887 ASSERT(!object->IsJSGlobalProxy()); | 1885 ASSERT(!object->IsJSGlobalProxy()); |
| 1888 Isolate* isolate = object->GetIsolate(); | 1886 Isolate* isolate = object->GetIsolate(); |
| 1889 | 1887 |
| 1890 if (!name->IsUniqueName()) { | 1888 if (!name->IsUniqueName()) { |
| 1891 name = isolate->factory()->InternalizeString( | 1889 name = isolate->factory()->InternalizeString( |
| 1892 Handle<String>::cast(name)); | 1890 Handle<String>::cast(name)); |
| 1893 } | 1891 } |
| 1894 | 1892 |
| 1895 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && | 1893 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && |
| 1896 !object->map()->is_extensible()) { | 1894 !object->map()->is_extensible()) { |
| 1897 if (strict_mode == SLOPPY) { | 1895 if (strict_mode == SLOPPY) { |
| 1898 return value; | 1896 return value; |
| 1899 } else { | 1897 } else { |
| 1900 Handle<Object> args[1] = { name }; | 1898 Handle<Object> args[1] = { name }; |
| 1901 Handle<Object> error = isolate->factory()->NewTypeError( | 1899 Handle<Object> error = isolate->factory()->NewTypeError( |
| 1902 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); | 1900 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); |
| 1903 return isolate->Throw<Object>(error); | 1901 return isolate->Throw<Object>(error); |
| 1904 } | 1902 } |
| 1905 } | 1903 } |
| 1906 | 1904 |
| 1907 if (object->HasFastProperties()) { | 1905 if (object->HasFastProperties()) { |
| 1908 AddFastProperty(object, name, value, attributes, store_mode, | 1906 AddFastProperty(object, name, value, attributes, |
| 1909 value_type, transition_flag); | 1907 store_mode, transition_flag); |
| 1910 } | 1908 } |
| 1911 | 1909 |
| 1912 if (!object->HasFastProperties()) { | 1910 if (!object->HasFastProperties()) { |
| 1913 AddSlowProperty(object, name, value, attributes); | 1911 AddSlowProperty(object, name, value, attributes); |
| 1914 } | 1912 } |
| 1915 | 1913 |
| 1916 if (object->map()->is_observed() && | 1914 if (object->map()->is_observed() && |
| 1917 *name != isolate->heap()->hidden_string()) { | 1915 *name != isolate->heap()->hidden_string()) { |
| 1918 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 1916 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 1919 EnqueueChangeRecord(object, "add", name, old_value); | 1917 EnqueueChangeRecord(object, "add", name, old_value); |
| (...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3925 Handle<DescriptorArray> descriptors(transition_map->instance_descriptors()); | 3923 Handle<DescriptorArray> descriptors(transition_map->instance_descriptors()); |
| 3926 PropertyDetails details = descriptors->GetDetails(descriptor); | 3924 PropertyDetails details = descriptors->GetDetails(descriptor); |
| 3927 | 3925 |
| 3928 if (details.type() == CALLBACKS || attributes != details.attributes()) { | 3926 if (details.type() == CALLBACKS || attributes != details.attributes()) { |
| 3929 // AddPropertyInternal will either normalize the object, or create a new | 3927 // AddPropertyInternal will either normalize the object, or create a new |
| 3930 // fast copy of the map. If we get a fast copy of the map, all field | 3928 // fast copy of the map. If we get a fast copy of the map, all field |
| 3931 // representations will be tagged since the transition is omitted. | 3929 // representations will be tagged since the transition is omitted. |
| 3932 return JSObject::AddPropertyInternal( | 3930 return JSObject::AddPropertyInternal( |
| 3933 object, name, value, attributes, SLOPPY, | 3931 object, name, value, attributes, SLOPPY, |
| 3934 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED, | 3932 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED, |
| 3935 JSReceiver::OMIT_EXTENSIBILITY_CHECK, | 3933 JSReceiver::OMIT_EXTENSIBILITY_CHECK, FORCE_FIELD, OMIT_TRANSITION); |
| 3936 JSObject::FORCE_TAGGED, FORCE_FIELD, OMIT_TRANSITION); | |
| 3937 } | 3934 } |
| 3938 | 3935 |
| 3939 // Keep the target CONSTANT if the same value is stored. | 3936 // Keep the target CONSTANT if the same value is stored. |
| 3940 // TODO(verwaest): Also support keeping the placeholder | 3937 // TODO(verwaest): Also support keeping the placeholder |
| 3941 // (value->IsUninitialized) as constant. | 3938 // (value->IsUninitialized) as constant. |
| 3942 if (!lookup->CanHoldValue(value)) { | 3939 if (!lookup->CanHoldValue(value)) { |
| 3943 Representation field_representation = value->OptimalRepresentation(); | 3940 Representation field_representation = value->OptimalRepresentation(); |
| 3944 Handle<HeapType> field_type = value->OptimalType( | 3941 Handle<HeapType> field_type = value->OptimalType( |
| 3945 lookup->isolate(), field_representation); | 3942 lookup->isolate(), field_representation); |
| 3946 transition_map = Map::GeneralizeRepresentation( | 3943 transition_map = Map::GeneralizeRepresentation( |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4171 | 4168 |
| 4172 return result; | 4169 return result; |
| 4173 } | 4170 } |
| 4174 | 4171 |
| 4175 | 4172 |
| 4176 void JSObject::AddProperty( | 4173 void JSObject::AddProperty( |
| 4177 Handle<JSObject> object, | 4174 Handle<JSObject> object, |
| 4178 Handle<Name> name, | 4175 Handle<Name> name, |
| 4179 Handle<Object> value, | 4176 Handle<Object> value, |
| 4180 PropertyAttributes attributes, | 4177 PropertyAttributes attributes, |
| 4181 ValueType value_type, | |
| 4182 StoreMode store_mode) { | 4178 StoreMode store_mode) { |
| 4183 #ifdef DEBUG | 4179 #ifdef DEBUG |
| 4184 uint32_t index; | 4180 uint32_t index; |
| 4185 ASSERT(!object->IsJSProxy()); | 4181 ASSERT(!object->IsJSProxy()); |
| 4186 ASSERT(!name->AsArrayIndex(&index)); | 4182 ASSERT(!name->AsArrayIndex(&index)); |
| 4187 LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL); | 4183 LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL); |
| 4188 GetPropertyAttributes(&it); | 4184 GetPropertyAttributes(&it); |
| 4189 ASSERT(!it.IsFound()); | 4185 ASSERT(!it.IsFound()); |
| 4190 ASSERT(object->map()->is_extensible()); | 4186 ASSERT(object->map()->is_extensible()); |
| 4191 #endif | 4187 #endif |
| 4192 SetOwnPropertyIgnoreAttributes( | 4188 SetOwnPropertyIgnoreAttributes( |
| 4193 object, name, value, attributes, value_type, store_mode, | 4189 object, name, value, attributes, store_mode, |
| 4194 OMIT_EXTENSIBILITY_CHECK).Check(); | 4190 OMIT_EXTENSIBILITY_CHECK).Check(); |
| 4195 } | 4191 } |
| 4196 | 4192 |
| 4197 | 4193 |
| 4198 // Set a real own property, even if it is READ_ONLY. If the property is not | 4194 // Set a real own property, even if it is READ_ONLY. If the property is not |
| 4199 // present, add it with attributes NONE. This code is an exact clone of | 4195 // present, add it with attributes NONE. This code is an exact clone of |
| 4200 // SetProperty, with the check for IsReadOnly and the check for a | 4196 // SetProperty, with the check for IsReadOnly and the check for a |
| 4201 // callback setter removed. The two lines looking up the LookupResult | 4197 // callback setter removed. The two lines looking up the LookupResult |
| 4202 // result are also added. If one of the functions is changed, the other | 4198 // result are also added. If one of the functions is changed, the other |
| 4203 // should be. | 4199 // should be. |
| 4204 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( | 4200 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
| 4205 Handle<JSObject> object, | 4201 Handle<JSObject> object, |
| 4206 Handle<Name> name, | 4202 Handle<Name> name, |
| 4207 Handle<Object> value, | 4203 Handle<Object> value, |
| 4208 PropertyAttributes attributes, | 4204 PropertyAttributes attributes, |
| 4209 ValueType value_type, | |
| 4210 StoreMode mode, | 4205 StoreMode mode, |
| 4211 ExtensibilityCheck extensibility_check, | 4206 ExtensibilityCheck extensibility_check, |
| 4212 StoreFromKeyed store_from_keyed, | 4207 StoreFromKeyed store_from_keyed, |
| 4213 ExecutableAccessorInfoHandling handling) { | 4208 ExecutableAccessorInfoHandling handling) { |
| 4214 Isolate* isolate = object->GetIsolate(); | 4209 Isolate* isolate = object->GetIsolate(); |
| 4215 | 4210 |
| 4216 // Make sure that the top context does not change when doing callbacks or | 4211 // Make sure that the top context does not change when doing callbacks or |
| 4217 // interceptor calls. | 4212 // interceptor calls. |
| 4218 AssertNoContextChange ncc(isolate); | 4213 AssertNoContextChange ncc(isolate); |
| 4219 | 4214 |
| 4220 LookupResult lookup(isolate); | 4215 LookupResult lookup(isolate); |
| 4221 object->LookupOwn(name, &lookup, true); | 4216 object->LookupOwn(name, &lookup, true); |
| 4222 if (!lookup.IsFound()) { | 4217 if (!lookup.IsFound()) { |
| 4223 object->map()->LookupTransition(*object, *name, &lookup); | 4218 object->map()->LookupTransition(*object, *name, &lookup); |
| 4224 } | 4219 } |
| 4225 | 4220 |
| 4226 // Check access rights if needed. | 4221 // Check access rights if needed. |
| 4227 if (object->IsAccessCheckNeeded()) { | 4222 if (object->IsAccessCheckNeeded()) { |
| 4228 if (!isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { | 4223 if (!isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { |
| 4229 return SetPropertyWithFailedAccessCheck(object, &lookup, name, value, | 4224 return SetPropertyWithFailedAccessCheck(object, &lookup, name, value, |
| 4230 false, SLOPPY); | 4225 false, SLOPPY); |
| 4231 } | 4226 } |
| 4232 } | 4227 } |
| 4233 | 4228 |
| 4234 if (object->IsJSGlobalProxy()) { | 4229 if (object->IsJSGlobalProxy()) { |
| 4235 Handle<Object> proto(object->GetPrototype(), isolate); | 4230 Handle<Object> proto(object->GetPrototype(), isolate); |
| 4236 if (proto->IsNull()) return value; | 4231 if (proto->IsNull()) return value; |
| 4237 ASSERT(proto->IsJSGlobalObject()); | 4232 ASSERT(proto->IsJSGlobalObject()); |
| 4238 return SetOwnPropertyIgnoreAttributes(Handle<JSObject>::cast(proto), | 4233 return SetOwnPropertyIgnoreAttributes(Handle<JSObject>::cast(proto), |
| 4239 name, value, attributes, value_type, mode, extensibility_check); | 4234 name, value, attributes, mode, extensibility_check); |
| 4240 } | 4235 } |
| 4241 | 4236 |
| 4242 if (lookup.IsInterceptor() || | 4237 if (lookup.IsInterceptor() || |
| 4243 (lookup.IsDescriptorOrDictionary() && lookup.type() == CALLBACKS)) { | 4238 (lookup.IsDescriptorOrDictionary() && lookup.type() == CALLBACKS)) { |
| 4244 object->LookupOwnRealNamedProperty(name, &lookup); | 4239 object->LookupOwnRealNamedProperty(name, &lookup); |
| 4245 } | 4240 } |
| 4246 | 4241 |
| 4247 // Check for accessor in prototype chain removed here in clone. | 4242 // Check for accessor in prototype chain removed here in clone. |
| 4248 if (!lookup.IsFound()) { | 4243 if (!lookup.IsFound()) { |
| 4249 object->map()->LookupTransition(*object, *name, &lookup); | 4244 object->map()->LookupTransition(*object, *name, &lookup); |
| 4250 TransitionFlag flag = lookup.IsFound() | 4245 TransitionFlag flag = lookup.IsFound() |
| 4251 ? OMIT_TRANSITION : INSERT_TRANSITION; | 4246 ? OMIT_TRANSITION : INSERT_TRANSITION; |
| 4252 // Neither properties nor transitions found. | 4247 // Neither properties nor transitions found. |
| 4253 return AddPropertyInternal(object, name, value, attributes, SLOPPY, | 4248 return AddPropertyInternal(object, name, value, attributes, SLOPPY, |
| 4254 store_from_keyed, extensibility_check, value_type, mode, flag); | 4249 store_from_keyed, extensibility_check, mode, flag); |
| 4255 } | 4250 } |
| 4256 | 4251 |
| 4257 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4252 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 4258 PropertyAttributes old_attributes = ABSENT; | 4253 PropertyAttributes old_attributes = ABSENT; |
| 4259 bool is_observed = object->map()->is_observed() && | 4254 bool is_observed = object->map()->is_observed() && |
| 4260 *name != isolate->heap()->hidden_string(); | 4255 *name != isolate->heap()->hidden_string(); |
| 4261 if (is_observed && lookup.IsProperty()) { | 4256 if (is_observed && lookup.IsProperty()) { |
| 4262 if (lookup.IsDataProperty()) { | 4257 if (lookup.IsDataProperty()) { |
| 4263 old_value = Object::GetPropertyOrElement(object, name).ToHandleChecked(); | 4258 old_value = Object::GetPropertyOrElement(object, name).ToHandleChecked(); |
| 4264 } | 4259 } |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5201 if (descriptors->number_of_descriptors() > 0) { | 5196 if (descriptors->number_of_descriptors() > 0) { |
| 5202 int sorted_index = descriptors->GetSortedKeyIndex(0); | 5197 int sorted_index = descriptors->GetSortedKeyIndex(0); |
| 5203 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string() | 5198 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string() |
| 5204 && sorted_index < object->map()->NumberOfOwnDescriptors()) { | 5199 && sorted_index < object->map()->NumberOfOwnDescriptors()) { |
| 5205 object->WriteToField(sorted_index, *value); | 5200 object->WriteToField(sorted_index, *value); |
| 5206 return object; | 5201 return object; |
| 5207 } | 5202 } |
| 5208 } | 5203 } |
| 5209 } | 5204 } |
| 5210 | 5205 |
| 5211 SetOwnPropertyIgnoreAttributes(object, | 5206 SetOwnPropertyIgnoreAttributes( |
| 5212 isolate->factory()->hidden_string(), | 5207 object, isolate->factory()->hidden_string(), value, DONT_ENUM, |
| 5213 value, | 5208 ALLOW_AS_CONSTANT, OMIT_EXTENSIBILITY_CHECK).Assert(); |
| 5214 DONT_ENUM, | |
| 5215 OPTIMAL_REPRESENTATION, | |
| 5216 ALLOW_AS_CONSTANT, | |
| 5217 OMIT_EXTENSIBILITY_CHECK).Assert(); | |
| 5218 return object; | 5209 return object; |
| 5219 } | 5210 } |
| 5220 | 5211 |
| 5221 | 5212 |
| 5222 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, | 5213 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, |
| 5223 Handle<Name> name, | 5214 Handle<Name> name, |
| 5224 DeleteMode mode) { | 5215 DeleteMode mode) { |
| 5225 // Check own property, ignore interceptor. | 5216 // Check own property, ignore interceptor. |
| 5226 Isolate* isolate = object->GetIsolate(); | 5217 Isolate* isolate = object->GetIsolate(); |
| 5227 LookupResult result(isolate); | 5218 LookupResult result(isolate); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5551 kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS : | 5542 kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS : |
| 5552 FAST_HOLEY_ELEMENTS; | 5543 FAST_HOLEY_ELEMENTS; |
| 5553 if (ReferencesObjectFromElements(arguments, kind, obj)) return true; | 5544 if (ReferencesObjectFromElements(arguments, kind, obj)) return true; |
| 5554 break; | 5545 break; |
| 5555 } | 5546 } |
| 5556 } | 5547 } |
| 5557 | 5548 |
| 5558 // For functions check the context. | 5549 // For functions check the context. |
| 5559 if (IsJSFunction()) { | 5550 if (IsJSFunction()) { |
| 5560 // Get the constructor function for arguments array. | 5551 // Get the constructor function for arguments array. |
| 5561 JSObject* arguments_boilerplate = | 5552 Map* arguments_map = |
| 5562 heap->isolate()->context()->native_context()-> | 5553 heap->isolate()->context()->native_context()->sloppy_arguments_map(); |
|
Igor Sheludko
2014/07/02 14:17:14
While you are here: isolate()->sloppy_arguments_ma
| |
| 5563 sloppy_arguments_boilerplate(); | |
| 5564 JSFunction* arguments_function = | 5554 JSFunction* arguments_function = |
| 5565 JSFunction::cast(arguments_boilerplate->map()->constructor()); | 5555 JSFunction::cast(arguments_map->constructor()); |
| 5566 | 5556 |
| 5567 // Get the context and don't check if it is the native context. | 5557 // Get the context and don't check if it is the native context. |
| 5568 JSFunction* f = JSFunction::cast(this); | 5558 JSFunction* f = JSFunction::cast(this); |
| 5569 Context* context = f->context(); | 5559 Context* context = f->context(); |
| 5570 if (context->IsNativeContext()) { | 5560 if (context->IsNativeContext()) { |
| 5571 return false; | 5561 return false; |
| 5572 } | 5562 } |
| 5573 | 5563 |
| 5574 // Check the non-special context slots. | 5564 // Check the non-special context slots. |
| 5575 for (int i = Context::MIN_CONTEXT_SLOTS; i < context->length(); i++) { | 5565 for (int i = Context::MIN_CONTEXT_SLOTS; i < context->length(); i++) { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5846 const bool copying_; | 5836 const bool copying_; |
| 5847 const JSObject::DeepCopyHints hints_; | 5837 const JSObject::DeepCopyHints hints_; |
| 5848 }; | 5838 }; |
| 5849 | 5839 |
| 5850 | 5840 |
| 5851 template <class ContextObject> | 5841 template <class ContextObject> |
| 5852 MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( | 5842 MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( |
| 5853 Handle<JSObject> object) { | 5843 Handle<JSObject> object) { |
| 5854 Isolate* isolate = this->isolate(); | 5844 Isolate* isolate = this->isolate(); |
| 5855 bool copying = this->copying(); | 5845 bool copying = this->copying(); |
| 5856 bool shallow = hints_ == JSObject::kObjectIsShallowArray; | 5846 bool shallow = hints_ == JSObject::kObjectIsShallow; |
| 5857 | 5847 |
| 5858 if (!shallow) { | 5848 if (!shallow) { |
| 5859 StackLimitCheck check(isolate); | 5849 StackLimitCheck check(isolate); |
| 5860 | 5850 |
| 5861 if (check.HasOverflowed()) { | 5851 if (check.HasOverflowed()) { |
| 5862 isolate->StackOverflow(); | 5852 isolate->StackOverflow(); |
| 5863 return MaybeHandle<JSObject>(); | 5853 return MaybeHandle<JSObject>(); |
| 5864 } | 5854 } |
| 5865 } | 5855 } |
| 5866 | 5856 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6333 return storage; | 6323 return storage; |
| 6334 } | 6324 } |
| 6335 } | 6325 } |
| 6336 | 6326 |
| 6337 | 6327 |
| 6338 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, | 6328 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
| 6339 KeyCollectionType type) { | 6329 KeyCollectionType type) { |
| 6340 USE(ContainsOnlyValidKeys); | 6330 USE(ContainsOnlyValidKeys); |
| 6341 Isolate* isolate = object->GetIsolate(); | 6331 Isolate* isolate = object->GetIsolate(); |
| 6342 Handle<FixedArray> content = isolate->factory()->empty_fixed_array(); | 6332 Handle<FixedArray> content = isolate->factory()->empty_fixed_array(); |
| 6343 Handle<JSObject> arguments_boilerplate = Handle<JSObject>( | 6333 Handle<JSFunction> arguments_function( |
| 6344 isolate->context()->native_context()->sloppy_arguments_boilerplate(), | 6334 JSFunction::cast(isolate->sloppy_arguments_map()->constructor())); |
| 6345 isolate); | |
| 6346 Handle<JSFunction> arguments_function = Handle<JSFunction>( | |
| 6347 JSFunction::cast(arguments_boilerplate->map()->constructor()), | |
| 6348 isolate); | |
| 6349 | 6335 |
| 6350 // Only collect keys if access is permitted. | 6336 // Only collect keys if access is permitted. |
| 6351 for (Handle<Object> p = object; | 6337 for (Handle<Object> p = object; |
| 6352 *p != isolate->heap()->null_value(); | 6338 *p != isolate->heap()->null_value(); |
| 6353 p = Handle<Object>(p->GetPrototype(isolate), isolate)) { | 6339 p = Handle<Object>(p->GetPrototype(isolate), isolate)) { |
| 6354 if (p->IsJSProxy()) { | 6340 if (p->IsJSProxy()) { |
| 6355 Handle<JSProxy> proxy(JSProxy::cast(*p), isolate); | 6341 Handle<JSProxy> proxy(JSProxy::cast(*p), isolate); |
| 6356 Handle<Object> args[] = { proxy }; | 6342 Handle<Object> args[] = { proxy }; |
| 6357 Handle<Object> names; | 6343 Handle<Object> names; |
| 6358 ASSIGN_RETURN_ON_EXCEPTION( | 6344 ASSIGN_RETURN_ON_EXCEPTION( |
| (...skipping 10598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16957 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16943 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16958 static const char* error_messages_[] = { | 16944 static const char* error_messages_[] = { |
| 16959 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16945 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16960 }; | 16946 }; |
| 16961 #undef ERROR_MESSAGES_TEXTS | 16947 #undef ERROR_MESSAGES_TEXTS |
| 16962 return error_messages_[reason]; | 16948 return error_messages_[reason]; |
| 16963 } | 16949 } |
| 16964 | 16950 |
| 16965 | 16951 |
| 16966 } } // namespace v8::internal | 16952 } } // namespace v8::internal |
| OLD | NEW |