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 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3136 // If the receiver is the JSGlobalObject, the store was contextual. In case | 3136 // If the receiver is the JSGlobalObject, the store was contextual. In case |
3137 // the property did not exist yet on the global object itself, we have to | 3137 // the property did not exist yet on the global object itself, we have to |
3138 // throw a reference error in strict mode. | 3138 // throw a reference error in strict mode. |
3139 if (it->GetReceiver()->IsJSGlobalObject() && is_strict(language_mode)) { | 3139 if (it->GetReceiver()->IsJSGlobalObject() && is_strict(language_mode)) { |
3140 Handle<Object> args[1] = {it->name()}; | 3140 Handle<Object> args[1] = {it->name()}; |
3141 THROW_NEW_ERROR(it->isolate(), | 3141 THROW_NEW_ERROR(it->isolate(), |
3142 NewReferenceError("not_defined", HandleVector(args, 1)), | 3142 NewReferenceError("not_defined", HandleVector(args, 1)), |
3143 Object); | 3143 Object); |
3144 } | 3144 } |
3145 | 3145 |
3146 // super.property = value | |
3147 // No property was found starting from the prototype of [[HomeObject]]. | |
3146 if (data_store_mode == SUPER_PROPERTY) { | 3148 if (data_store_mode == SUPER_PROPERTY) { |
arv (Not doing code reviews)
2015/02/17 20:41:22
To me it looks like this if can be skipped since t
| |
3147 LookupIterator own_lookup(it->GetReceiver(), it->name(), | 3149 LookupIterator own_lookup(it->GetReceiver(), it->name(), |
3148 LookupIterator::OWN); | 3150 LookupIterator::OWN); |
3151 if (!own_lookup.IsFound()) { | |
arv (Not doing code reviews)
2015/02/17 20:41:22
Is there an existing function that can be used her
| |
3152 return AddDataProperty(&own_lookup, value, NONE, language_mode, | |
3153 store_mode); | |
3154 } | |
3149 | 3155 |
3150 return JSObject::SetProperty(&own_lookup, value, language_mode, store_mode, | 3156 PropertyDetails details = own_lookup.property_details(); |
3151 NORMAL_PROPERTY); | 3157 |
3158 // Otherwise reconfigure property with descriptor {value: value}. | |
3159 if (details.IsConfigurable()) { | |
3160 return JSObject::SetOwnPropertyIgnoreAttributes( | |
3161 Handle<JSObject>::cast(it->GetReceiver()), it->name(), value, | |
3162 details.attributes()); | |
3163 } | |
3164 | |
3165 if (details.IsReadOnly()) { | |
3166 return WriteToReadOnlyProperty(&own_lookup, value, language_mode); | |
3167 } | |
3168 | |
3169 // Not configurable but writable. | |
3170 if (details.kind() == kData) { | |
3171 return SetDataProperty(&own_lookup, value); | |
3172 } | |
3173 | |
3174 Handle<Object> args[] = {it->name()}; | |
3175 THROW_NEW_ERROR(it->isolate(), | |
3176 NewTypeError("redefine_disallowed", | |
3177 HandleVector(args, arraysize(args))), | |
3178 Object); | |
3152 } | 3179 } |
3153 | 3180 |
3154 return AddDataProperty(it, value, NONE, language_mode, store_mode); | 3181 return AddDataProperty(it, value, NONE, language_mode, store_mode); |
3155 } | 3182 } |
3156 | 3183 |
3157 | 3184 |
3158 MaybeHandle<Object> Object::WriteToReadOnlyProperty( | 3185 MaybeHandle<Object> Object::WriteToReadOnlyProperty( |
3159 LookupIterator* it, Handle<Object> value, LanguageMode language_mode) { | 3186 LookupIterator* it, Handle<Object> value, LanguageMode language_mode) { |
3160 if (is_sloppy(language_mode)) return value; | 3187 if (is_sloppy(language_mode)) return value; |
3161 | 3188 |
(...skipping 14050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17212 CompilationInfo* info) { | 17239 CompilationInfo* info) { |
17213 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( | 17240 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( |
17214 handle(cell->dependent_code(), info->isolate()), | 17241 handle(cell->dependent_code(), info->isolate()), |
17215 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); | 17242 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); |
17216 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 17243 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
17217 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 17244 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
17218 cell, info->zone()); | 17245 cell, info->zone()); |
17219 } | 17246 } |
17220 | 17247 |
17221 } } // namespace v8::internal | 17248 } } // namespace v8::internal |
OLD | NEW |