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

Side by Side Diff: src/objects.cc

Issue 235083004: Introduce Object::DebugGetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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') | src/objects-inl.h » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 if (current.is_identical_to(last)) break; 828 if (current.is_identical_to(last)) break;
829 } 829 }
830 } 830 }
831 831
832 if (!result->IsProperty()) { 832 if (!result->IsProperty()) {
833 *attributes = ABSENT; 833 *attributes = ABSENT;
834 return factory->undefined_value(); 834 return factory->undefined_value();
835 } 835 }
836 *attributes = result->GetAttributes(); 836 *attributes = result->GetAttributes();
837 837
838 Handle<Object> value; 838 return JSObject::GetPropertyAfterAccessCheck(
839 switch (result->type()) { 839 isolate, receiver, name, result, attributes);
840 case NORMAL: {
841 DisallowHeapAllocation no_gc;
842 value = handle(result->holder()->GetNormalizedProperty(result), isolate);
843 break;
844 }
845 case FIELD:
846 value = JSObject::FastPropertyAt(handle(result->holder(), isolate),
847 result->representation(),
848 result->GetFieldIndex().field_index());
849 break;
850 case CONSTANT:
851 return handle(result->GetConstant(), isolate);
852 case CALLBACKS:
853 return JSObject::GetPropertyWithCallback(
854 handle(result->holder(), isolate),
855 receiver,
856 handle(result->GetCallbackObject(), isolate),
857 name);
858 case HANDLER:
859 return JSProxy::GetPropertyWithHandler(
860 handle(result->proxy(), isolate), receiver, name);
861 case INTERCEPTOR:
862 return JSObject::GetPropertyWithInterceptor(
863 handle(result->holder(), isolate), receiver, name, attributes);
864 case NONEXISTENT:
865 UNREACHABLE();
866 break;
867 }
868 ASSERT(!value->IsTheHole() || result->IsReadOnly());
869 return value->IsTheHole() ? Handle<Object>::cast(factory->undefined_value())
870 : value;
871 } 840 }
872 841
873 842
843 Handle<Object> Object::DebugGetProperty(Handle<Object> receiver,
844 Handle<Name> name,
845 LookupResult* result,
846 bool* has_caught) {
847 Isolate* isolate = result->isolate();
848 if (!result->IsFound()) return isolate->factory()->undefined_value();
849 PropertyAttributes attributes;
850 MaybeHandle<Object> maybe_value = JSObject::GetPropertyAfterAccessCheck(
851 isolate, receiver, name, result, &attributes);
852 Handle<Object> value;
853 if (maybe_value.ToHandle(&value)) return value;
854 Handle<Object> exception = handle(isolate->pending_exception(), isolate);
855 if (has_caught != NULL) *has_caught = true;
856 isolate->clear_pending_exception();
857 return exception;
858 }
859
860
874 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, 861 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate,
875 Handle<Object> object, 862 Handle<Object> object,
876 Handle<Object> receiver, 863 Handle<Object> receiver,
877 uint32_t index) { 864 uint32_t index) {
878 Handle<Object> holder; 865 Handle<Object> holder;
879 866
880 // Iterate up the prototype chain until an element is found or the null 867 // Iterate up the prototype chain until an element is found or the null
881 // prototype is encountered. 868 // prototype is encountered.
882 for (holder = object; 869 for (holder = object;
883 !holder->IsNull(); 870 !holder->IsNull();
(...skipping 15644 matching lines...) Expand 10 before | Expand all | Expand 10 after
16528 #define ERROR_MESSAGES_TEXTS(C, T) T, 16515 #define ERROR_MESSAGES_TEXTS(C, T) T,
16529 static const char* error_messages_[] = { 16516 static const char* error_messages_[] = {
16530 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16517 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16531 }; 16518 };
16532 #undef ERROR_MESSAGES_TEXTS 16519 #undef ERROR_MESSAGES_TEXTS
16533 return error_messages_[reason]; 16520 return error_messages_[reason];
16534 } 16521 }
16535 16522
16536 16523
16537 } } // namespace v8::internal 16524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698