OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/property-descriptor.h" | 5 #include "src/property-descriptor.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/lookup.h" | 10 #include "src/lookup.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 | 142 |
143 // ES6 6.2.4.5 | 143 // ES6 6.2.4.5 |
144 // Returns false in case of exception. | 144 // Returns false in case of exception. |
145 // static | 145 // static |
146 bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate, | 146 bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate, |
147 Handle<Object> obj, | 147 Handle<Object> obj, |
148 PropertyDescriptor* desc) { | 148 PropertyDescriptor* desc) { |
149 // 1. ReturnIfAbrupt(Obj). | 149 // 1. ReturnIfAbrupt(Obj). |
150 // 2. If Type(Obj) is not Object, throw a TypeError exception. | 150 // 2. If Type(Obj) is not Object, throw a TypeError exception. |
151 if (!obj->IsSpecObject()) { | 151 if (!obj->IsJSReceiver()) { |
152 isolate->Throw(*isolate->factory()->NewTypeError( | 152 isolate->Throw(*isolate->factory()->NewTypeError( |
153 MessageTemplate::kPropertyDescObject, obj)); | 153 MessageTemplate::kPropertyDescObject, obj)); |
154 return false; | 154 return false; |
155 } | 155 } |
156 // 3. Let desc be a new Property Descriptor that initially has no fields. | 156 // 3. Let desc be a new Property Descriptor that initially has no fields. |
157 DCHECK(desc->is_empty()); | 157 DCHECK(desc->is_empty()); |
158 | 158 |
159 if (ToPropertyDescriptorFastPath(isolate, obj, desc)) { | 159 if (ToPropertyDescriptorFastPath(isolate, obj, desc)) { |
160 return true; | 160 return true; |
161 } | 161 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Desc.[[Enumerable]] to like.[[Enumerable]]. | 291 // Desc.[[Enumerable]] to like.[[Enumerable]]. |
292 if (!desc->has_enumerable()) desc->set_enumerable(false); | 292 if (!desc->has_enumerable()) desc->set_enumerable(false); |
293 // 7. If Desc does not have a [[Configurable]] field, set | 293 // 7. If Desc does not have a [[Configurable]] field, set |
294 // Desc.[[Configurable]] to like.[[Configurable]]. | 294 // Desc.[[Configurable]] to like.[[Configurable]]. |
295 if (!desc->has_configurable()) desc->set_configurable(false); | 295 if (!desc->has_configurable()) desc->set_configurable(false); |
296 // 8. Return Desc. | 296 // 8. Return Desc. |
297 } | 297 } |
298 | 298 |
299 } // namespace internal | 299 } // namespace internal |
300 } // namespace v8 | 300 } // namespace v8 |
OLD | NEW |