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 5977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5988 // 8d. ReturnIfAbrupt(status). | 5988 // 8d. ReturnIfAbrupt(status). |
5989 if (isolate->has_pending_exception()) return isolate->heap()->exception(); | 5989 if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
5990 CHECK(status == true); | 5990 CHECK(status == true); |
5991 } | 5991 } |
5992 // 9. Return o. | 5992 // 9. Return o. |
5993 return *object; | 5993 return *object; |
5994 } | 5994 } |
5995 | 5995 |
5996 | 5996 |
5997 // static | 5997 // static |
5998 bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object, | 5998 bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSReceiver> object, |
5999 Handle<Object> key, PropertyDescriptor* desc, | 5999 Handle<Object> key, PropertyDescriptor* desc, |
6000 ShouldThrow should_throw) { | 6000 ShouldThrow should_throw) { |
6001 if (object->IsJSArray()) { | 6001 if (object->IsJSArray()) { |
6002 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object), | 6002 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object), |
6003 key, desc, should_throw); | 6003 key, desc, should_throw); |
6004 } | 6004 } |
6005 // TODO(jkummerow): Support Modules (ES6 9.4.6.6) | 6005 // TODO(jkummerow): Support Modules (ES6 9.4.6.6) |
6006 // TODO(jkummerow): Support Proxies (ES6 9.5.6) | 6006 // TODO(jkummerow): Support Proxies (ES6 9.5.6) |
6007 if (!object->IsJSObject()) return true; | |
Jakob Kummerow
2015/10/23 12:03:42
nit: wouldn't "return false" be more appropriate?
neis
2015/10/29 15:17:25
I don't want to return false without also checking
| |
6007 | 6008 |
6008 // OrdinaryDefineOwnProperty, by virtue of calling | 6009 // OrdinaryDefineOwnProperty, by virtue of calling |
6009 // DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2) | 6010 // DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2) |
6010 // and IntegerIndexedExotics (ES6 9.4.5.3), with one exception: | 6011 // and IntegerIndexedExotics (ES6 9.4.5.3), with one exception: |
6011 // TODO(jkummerow): Setting an indexed accessor on a typed array should throw. | 6012 // TODO(jkummerow): Setting an indexed accessor on a typed array should throw. |
6012 return OrdinaryDefineOwnProperty(isolate, object, key, desc, should_throw); | 6013 return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key, |
6014 desc, should_throw); | |
6013 } | 6015 } |
6014 | 6016 |
6015 | 6017 |
6016 // static | 6018 // static |
6017 bool JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate, | 6019 bool JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate, |
6018 Handle<JSObject> object, | 6020 Handle<JSObject> object, |
6019 Handle<Object> key, | 6021 Handle<Object> key, |
6020 PropertyDescriptor* desc, | 6022 PropertyDescriptor* desc, |
6021 ShouldThrow should_throw) { | 6023 ShouldThrow should_throw) { |
6022 bool success = false; | 6024 bool success = false; |
(...skipping 11809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
17832 if (cell->value() != *new_value) { | 17834 if (cell->value() != *new_value) { |
17833 cell->set_value(*new_value); | 17835 cell->set_value(*new_value); |
17834 Isolate* isolate = cell->GetIsolate(); | 17836 Isolate* isolate = cell->GetIsolate(); |
17835 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17837 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17836 isolate, DependentCode::kPropertyCellChangedGroup); | 17838 isolate, DependentCode::kPropertyCellChangedGroup); |
17837 } | 17839 } |
17838 } | 17840 } |
17839 | 17841 |
17840 } // namespace internal | 17842 } // namespace internal |
17841 } // namespace v8 | 17843 } // namespace v8 |
OLD | NEW |