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

Side by Side Diff: src/objects.cc

Issue 27000006: Handlify GetNormalizedProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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/property.h » ('j') | src/property.h » ('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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 case NONEXISTENT: 642 case NONEXISTENT:
643 UNREACHABLE(); 643 UNREACHABLE();
644 } 644 }
645 } 645 }
646 646
647 GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS); 647 GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS);
648 return ABSENT; 648 return ABSENT;
649 } 649 }
650 650
651 651
652 Object* JSObject::GetNormalizedProperty(LookupResult* result) { 652 Handle<Object> JSObject::GetNormalizedProperty(Handle<JSObject> object,
653 ASSERT(!HasFastProperties()); 653 LookupResult* result) {
654 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); 654 ASSERT(!object->HasFastProperties());
655 if (IsGlobalObject()) { 655 Isolate* isolate = object->GetIsolate();
656 value = PropertyCell::cast(value)->value(); 656 Handle<Object> value(
657 object->property_dictionary()->ValueAt(result->GetDictionaryEntry()),
658 isolate);
659 if (object->IsGlobalObject()) {
660 value = Handle<Object>(Handle<PropertyCell>::cast(value)->value(), isolate);
657 } 661 }
658 ASSERT(!value->IsPropertyCell() && !value->IsCell()); 662 ASSERT(!value->IsPropertyCell() && !value->IsCell());
659 return value; 663 return value;
660 } 664 }
661 665
662 666
663 void JSObject::SetNormalizedProperty(Handle<JSObject> object, 667 void JSObject::SetNormalizedProperty(Handle<JSObject> object,
664 LookupResult* result, 668 LookupResult* result,
665 Handle<Object> value) { 669 Handle<Object> value) {
666 ASSERT(!object->HasFastProperties()); 670 ASSERT(!object->HasFastProperties());
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 } 885 }
882 } 886 }
883 887
884 if (!result->IsProperty()) { 888 if (!result->IsProperty()) {
885 *attributes = ABSENT; 889 *attributes = ABSENT;
886 return heap->undefined_value(); 890 return heap->undefined_value();
887 } 891 }
888 *attributes = result->GetAttributes(); 892 *attributes = result->GetAttributes();
889 Object* value; 893 Object* value;
890 switch (result->type()) { 894 switch (result->type()) {
891 case NORMAL: 895 case NORMAL: {
892 value = result->holder()->GetNormalizedProperty(result); 896 HandleScope scope(isolate);
897 Handle<Object> value =
898 JSObject::GetNormalizedProperty(handle(result->holder()), result);
893 ASSERT(!value->IsTheHole() || result->IsReadOnly()); 899 ASSERT(!value->IsTheHole() || result->IsReadOnly());
894 return value->IsTheHole() ? heap->undefined_value() : value; 900 return value->IsTheHole() ? heap->undefined_value() : *value;
901 }
895 case FIELD: { 902 case FIELD: {
896 MaybeObject* maybe_result = result->holder()->FastPropertyAt( 903 MaybeObject* maybe_result = result->holder()->FastPropertyAt(
897 result->representation(), 904 result->representation(),
898 result->GetFieldIndex().field_index()); 905 result->GetFieldIndex().field_index());
899 if (!maybe_result->To(&value)) return maybe_result; 906 if (!maybe_result->To(&value)) return maybe_result;
900 ASSERT(!value->IsTheHole() || result->IsReadOnly()); 907 ASSERT(!value->IsTheHole() || result->IsReadOnly());
901 return value->IsTheHole() ? heap->undefined_value() : value; 908 return value->IsTheHole() ? heap->undefined_value() : value;
902 } 909 }
903 case CONSTANT: 910 case CONSTANT:
904 return result->GetConstant(); 911 return result->GetConstant();
(...skipping 15349 matching lines...) Expand 10 before | Expand all | Expand 10 after
16254 #define ERROR_MESSAGES_TEXTS(C, T) T, 16261 #define ERROR_MESSAGES_TEXTS(C, T) T,
16255 static const char* error_messages_[] = { 16262 static const char* error_messages_[] = {
16256 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16263 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16257 }; 16264 };
16258 #undef ERROR_MESSAGES_TEXTS 16265 #undef ERROR_MESSAGES_TEXTS
16259 return error_messages_[reason]; 16266 return error_messages_[reason];
16260 } 16267 }
16261 16268
16262 16269
16263 } } // namespace v8::internal 16270 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/property.h » ('j') | src/property.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698