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 6043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6054 // 8d. ReturnIfAbrupt(status). | 6054 // 8d. ReturnIfAbrupt(status). |
6055 if (isolate->has_pending_exception()) return isolate->heap()->exception(); | 6055 if (isolate->has_pending_exception()) return isolate->heap()->exception(); |
6056 CHECK(status == true); | 6056 CHECK(status == true); |
6057 } | 6057 } |
6058 // 9. Return o. | 6058 // 9. Return o. |
6059 return *object; | 6059 return *object; |
6060 } | 6060 } |
6061 | 6061 |
6062 | 6062 |
6063 // static | 6063 // static |
6064 bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSObject> object, | 6064 bool JSReceiver::DefineOwnProperty(Isolate* isolate, Handle<JSReceiver> object, |
6065 Handle<Object> key, PropertyDescriptor* desc, | 6065 Handle<Object> key, PropertyDescriptor* desc, |
6066 ShouldThrow should_throw) { | 6066 ShouldThrow should_throw) { |
6067 if (object->IsJSArray()) { | 6067 if (object->IsJSArray()) { |
6068 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object), | 6068 return JSArray::DefineOwnProperty(isolate, Handle<JSArray>::cast(object), |
6069 key, desc, should_throw); | 6069 key, desc, should_throw); |
6070 } | 6070 } |
6071 // TODO(jkummerow): Support Modules (ES6 9.4.6.6) | 6071 // TODO(jkummerow): Support Modules (ES6 9.4.6.6) |
6072 // TODO(jkummerow): Support Proxies (ES6 9.5.6) | 6072 // TODO(jkummerow): Support Proxies (ES6 9.5.6) |
| 6073 if (!object->IsJSObject()) return true; |
6073 | 6074 |
6074 // OrdinaryDefineOwnProperty, by virtue of calling | 6075 // OrdinaryDefineOwnProperty, by virtue of calling |
6075 // DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2) | 6076 // DefineOwnPropertyIgnoreAttributes, can handle arguments (ES6 9.4.4.2) |
6076 // and IntegerIndexedExotics (ES6 9.4.5.3), with one exception: | 6077 // and IntegerIndexedExotics (ES6 9.4.5.3), with one exception: |
6077 // TODO(jkummerow): Setting an indexed accessor on a typed array should throw. | 6078 // TODO(jkummerow): Setting an indexed accessor on a typed array should throw. |
6078 return OrdinaryDefineOwnProperty(isolate, object, key, desc, should_throw); | 6079 return OrdinaryDefineOwnProperty(isolate, Handle<JSObject>::cast(object), key, |
| 6080 desc, should_throw); |
6079 } | 6081 } |
6080 | 6082 |
6081 | 6083 |
6082 // static | 6084 // static |
6083 bool JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate, | 6085 bool JSReceiver::OrdinaryDefineOwnProperty(Isolate* isolate, |
6084 Handle<JSObject> object, | 6086 Handle<JSObject> object, |
6085 Handle<Object> key, | 6087 Handle<Object> key, |
6086 PropertyDescriptor* desc, | 6088 PropertyDescriptor* desc, |
6087 ShouldThrow should_throw) { | 6089 ShouldThrow should_throw) { |
6088 bool success = false; | 6090 bool success = false; |
(...skipping 11842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17931 if (cell->value() != *new_value) { | 17933 if (cell->value() != *new_value) { |
17932 cell->set_value(*new_value); | 17934 cell->set_value(*new_value); |
17933 Isolate* isolate = cell->GetIsolate(); | 17935 Isolate* isolate = cell->GetIsolate(); |
17934 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17936 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17935 isolate, DependentCode::kPropertyCellChangedGroup); | 17937 isolate, DependentCode::kPropertyCellChangedGroup); |
17936 } | 17938 } |
17937 } | 17939 } |
17938 | 17940 |
17939 } // namespace internal | 17941 } // namespace internal |
17940 } // namespace v8 | 17942 } // namespace v8 |
OLD | NEW |