Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: src/objects.cc

Issue 7321006: Add GetPropertyAttribute method for Object in the API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix the mentioned issues Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 return result->holder()->GetPropertyAttributeWithInterceptor( 2632 return result->holder()->GetPropertyAttributeWithInterceptor(
2633 JSObject::cast(receiver), name, continue_search); 2633 JSObject::cast(receiver), name, continue_search);
2634 default: 2634 default:
2635 UNREACHABLE(); 2635 UNREACHABLE();
2636 } 2636 }
2637 } 2637 }
2638 return ABSENT; 2638 return ABSENT;
2639 } 2639 }
2640 2640
2641 2641
2642 PropertyAttributes JSReceiver::TryGetPropertyAttribute(
2643 Handle<Object> key,
2644 bool* has_pending_exception) {
2645 Isolate* isolate = GetIsolate();
2646 HandleScope scope(isolate);
2647 Handle<String> name;
2648 if (key->IsString()) {
2649 name = Handle<String>::cast(key);
2650 } else {
2651 Handle<Object> converted =
2652 Execution::ToString(key, has_pending_exception);
2653 if (*has_pending_exception) return NONE;
2654 name = Handle<String>::cast(converted);
2655 }
2656 PropertyAttributes attr = GetPropertyAttributeWithReceiver(this, *name);
2657 // Returns NONE when the property doesn't exist.
2658 if (attr == ABSENT) return NONE;
2659 return attr;
2660 }
2661
2662
2642 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) { 2663 PropertyAttributes JSReceiver::GetLocalPropertyAttribute(String* name) {
2643 // Check whether the name is an array index. 2664 // Check whether the name is an array index.
2644 uint32_t index = 0; 2665 uint32_t index = 0;
2645 if (IsJSObject() && name->AsArrayIndex(&index)) { 2666 if (IsJSObject() && name->AsArrayIndex(&index)) {
2646 if (JSObject::cast(this)->HasLocalElement(index)) return NONE; 2667 if (JSObject::cast(this)->HasLocalElement(index)) return NONE;
2647 return ABSENT; 2668 return ABSENT;
2648 } 2669 }
2649 // Named property. 2670 // Named property.
2650 LookupResult result; 2671 LookupResult result;
2651 LocalLookup(name, &result); 2672 LocalLookup(name, &result);
(...skipping 9100 matching lines...) Expand 10 before | Expand all | Expand 10 after
11752 if (break_point_objects()->IsUndefined()) return 0; 11773 if (break_point_objects()->IsUndefined()) return 0;
11753 // Single beak point. 11774 // Single beak point.
11754 if (!break_point_objects()->IsFixedArray()) return 1; 11775 if (!break_point_objects()->IsFixedArray()) return 1;
11755 // Multiple break points. 11776 // Multiple break points.
11756 return FixedArray::cast(break_point_objects())->length(); 11777 return FixedArray::cast(break_point_objects())->length();
11757 } 11778 }
11758 #endif 11779 #endif
11759 11780
11760 11781
11761 } } // namespace v8::internal 11782 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698