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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 3296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3307 return WriteToReadOnlyProperty(isolate, receiver, | 3307 return WriteToReadOnlyProperty(isolate, receiver, |
3308 isolate->factory()->NewNumberFromUint(index), | 3308 isolate->factory()->NewNumberFromUint(index), |
3309 value, language_mode); | 3309 value, language_mode); |
3310 } | 3310 } |
3311 | 3311 |
3312 | 3312 |
3313 MaybeHandle<Object> Object::RedefineNonconfigurableProperty( | 3313 MaybeHandle<Object> Object::RedefineNonconfigurableProperty( |
3314 Isolate* isolate, Handle<Object> name, Handle<Object> value, | 3314 Isolate* isolate, Handle<Object> name, Handle<Object> value, |
3315 LanguageMode language_mode) { | 3315 LanguageMode language_mode) { |
3316 if (is_sloppy(language_mode)) return value; | 3316 if (is_sloppy(language_mode)) return value; |
3317 Handle<Object> args[] = {name}; | 3317 THROW_NEW_ERROR(isolate, |
3318 THROW_NEW_ERROR(isolate, NewTypeError("redefine_disallowed", | 3318 NewTypeError(MessageTemplate::kRedefineDisallowed, name), |
3319 HandleVector(args, arraysize(args))), | |
3320 Object); | 3319 Object); |
3321 } | 3320 } |
3322 | 3321 |
3323 | 3322 |
3324 MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it, | 3323 MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it, |
3325 Handle<Object> value) { | 3324 Handle<Object> value) { |
3326 // Proxies are handled on the WithHandler path. Other non-JSObjects cannot | 3325 // Proxies are handled on the WithHandler path. Other non-JSObjects cannot |
3327 // have own properties. | 3326 // have own properties. |
3328 Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver()); | 3327 Handle<JSObject> receiver = Handle<JSObject>::cast(it->GetReceiver()); |
3329 | 3328 |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 // [[GetProperty]] requires to check that all properties are configurable. | 3895 // [[GetProperty]] requires to check that all properties are configurable. |
3897 Handle<String> configurable_name = | 3896 Handle<String> configurable_name = |
3898 isolate->factory()->InternalizeOneByteString( | 3897 isolate->factory()->InternalizeOneByteString( |
3899 STATIC_CHAR_VECTOR("configurable_")); | 3898 STATIC_CHAR_VECTOR("configurable_")); |
3900 Handle<Object> configurable = | 3899 Handle<Object> configurable = |
3901 Object::GetProperty(desc, configurable_name).ToHandleChecked(); | 3900 Object::GetProperty(desc, configurable_name).ToHandleChecked(); |
3902 DCHECK(configurable->IsBoolean()); | 3901 DCHECK(configurable->IsBoolean()); |
3903 if (configurable->IsFalse()) { | 3902 if (configurable->IsFalse()) { |
3904 Handle<String> trap = isolate->factory()->InternalizeOneByteString( | 3903 Handle<String> trap = isolate->factory()->InternalizeOneByteString( |
3905 STATIC_CHAR_VECTOR("getPropertyDescriptor")); | 3904 STATIC_CHAR_VECTOR("getPropertyDescriptor")); |
3906 Handle<Object> args[] = { handler, trap, name }; | 3905 THROW_NEW_ERROR(isolate, |
3907 THROW_NEW_ERROR(isolate, NewTypeError("proxy_prop_not_configurable", | 3906 NewTypeError(MessageTemplate::kProxyPropNotConfigurable, |
3908 HandleVector(args, arraysize(args))), | 3907 handler, name, trap), |
3909 Object); | 3908 Object); |
3910 } | 3909 } |
3911 DCHECK(configurable->IsTrue()); | 3910 DCHECK(configurable->IsTrue()); |
3912 | 3911 |
3913 // Check for DataDescriptor. | 3912 // Check for DataDescriptor. |
3914 Handle<String> hasWritable_name = | 3913 Handle<String> hasWritable_name = |
3915 isolate->factory()->InternalizeOneByteString( | 3914 isolate->factory()->InternalizeOneByteString( |
3916 STATIC_CHAR_VECTOR("hasWritable_")); | 3915 STATIC_CHAR_VECTOR("hasWritable_")); |
3917 Handle<Object> hasWritable = | 3916 Handle<Object> hasWritable = |
3918 Object::GetProperty(desc, hasWritable_name).ToHandleChecked(); | 3917 Object::GetProperty(desc, hasWritable_name).ToHandleChecked(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4038 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, setter, | 4037 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, setter, |
4039 Object::GetProperty(desc, set_n), | 4038 Object::GetProperty(desc, set_n), |
4040 Nothing<PropertyAttributes>()); | 4039 Nothing<PropertyAttributes>()); |
4041 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); | 4040 writable = isolate->factory()->ToBoolean(!setter->IsUndefined()); |
4042 } | 4041 } |
4043 | 4042 |
4044 if (configurable->IsFalse()) { | 4043 if (configurable->IsFalse()) { |
4045 Handle<Object> handler(proxy->handler(), isolate); | 4044 Handle<Object> handler(proxy->handler(), isolate); |
4046 Handle<String> trap = isolate->factory()->InternalizeOneByteString( | 4045 Handle<String> trap = isolate->factory()->InternalizeOneByteString( |
4047 STATIC_CHAR_VECTOR("getPropertyDescriptor")); | 4046 STATIC_CHAR_VECTOR("getPropertyDescriptor")); |
4048 Handle<Object> args[] = { handler, trap, name }; | |
4049 Handle<Object> error = isolate->factory()->NewTypeError( | 4047 Handle<Object> error = isolate->factory()->NewTypeError( |
4050 "proxy_prop_not_configurable", HandleVector(args, arraysize(args))); | 4048 MessageTemplate::kProxyPropNotConfigurable, handler, name, trap); |
4051 isolate->Throw(*error); | 4049 isolate->Throw(*error); |
4052 return Just(NONE); | 4050 return Just(NONE); |
4053 } | 4051 } |
4054 | 4052 |
4055 int attributes = NONE; | 4053 int attributes = NONE; |
4056 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM; | 4054 if (!enumerable->BooleanValue()) attributes |= DONT_ENUM; |
4057 if (!configurable->BooleanValue()) attributes |= DONT_DELETE; | 4055 if (!configurable->BooleanValue()) attributes |= DONT_DELETE; |
4058 if (!writable->BooleanValue()) attributes |= READ_ONLY; | 4056 if (!writable->BooleanValue()) attributes |= READ_ONLY; |
4059 return Just(static_cast<PropertyAttributes>(attributes)); | 4057 return Just(static_cast<PropertyAttributes>(attributes)); |
4060 } | 4058 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 | 4098 |
4101 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); | 4099 Handle<String> trap_name = isolate->factory()->InternalizeUtf8String(name); |
4102 Handle<Object> trap; | 4100 Handle<Object> trap; |
4103 ASSIGN_RETURN_ON_EXCEPTION( | 4101 ASSIGN_RETURN_ON_EXCEPTION( |
4104 isolate, trap, | 4102 isolate, trap, |
4105 Object::GetPropertyOrElement(handler, trap_name), | 4103 Object::GetPropertyOrElement(handler, trap_name), |
4106 Object); | 4104 Object); |
4107 | 4105 |
4108 if (trap->IsUndefined()) { | 4106 if (trap->IsUndefined()) { |
4109 if (derived.is_null()) { | 4107 if (derived.is_null()) { |
4110 Handle<Object> args[] = { handler, trap_name }; | |
4111 THROW_NEW_ERROR(isolate, | 4108 THROW_NEW_ERROR(isolate, |
4112 NewTypeError("handler_trap_missing", | 4109 NewTypeError(MessageTemplate::kProxyHandlerTrapMissing, |
4113 HandleVector(args, arraysize(args))), | 4110 handler, trap_name), |
4114 Object); | 4111 Object); |
4115 } | 4112 } |
4116 trap = Handle<Object>(derived); | 4113 trap = Handle<Object>(derived); |
4117 } | 4114 } |
4118 | 4115 |
4119 return Execution::Call(isolate, trap, handler, argc, argv); | 4116 return Execution::Call(isolate, trap, handler, argc, argv); |
4120 } | 4117 } |
4121 | 4118 |
4122 | 4119 |
4123 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { | 4120 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { |
(...skipping 13039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17163 CompilationInfo* info) { | 17160 CompilationInfo* info) { |
17164 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17161 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17165 handle(cell->dependent_code(), info->isolate()), | 17162 handle(cell->dependent_code(), info->isolate()), |
17166 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17163 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17167 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17164 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17168 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17165 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17169 cell, info->zone()); | 17166 cell, info->zone()); |
17170 } | 17167 } |
17171 | 17168 |
17172 } } // namespace v8::internal | 17169 } } // namespace v8::internal |
OLD | NEW |