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