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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 ConstantDescriptor new_constant_desc(name, constant, attributes); | 1827 ConstantDescriptor new_constant_desc(name, constant, attributes); |
1828 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); | 1828 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); |
1829 } | 1829 } |
1830 | 1830 |
1831 | 1831 |
1832 void JSObject::AddFastProperty(Handle<JSObject> object, | 1832 void JSObject::AddFastProperty(Handle<JSObject> object, |
1833 Handle<Name> name, | 1833 Handle<Name> name, |
1834 Handle<Object> value, | 1834 Handle<Object> value, |
1835 PropertyAttributes attributes, | 1835 PropertyAttributes attributes, |
1836 StoreFromKeyed store_mode, | 1836 StoreFromKeyed store_mode, |
1837 ValueType value_type, | |
1838 TransitionFlag flag) { | 1837 TransitionFlag flag) { |
1839 ASSERT(!object->IsJSGlobalProxy()); | 1838 ASSERT(!object->IsJSGlobalProxy()); |
1840 | 1839 |
1841 MaybeHandle<Map> maybe_map; | 1840 MaybeHandle<Map> maybe_map; |
1842 if (value->IsJSFunction()) { | 1841 if (value->IsJSFunction()) { |
1843 maybe_map = Map::CopyWithConstant( | 1842 maybe_map = Map::CopyWithConstant( |
1844 handle(object->map()), name, value, attributes, flag); | 1843 handle(object->map()), name, value, attributes, flag); |
1845 } else if (!object->TooManyFastProperties(store_mode)) { | 1844 } else if (!object->TooManyFastProperties(store_mode)) { |
1846 Isolate* isolate = object->GetIsolate(); | 1845 Isolate* isolate = object->GetIsolate(); |
1847 Representation representation = value->OptimalRepresentation(value_type); | 1846 Representation representation = value->OptimalRepresentation(); |
1848 maybe_map = Map::CopyWithField( | 1847 maybe_map = Map::CopyWithField( |
1849 handle(object->map(), isolate), name, | 1848 handle(object->map(), isolate), name, |
1850 value->OptimalType(isolate, representation), | 1849 value->OptimalType(isolate, representation), |
1851 attributes, representation, flag); | 1850 attributes, representation, flag); |
1852 } | 1851 } |
1853 | 1852 |
1854 Handle<Map> new_map; | 1853 Handle<Map> new_map; |
1855 if (!maybe_map.ToHandle(&new_map)) { | 1854 if (!maybe_map.ToHandle(&new_map)) { |
1856 NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0); | 1855 NormalizeProperties(object, CLEAR_INOBJECT_PROPERTIES, 0); |
1857 return; | 1856 return; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 | 1893 |
1895 | 1894 |
1896 MaybeHandle<Object> JSObject::AddPropertyInternal( | 1895 MaybeHandle<Object> JSObject::AddPropertyInternal( |
1897 Handle<JSObject> object, | 1896 Handle<JSObject> object, |
1898 Handle<Name> name, | 1897 Handle<Name> name, |
1899 Handle<Object> value, | 1898 Handle<Object> value, |
1900 PropertyAttributes attributes, | 1899 PropertyAttributes attributes, |
1901 StrictMode strict_mode, | 1900 StrictMode strict_mode, |
1902 JSReceiver::StoreFromKeyed store_mode, | 1901 JSReceiver::StoreFromKeyed store_mode, |
1903 ExtensibilityCheck extensibility_check, | 1902 ExtensibilityCheck extensibility_check, |
1904 ValueType value_type, | |
1905 StoreMode mode, | 1903 StoreMode mode, |
1906 TransitionFlag transition_flag) { | 1904 TransitionFlag transition_flag) { |
1907 ASSERT(!object->IsJSGlobalProxy()); | 1905 ASSERT(!object->IsJSGlobalProxy()); |
1908 Isolate* isolate = object->GetIsolate(); | 1906 Isolate* isolate = object->GetIsolate(); |
1909 | 1907 |
1910 if (!name->IsUniqueName()) { | 1908 if (!name->IsUniqueName()) { |
1911 name = isolate->factory()->InternalizeString( | 1909 name = isolate->factory()->InternalizeString( |
1912 Handle<String>::cast(name)); | 1910 Handle<String>::cast(name)); |
1913 } | 1911 } |
1914 | 1912 |
1915 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && | 1913 if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK && |
1916 !object->map()->is_extensible()) { | 1914 !object->map()->is_extensible()) { |
1917 if (strict_mode == SLOPPY) { | 1915 if (strict_mode == SLOPPY) { |
1918 return value; | 1916 return value; |
1919 } else { | 1917 } else { |
1920 Handle<Object> args[1] = { name }; | 1918 Handle<Object> args[1] = { name }; |
1921 Handle<Object> error = isolate->factory()->NewTypeError( | 1919 Handle<Object> error = isolate->factory()->NewTypeError( |
1922 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); | 1920 "object_not_extensible", HandleVector(args, ARRAY_SIZE(args))); |
1923 return isolate->Throw<Object>(error); | 1921 return isolate->Throw<Object>(error); |
1924 } | 1922 } |
1925 } | 1923 } |
1926 | 1924 |
1927 if (object->HasFastProperties()) { | 1925 if (object->HasFastProperties()) { |
1928 AddFastProperty(object, name, value, attributes, store_mode, | 1926 AddFastProperty(object, name, value, attributes, store_mode, |
1929 value_type, transition_flag); | 1927 transition_flag); |
1930 } | 1928 } |
1931 | 1929 |
1932 if (!object->HasFastProperties()) { | 1930 if (!object->HasFastProperties()) { |
1933 AddSlowProperty(object, name, value, attributes); | 1931 AddSlowProperty(object, name, value, attributes); |
1934 } | 1932 } |
1935 | 1933 |
1936 if (object->map()->is_observed() && | 1934 if (object->map()->is_observed() && |
1937 *name != isolate->heap()->hidden_string()) { | 1935 *name != isolate->heap()->hidden_string()) { |
1938 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 1936 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
1939 EnqueueChangeRecord(object, "add", name, old_value); | 1937 EnqueueChangeRecord(object, "add", name, old_value); |
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3969 Handle<DescriptorArray> descriptors(transition_map->instance_descriptors()); | 3967 Handle<DescriptorArray> descriptors(transition_map->instance_descriptors()); |
3970 PropertyDetails details = descriptors->GetDetails(descriptor); | 3968 PropertyDetails details = descriptors->GetDetails(descriptor); |
3971 | 3969 |
3972 if (details.type() == CALLBACKS || attributes != details.attributes()) { | 3970 if (details.type() == CALLBACKS || attributes != details.attributes()) { |
3973 // AddPropertyInternal will either normalize the object, or create a new | 3971 // AddPropertyInternal will either normalize the object, or create a new |
3974 // fast copy of the map. If we get a fast copy of the map, all field | 3972 // fast copy of the map. If we get a fast copy of the map, all field |
3975 // representations will be tagged since the transition is omitted. | 3973 // representations will be tagged since the transition is omitted. |
3976 return JSObject::AddPropertyInternal( | 3974 return JSObject::AddPropertyInternal( |
3977 object, name, value, attributes, SLOPPY, | 3975 object, name, value, attributes, SLOPPY, |
3978 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED, | 3976 JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED, |
3979 JSReceiver::OMIT_EXTENSIBILITY_CHECK, | 3977 JSReceiver::OMIT_EXTENSIBILITY_CHECK, FORCE_FIELD, OMIT_TRANSITION); |
3980 JSObject::FORCE_TAGGED, FORCE_FIELD, OMIT_TRANSITION); | |
3981 } | 3978 } |
3982 | 3979 |
3983 // Keep the target CONSTANT if the same value is stored. | 3980 // Keep the target CONSTANT if the same value is stored. |
3984 // TODO(verwaest): Also support keeping the placeholder | 3981 // TODO(verwaest): Also support keeping the placeholder |
3985 // (value->IsUninitialized) as constant. | 3982 // (value->IsUninitialized) as constant. |
3986 if (!lookup->CanHoldValue(value)) { | 3983 if (!lookup->CanHoldValue(value)) { |
3987 Representation field_representation = value->OptimalRepresentation(); | 3984 Representation field_representation = value->OptimalRepresentation(); |
3988 Handle<HeapType> field_type = value->OptimalType( | 3985 Handle<HeapType> field_type = value->OptimalType( |
3989 lookup->isolate(), field_representation); | 3986 lookup->isolate(), field_representation); |
3990 transition_map = Map::GeneralizeRepresentation( | 3987 transition_map = Map::GeneralizeRepresentation( |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4216 | 4213 |
4217 return result; | 4214 return result; |
4218 } | 4215 } |
4219 | 4216 |
4220 | 4217 |
4221 void JSObject::AddProperty( | 4218 void JSObject::AddProperty( |
4222 Handle<JSObject> object, | 4219 Handle<JSObject> object, |
4223 Handle<Name> name, | 4220 Handle<Name> name, |
4224 Handle<Object> value, | 4221 Handle<Object> value, |
4225 PropertyAttributes attributes, | 4222 PropertyAttributes attributes, |
4226 ValueType value_type, | |
4227 StoreMode store_mode) { | 4223 StoreMode store_mode) { |
4228 #ifdef DEBUG | 4224 #ifdef DEBUG |
4229 uint32_t index; | 4225 uint32_t index; |
4230 ASSERT(!object->IsJSProxy()); | 4226 ASSERT(!object->IsJSProxy()); |
4231 ASSERT(!name->AsArrayIndex(&index)); | 4227 ASSERT(!name->AsArrayIndex(&index)); |
4232 LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL); | 4228 LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL); |
4233 GetPropertyAttributes(&it); | 4229 GetPropertyAttributes(&it); |
4234 ASSERT(!it.IsFound()); | 4230 ASSERT(!it.IsFound()); |
4235 ASSERT(object->map()->is_extensible()); | 4231 ASSERT(object->map()->is_extensible()); |
4236 #endif | 4232 #endif |
4237 SetOwnPropertyIgnoreAttributes( | 4233 SetOwnPropertyIgnoreAttributes(object, name, value, attributes, store_mode, |
4238 object, name, value, attributes, value_type, store_mode, | 4234 OMIT_EXTENSIBILITY_CHECK).Check(); |
4239 OMIT_EXTENSIBILITY_CHECK).Check(); | |
4240 } | 4235 } |
4241 | 4236 |
4242 | 4237 |
4243 // Set a real own property, even if it is READ_ONLY. If the property is not | 4238 // Set a real own property, even if it is READ_ONLY. If the property is not |
4244 // present, add it with attributes NONE. This code is an exact clone of | 4239 // present, add it with attributes NONE. This code is an exact clone of |
4245 // SetProperty, with the check for IsReadOnly and the check for a | 4240 // SetProperty, with the check for IsReadOnly and the check for a |
4246 // callback setter removed. The two lines looking up the LookupResult | 4241 // callback setter removed. The two lines looking up the LookupResult |
4247 // result are also added. If one of the functions is changed, the other | 4242 // result are also added. If one of the functions is changed, the other |
4248 // should be. | 4243 // should be. |
4249 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( | 4244 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
4250 Handle<JSObject> object, | 4245 Handle<JSObject> object, |
4251 Handle<Name> name, | 4246 Handle<Name> name, |
4252 Handle<Object> value, | 4247 Handle<Object> value, |
4253 PropertyAttributes attributes, | 4248 PropertyAttributes attributes, |
4254 ValueType value_type, | |
4255 StoreMode mode, | 4249 StoreMode mode, |
4256 ExtensibilityCheck extensibility_check, | 4250 ExtensibilityCheck extensibility_check, |
4257 StoreFromKeyed store_from_keyed, | 4251 StoreFromKeyed store_from_keyed, |
4258 ExecutableAccessorInfoHandling handling) { | 4252 ExecutableAccessorInfoHandling handling) { |
4259 Isolate* isolate = object->GetIsolate(); | 4253 Isolate* isolate = object->GetIsolate(); |
4260 | 4254 |
4261 // Make sure that the top context does not change when doing callbacks or | 4255 // Make sure that the top context does not change when doing callbacks or |
4262 // interceptor calls. | 4256 // interceptor calls. |
4263 AssertNoContextChange ncc(isolate); | 4257 AssertNoContextChange ncc(isolate); |
4264 | 4258 |
4265 LookupResult lookup(isolate); | 4259 LookupResult lookup(isolate); |
4266 object->LookupOwn(name, &lookup, true); | 4260 object->LookupOwn(name, &lookup, true); |
4267 if (!lookup.IsFound()) { | 4261 if (!lookup.IsFound()) { |
4268 object->map()->LookupTransition(*object, *name, &lookup); | 4262 object->map()->LookupTransition(*object, *name, &lookup); |
4269 } | 4263 } |
4270 | 4264 |
4271 // Check access rights if needed. | 4265 // Check access rights if needed. |
4272 if (object->IsAccessCheckNeeded()) { | 4266 if (object->IsAccessCheckNeeded()) { |
4273 if (!isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { | 4267 if (!isolate->MayNamedAccess(object, name, v8::ACCESS_SET)) { |
4274 return SetPropertyWithFailedAccessCheck(object, &lookup, name, value, | 4268 return SetPropertyWithFailedAccessCheck(object, &lookup, name, value, |
4275 false, SLOPPY); | 4269 false, SLOPPY); |
4276 } | 4270 } |
4277 } | 4271 } |
4278 | 4272 |
4279 if (object->IsJSGlobalProxy()) { | 4273 if (object->IsJSGlobalProxy()) { |
4280 Handle<Object> proto(object->GetPrototype(), isolate); | 4274 Handle<Object> proto(object->GetPrototype(), isolate); |
4281 if (proto->IsNull()) return value; | 4275 if (proto->IsNull()) return value; |
4282 ASSERT(proto->IsJSGlobalObject()); | 4276 ASSERT(proto->IsJSGlobalObject()); |
4283 return SetOwnPropertyIgnoreAttributes(Handle<JSObject>::cast(proto), | 4277 return SetOwnPropertyIgnoreAttributes(Handle<JSObject>::cast(proto), name, |
4284 name, value, attributes, value_type, mode, extensibility_check); | 4278 value, attributes, mode, |
| 4279 extensibility_check); |
4285 } | 4280 } |
4286 | 4281 |
4287 if (lookup.IsInterceptor() || | 4282 if (lookup.IsInterceptor() || |
4288 (lookup.IsDescriptorOrDictionary() && lookup.type() == CALLBACKS)) { | 4283 (lookup.IsDescriptorOrDictionary() && lookup.type() == CALLBACKS)) { |
4289 object->LookupOwnRealNamedProperty(name, &lookup); | 4284 object->LookupOwnRealNamedProperty(name, &lookup); |
4290 } | 4285 } |
4291 | 4286 |
4292 // Check for accessor in prototype chain removed here in clone. | 4287 // Check for accessor in prototype chain removed here in clone. |
4293 if (!lookup.IsFound()) { | 4288 if (!lookup.IsFound()) { |
4294 object->map()->LookupTransition(*object, *name, &lookup); | 4289 object->map()->LookupTransition(*object, *name, &lookup); |
4295 TransitionFlag flag = lookup.IsFound() | 4290 TransitionFlag flag = lookup.IsFound() |
4296 ? OMIT_TRANSITION : INSERT_TRANSITION; | 4291 ? OMIT_TRANSITION : INSERT_TRANSITION; |
4297 // Neither properties nor transitions found. | 4292 // Neither properties nor transitions found. |
4298 return AddPropertyInternal(object, name, value, attributes, SLOPPY, | 4293 return AddPropertyInternal(object, name, value, attributes, SLOPPY, |
4299 store_from_keyed, extensibility_check, value_type, mode, flag); | 4294 store_from_keyed, extensibility_check, mode, |
| 4295 flag); |
4300 } | 4296 } |
4301 | 4297 |
4302 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4298 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
4303 PropertyAttributes old_attributes = ABSENT; | 4299 PropertyAttributes old_attributes = ABSENT; |
4304 bool is_observed = object->map()->is_observed() && | 4300 bool is_observed = object->map()->is_observed() && |
4305 *name != isolate->heap()->hidden_string(); | 4301 *name != isolate->heap()->hidden_string(); |
4306 if (is_observed && lookup.IsProperty()) { | 4302 if (is_observed && lookup.IsProperty()) { |
4307 if (lookup.IsDataProperty()) { | 4303 if (lookup.IsDataProperty()) { |
4308 old_value = Object::GetPropertyOrElement(object, name).ToHandleChecked(); | 4304 old_value = Object::GetPropertyOrElement(object, name).ToHandleChecked(); |
4309 } | 4305 } |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5253 if (descriptors->number_of_descriptors() > 0) { | 5249 if (descriptors->number_of_descriptors() > 0) { |
5254 int sorted_index = descriptors->GetSortedKeyIndex(0); | 5250 int sorted_index = descriptors->GetSortedKeyIndex(0); |
5255 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string() | 5251 if (descriptors->GetKey(sorted_index) == isolate->heap()->hidden_string() |
5256 && sorted_index < object->map()->NumberOfOwnDescriptors()) { | 5252 && sorted_index < object->map()->NumberOfOwnDescriptors()) { |
5257 object->WriteToField(sorted_index, *value); | 5253 object->WriteToField(sorted_index, *value); |
5258 return object; | 5254 return object; |
5259 } | 5255 } |
5260 } | 5256 } |
5261 } | 5257 } |
5262 | 5258 |
5263 SetOwnPropertyIgnoreAttributes(object, | 5259 SetOwnPropertyIgnoreAttributes(object, isolate->factory()->hidden_string(), |
5264 isolate->factory()->hidden_string(), | 5260 value, DONT_ENUM, ALLOW_AS_CONSTANT, |
5265 value, | |
5266 DONT_ENUM, | |
5267 OPTIMAL_REPRESENTATION, | |
5268 ALLOW_AS_CONSTANT, | |
5269 OMIT_EXTENSIBILITY_CHECK).Assert(); | 5261 OMIT_EXTENSIBILITY_CHECK).Assert(); |
5270 return object; | 5262 return object; |
5271 } | 5263 } |
5272 | 5264 |
5273 | 5265 |
5274 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, | 5266 Handle<Object> JSObject::DeletePropertyPostInterceptor(Handle<JSObject> object, |
5275 Handle<Name> name, | 5267 Handle<Name> name, |
5276 DeleteMode mode) { | 5268 DeleteMode mode) { |
5277 // Check own property, ignore interceptor. | 5269 // Check own property, ignore interceptor. |
5278 Isolate* isolate = object->GetIsolate(); | 5270 Isolate* isolate = object->GetIsolate(); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5603 kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS : | 5595 kind = arguments->IsDictionary() ? DICTIONARY_ELEMENTS : |
5604 FAST_HOLEY_ELEMENTS; | 5596 FAST_HOLEY_ELEMENTS; |
5605 if (ReferencesObjectFromElements(arguments, kind, obj)) return true; | 5597 if (ReferencesObjectFromElements(arguments, kind, obj)) return true; |
5606 break; | 5598 break; |
5607 } | 5599 } |
5608 } | 5600 } |
5609 | 5601 |
5610 // For functions check the context. | 5602 // For functions check the context. |
5611 if (IsJSFunction()) { | 5603 if (IsJSFunction()) { |
5612 // Get the constructor function for arguments array. | 5604 // Get the constructor function for arguments array. |
5613 JSObject* arguments_boilerplate = | 5605 Map* arguments_map = |
5614 heap->isolate()->context()->native_context()-> | 5606 heap->isolate()->context()->native_context()->sloppy_arguments_map(); |
5615 sloppy_arguments_boilerplate(); | |
5616 JSFunction* arguments_function = | 5607 JSFunction* arguments_function = |
5617 JSFunction::cast(arguments_boilerplate->map()->constructor()); | 5608 JSFunction::cast(arguments_map->constructor()); |
5618 | 5609 |
5619 // Get the context and don't check if it is the native context. | 5610 // Get the context and don't check if it is the native context. |
5620 JSFunction* f = JSFunction::cast(this); | 5611 JSFunction* f = JSFunction::cast(this); |
5621 Context* context = f->context(); | 5612 Context* context = f->context(); |
5622 if (context->IsNativeContext()) { | 5613 if (context->IsNativeContext()) { |
5623 return false; | 5614 return false; |
5624 } | 5615 } |
5625 | 5616 |
5626 // Check the non-special context slots. | 5617 // Check the non-special context slots. |
5627 for (int i = Context::MIN_CONTEXT_SLOTS; i < context->length(); i++) { | 5618 for (int i = Context::MIN_CONTEXT_SLOTS; i < context->length(); i++) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5899 const bool copying_; | 5890 const bool copying_; |
5900 const JSObject::DeepCopyHints hints_; | 5891 const JSObject::DeepCopyHints hints_; |
5901 }; | 5892 }; |
5902 | 5893 |
5903 | 5894 |
5904 template <class ContextObject> | 5895 template <class ContextObject> |
5905 MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( | 5896 MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( |
5906 Handle<JSObject> object) { | 5897 Handle<JSObject> object) { |
5907 Isolate* isolate = this->isolate(); | 5898 Isolate* isolate = this->isolate(); |
5908 bool copying = this->copying(); | 5899 bool copying = this->copying(); |
5909 bool shallow = hints_ == JSObject::kObjectIsShallowArray; | 5900 bool shallow = hints_ == JSObject::kObjectIsShallow; |
5910 | 5901 |
5911 if (!shallow) { | 5902 if (!shallow) { |
5912 StackLimitCheck check(isolate); | 5903 StackLimitCheck check(isolate); |
5913 | 5904 |
5914 if (check.HasOverflowed()) { | 5905 if (check.HasOverflowed()) { |
5915 isolate->StackOverflow(); | 5906 isolate->StackOverflow(); |
5916 return MaybeHandle<JSObject>(); | 5907 return MaybeHandle<JSObject>(); |
5917 } | 5908 } |
5918 } | 5909 } |
5919 | 5910 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6386 return storage; | 6377 return storage; |
6387 } | 6378 } |
6388 } | 6379 } |
6389 | 6380 |
6390 | 6381 |
6391 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, | 6382 MaybeHandle<FixedArray> JSReceiver::GetKeys(Handle<JSReceiver> object, |
6392 KeyCollectionType type) { | 6383 KeyCollectionType type) { |
6393 USE(ContainsOnlyValidKeys); | 6384 USE(ContainsOnlyValidKeys); |
6394 Isolate* isolate = object->GetIsolate(); | 6385 Isolate* isolate = object->GetIsolate(); |
6395 Handle<FixedArray> content = isolate->factory()->empty_fixed_array(); | 6386 Handle<FixedArray> content = isolate->factory()->empty_fixed_array(); |
6396 Handle<JSObject> arguments_boilerplate = Handle<JSObject>( | 6387 Handle<JSFunction> arguments_function( |
6397 isolate->context()->native_context()->sloppy_arguments_boilerplate(), | 6388 JSFunction::cast(isolate->sloppy_arguments_map()->constructor())); |
6398 isolate); | |
6399 Handle<JSFunction> arguments_function = Handle<JSFunction>( | |
6400 JSFunction::cast(arguments_boilerplate->map()->constructor()), | |
6401 isolate); | |
6402 | 6389 |
6403 // Only collect keys if access is permitted. | 6390 // Only collect keys if access is permitted. |
6404 for (Handle<Object> p = object; | 6391 for (Handle<Object> p = object; |
6405 *p != isolate->heap()->null_value(); | 6392 *p != isolate->heap()->null_value(); |
6406 p = Handle<Object>(p->GetPrototype(isolate), isolate)) { | 6393 p = Handle<Object>(p->GetPrototype(isolate), isolate)) { |
6407 if (p->IsJSProxy()) { | 6394 if (p->IsJSProxy()) { |
6408 Handle<JSProxy> proxy(JSProxy::cast(*p), isolate); | 6395 Handle<JSProxy> proxy(JSProxy::cast(*p), isolate); |
6409 Handle<Object> args[] = { proxy }; | 6396 Handle<Object> args[] = { proxy }; |
6410 Handle<Object> names; | 6397 Handle<Object> names; |
6411 ASSIGN_RETURN_ON_EXCEPTION( | 6398 ASSIGN_RETURN_ON_EXCEPTION( |
(...skipping 10606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17018 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17005 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17019 static const char* error_messages_[] = { | 17006 static const char* error_messages_[] = { |
17020 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17007 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17021 }; | 17008 }; |
17022 #undef ERROR_MESSAGES_TEXTS | 17009 #undef ERROR_MESSAGES_TEXTS |
17023 return error_messages_[reason]; | 17010 return error_messages_[reason]; |
17024 } | 17011 } |
17025 | 17012 |
17026 | 17013 |
17027 } } // namespace v8::internal | 17014 } } // namespace v8::internal |
OLD | NEW |