| 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 7279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7290 ? no_conf | 7290 ? no_conf |
| 7291 : no_conf_no_write; | 7291 : no_conf_no_write; |
| 7292 DefineOwnProperty(isolate, receiver, key, &desc, THROW_ON_ERROR); | 7292 DefineOwnProperty(isolate, receiver, key, &desc, THROW_ON_ERROR); |
| 7293 if (isolate->has_pending_exception()) return Nothing<bool>(); | 7293 if (isolate->has_pending_exception()) return Nothing<bool>(); |
| 7294 } | 7294 } |
| 7295 } | 7295 } |
| 7296 return Just(true); | 7296 return Just(true); |
| 7297 } | 7297 } |
| 7298 | 7298 |
| 7299 | 7299 |
| 7300 Maybe<bool> JSReceiver::TestIntegrityLevel(Handle<JSReceiver> object, |
| 7301 IntegrityLevel level) { |
| 7302 DCHECK(level == SEALED || level == FROZEN); |
| 7303 Isolate* isolate = object->GetIsolate(); |
| 7304 |
| 7305 Maybe<bool> extensible = JSReceiver::IsExtensible(object); |
| 7306 MAYBE_RETURN(extensible, Nothing<bool>()); |
| 7307 if (extensible.FromJust()) return Just(false); |
| 7308 |
| 7309 Handle<FixedArray> keys; |
| 7310 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 7311 isolate, keys, JSReceiver::OwnPropertyKeys(object), Nothing<bool>()); |
| 7312 |
| 7313 for (int i = 0; i < keys->length(); ++i) { |
| 7314 Handle<Object> key(keys->get(i), isolate); |
| 7315 PropertyDescriptor current_desc; |
| 7316 bool owned = JSReceiver::GetOwnPropertyDescriptor(isolate, object, key, |
| 7317 ¤t_desc); |
| 7318 if (isolate->has_pending_exception()) return Nothing<bool>(); |
| 7319 if (owned) { |
| 7320 if (current_desc.configurable()) return Just(false); |
| 7321 if (level == FROZEN && |
| 7322 PropertyDescriptor::IsDataDescriptor(¤t_desc) && |
| 7323 current_desc.writable()) { |
| 7324 return Just(false); |
| 7325 } |
| 7326 } |
| 7327 } |
| 7328 return Just(true); |
| 7329 } |
| 7330 |
| 7331 |
| 7300 Maybe<bool> JSReceiver::PreventExtensions(Handle<JSReceiver> object, | 7332 Maybe<bool> JSReceiver::PreventExtensions(Handle<JSReceiver> object, |
| 7301 ShouldThrow should_throw) { | 7333 ShouldThrow should_throw) { |
| 7302 if (object->IsJSProxy()) { | 7334 if (object->IsJSProxy()) { |
| 7303 return JSProxy::PreventExtensions(Handle<JSProxy>::cast(object), | 7335 return JSProxy::PreventExtensions(Handle<JSProxy>::cast(object), |
| 7304 should_throw); | 7336 should_throw); |
| 7305 } | 7337 } |
| 7306 DCHECK(object->IsJSObject()); | 7338 DCHECK(object->IsJSObject()); |
| 7307 return JSObject::PreventExtensions(Handle<JSObject>::cast(object), | 7339 return JSObject::PreventExtensions(Handle<JSObject>::cast(object), |
| 7308 should_throw); | 7340 should_throw); |
| 7309 } | 7341 } |
| (...skipping 11784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19094 if (cell->value() != *new_value) { | 19126 if (cell->value() != *new_value) { |
| 19095 cell->set_value(*new_value); | 19127 cell->set_value(*new_value); |
| 19096 Isolate* isolate = cell->GetIsolate(); | 19128 Isolate* isolate = cell->GetIsolate(); |
| 19097 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19129 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19098 isolate, DependentCode::kPropertyCellChangedGroup); | 19130 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19099 } | 19131 } |
| 19100 } | 19132 } |
| 19101 | 19133 |
| 19102 } // namespace internal | 19134 } // namespace internal |
| 19103 } // namespace v8 | 19135 } // namespace v8 |
| OLD | NEW |