OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2594 return result->holder()->GetPropertyAttributeWithInterceptor( | 2594 return result->holder()->GetPropertyAttributeWithInterceptor( |
2595 JSObject::cast(receiver), name, continue_search); | 2595 JSObject::cast(receiver), name, continue_search); |
2596 default: | 2596 default: |
2597 UNREACHABLE(); | 2597 UNREACHABLE(); |
2598 } | 2598 } |
2599 } | 2599 } |
2600 return ABSENT; | 2600 return ABSENT; |
2601 } | 2601 } |
2602 | 2602 |
2603 | 2603 |
2604 PropertyAttributes JSReceiver::TryGetPropertyAttribute( | |
2605 Handle<Object> key, | |
2606 bool* has_pending_exception) { | |
2607 Isolate* isolate = GetHeap()->isolate(); | |
2608 HandleScope scope(isolate); | |
2609 | |
2610 Handle<String> name; | |
2611 if (key->IsString()) { | |
2612 name = Handle<String>::cast(key); | |
2613 } else { | |
2614 bool has_pending_exception = false; | |
2615 Handle<Object> converted = | |
2616 Execution::ToString(key, &has_pending_exception); | |
2617 if (has_pending_exception) return ABSENT; | |
2618 name = Handle<String>::cast(converted); | |
2619 } | |
2620 PropertyAttributes attr = GetPropertyAttributeWithReceiver(this, *name); | |
2621 | |
2622 // Throws an exception when the property doesn't exist. | |
Mads Ager (chromium)
2011/07/15 07:25:51
Let's just return NONE in that case and document t
| |
2623 if (attr == ABSENT) { | |
2624 i::Handle<i::Object> error_obj = isolate->factory()->NewReferenceError( | |
2625 "not_defined", i::HandleVector(&name, 1)); | |
2626 isolate->Throw(*error_obj); | |
2627 *has_pending_exception = true; | |
2628 } | |
2629 | |
2630 return attr; | |
2631 } | |
2632 | |
2633 | |
2604 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) { | 2634 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) { |
2605 // Check whether the name is an array index. | 2635 // Check whether the name is an array index. |
2606 uint32_t index = 0; | 2636 uint32_t index = 0; |
2607 if (IsJSObject() && name->AsArrayIndex(&index)) { | 2637 if (IsJSObject() && name->AsArrayIndex(&index)) { |
2608 if (JSObject::cast(this)->HasLocalElement(index)) return NONE; | 2638 if (JSObject::cast(this)->HasLocalElement(index)) return NONE; |
2609 return ABSENT; | 2639 return ABSENT; |
2610 } | 2640 } |
2611 // Named property. | 2641 // Named property. |
2612 LookupResult result; | 2642 LookupResult result; |
2613 LocalLookup(name, &result); | 2643 LocalLookup(name, &result); |
(...skipping 9091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11705 if (break_point_objects()->IsUndefined()) return 0; | 11735 if (break_point_objects()->IsUndefined()) return 0; |
11706 // Single beak point. | 11736 // Single beak point. |
11707 if (!break_point_objects()->IsFixedArray()) return 1; | 11737 if (!break_point_objects()->IsFixedArray()) return 1; |
11708 // Multiple break points. | 11738 // Multiple break points. |
11709 return FixedArray::cast(break_point_objects())->length(); | 11739 return FixedArray::cast(break_point_objects())->length(); |
11710 } | 11740 } |
11711 #endif | 11741 #endif |
11712 | 11742 |
11713 | 11743 |
11714 } } // namespace v8::internal | 11744 } } // namespace v8::internal |
OLD | NEW |