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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2975 // TODO(verwaest): Throw a TypeError with a more specific message. | 2975 // TODO(verwaest): Throw a TypeError with a more specific message. |
2976 return WriteToReadOnlyProperty(it, value, strict_mode); | 2976 return WriteToReadOnlyProperty(it, value, strict_mode); |
2977 } | 2977 } |
2978 | 2978 |
2979 Handle<JSObject> receiver = it->GetStoreTarget(); | 2979 Handle<JSObject> receiver = it->GetStoreTarget(); |
2980 | 2980 |
2981 // If the receiver is a JSGlobalProxy, store on the prototype (JSGlobalObject) | 2981 // If the receiver is a JSGlobalProxy, store on the prototype (JSGlobalObject) |
2982 // instead. If the prototype is Null, the proxy is detached. | 2982 // instead. If the prototype is Null, the proxy is detached. |
2983 if (receiver->IsJSGlobalProxy()) return value; | 2983 if (receiver->IsJSGlobalProxy()) return value; |
2984 | 2984 |
2985 // If the receiver is Indexed Exotic object (currently only typed arrays), | |
2986 // disallow adding properties with numeric names. | |
Toon Verwaest
2014/10/17 09:26:44
Please put this in a descriptive method or functio
Dmitry Lomov (no reviews)
2014/10/17 09:50:33
Done.
| |
2987 if (receiver->IsJSTypedArray() && it->name()->IsString()) { | |
2988 Handle<String> name_string = Handle<String>::cast(it->name()); | |
2989 if (name_string->length() > 0) { | |
2990 double d = StringToDouble(it->isolate()->unicode_cache(), *name_string, | |
2991 NO_FLAGS); | |
2992 if (!std::isnan(d)) { | |
2993 Factory* factory = it->isolate()->factory(); | |
2994 Handle<Object> num = factory->NewNumber(d); | |
2995 Handle<String> roundtrip_string = factory->NumberToString(num); | |
2996 if (String::Equals(name_string, roundtrip_string)) return value; | |
2997 } | |
2998 } | |
2999 } | |
3000 | |
2985 // Possibly migrate to the most up-to-date map that will be able to store | 3001 // Possibly migrate to the most up-to-date map that will be able to store |
2986 // |value| under it->name() with |attributes|. | 3002 // |value| under it->name() with |attributes|. |
2987 it->PrepareTransitionToDataProperty(value, attributes, store_mode); | 3003 it->PrepareTransitionToDataProperty(value, attributes, store_mode); |
2988 if (it->state() != LookupIterator::TRANSITION) { | 3004 if (it->state() != LookupIterator::TRANSITION) { |
2989 if (strict_mode == SLOPPY) return value; | 3005 if (strict_mode == SLOPPY) return value; |
2990 | 3006 |
2991 Handle<Object> args[1] = {it->name()}; | 3007 Handle<Object> args[1] = {it->name()}; |
2992 THROW_NEW_ERROR(it->isolate(), | 3008 THROW_NEW_ERROR(it->isolate(), |
2993 NewTypeError("object_not_extensible", | 3009 NewTypeError("object_not_extensible", |
2994 HandleVector(args, arraysize(args))), | 3010 HandleVector(args, arraysize(args))), |
(...skipping 13393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16388 Handle<DependentCode> codes = | 16404 Handle<DependentCode> codes = |
16389 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16405 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16390 DependentCode::kPropertyCellChangedGroup, | 16406 DependentCode::kPropertyCellChangedGroup, |
16391 info->object_wrapper()); | 16407 info->object_wrapper()); |
16392 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16408 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16393 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16409 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16394 cell, info->zone()); | 16410 cell, info->zone()); |
16395 } | 16411 } |
16396 | 16412 |
16397 } } // namespace v8::internal | 16413 } } // namespace v8::internal |
OLD | NEW |