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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return false; | 54 return false; |
55 } | 55 } |
56 // TODO(jkummerow): support dictionary properties? | 56 // TODO(jkummerow): support dictionary properties? |
57 if (map->is_dictionary_map()) return false; | 57 if (map->is_dictionary_map()) return false; |
58 Handle<DescriptorArray> descs = | 58 Handle<DescriptorArray> descs = |
59 Handle<DescriptorArray>(map->instance_descriptors()); | 59 Handle<DescriptorArray>(map->instance_descriptors()); |
60 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 60 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
61 PropertyDetails details = descs->GetDetails(i); | 61 PropertyDetails details = descs->GetDetails(i); |
62 Name* key = descs->GetKey(i); | 62 Name* key = descs->GetKey(i); |
63 Handle<Object> value; | 63 Handle<Object> value; |
64 switch (details.type()) { | 64 if (details.location() == kField) { |
65 case DATA: | 65 if (details.kind() == kData) { |
66 value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj), | 66 value = JSObject::FastPropertyAt(Handle<JSObject>::cast(obj), |
67 details.representation(), | 67 details.representation(), |
68 FieldIndex::ForDescriptor(map, i)); | 68 FieldIndex::ForDescriptor(map, i)); |
69 break; | 69 } else { |
70 case DATA_CONSTANT: | 70 DCHECK_EQ(kAccessor, details.kind()); |
71 value = handle(descs->GetConstant(i), isolate); | |
72 break; | |
73 case ACCESSOR: | |
74 case ACCESSOR_CONSTANT: | |
75 // Bail out to slow path. | 71 // Bail out to slow path. |
76 return false; | 72 return false; |
| 73 } |
| 74 |
| 75 } else { |
| 76 DCHECK_EQ(kDescriptor, details.location()); |
| 77 if (details.kind() == kData) { |
| 78 value = handle(descs->GetConstant(i), isolate); |
| 79 } else { |
| 80 DCHECK_EQ(kAccessor, details.kind()); |
| 81 // Bail out to slow path. |
| 82 return false; |
| 83 } |
77 } | 84 } |
78 Heap* heap = isolate->heap(); | 85 Heap* heap = isolate->heap(); |
79 if (key == heap->enumerable_string()) { | 86 if (key == heap->enumerable_string()) { |
80 desc->set_enumerable(value->BooleanValue()); | 87 desc->set_enumerable(value->BooleanValue()); |
81 } else if (key == heap->configurable_string()) { | 88 } else if (key == heap->configurable_string()) { |
82 desc->set_configurable(value->BooleanValue()); | 89 desc->set_configurable(value->BooleanValue()); |
83 } else if (key == heap->value_string()) { | 90 } else if (key == heap->value_string()) { |
84 desc->set_value(value); | 91 desc->set_value(value); |
85 } else if (key == heap->writable_string()) { | 92 } else if (key == heap->writable_string()) { |
86 desc->set_writable(value->BooleanValue()); | 93 desc->set_writable(value->BooleanValue()); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Desc.[[Enumerable]] to like.[[Enumerable]]. | 336 // Desc.[[Enumerable]] to like.[[Enumerable]]. |
330 if (!desc->has_enumerable()) desc->set_enumerable(false); | 337 if (!desc->has_enumerable()) desc->set_enumerable(false); |
331 // 7. If Desc does not have a [[Configurable]] field, set | 338 // 7. If Desc does not have a [[Configurable]] field, set |
332 // Desc.[[Configurable]] to like.[[Configurable]]. | 339 // Desc.[[Configurable]] to like.[[Configurable]]. |
333 if (!desc->has_configurable()) desc->set_configurable(false); | 340 if (!desc->has_configurable()) desc->set_configurable(false); |
334 // 8. Return Desc. | 341 // 8. Return Desc. |
335 } | 342 } |
336 | 343 |
337 } // namespace internal | 344 } // namespace internal |
338 } // namespace v8 | 345 } // namespace v8 |
OLD | NEW |