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

Side by Side Diff: src/accessors.cc

Issue 15793007: Cutover v8 to use new style callbacks internally (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « samples/shell.cc ('k') | src/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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 FunctionGetCaller, 786 FunctionGetCaller,
787 ReadOnlySetAccessor, 787 ReadOnlySetAccessor,
788 0 788 0
789 }; 789 };
790 790
791 791
792 // 792 //
793 // Accessors::MakeModuleExport 793 // Accessors::MakeModuleExport
794 // 794 //
795 795
796 static v8::Handle<v8::Value> ModuleGetExport( 796 static void ModuleGetExport(
797 v8::Local<v8::String> property, 797 v8::Local<v8::String> property,
798 const v8::AccessorInfo& info) { 798 const v8::PropertyCallbackInfo<v8::Value>& info) {
799 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 799 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
800 Context* context = Context::cast(instance->context()); 800 Context* context = Context::cast(instance->context());
801 ASSERT(context->IsModuleContext()); 801 ASSERT(context->IsModuleContext());
802 int slot = info.Data()->Int32Value(); 802 int slot = info.Data()->Int32Value();
803 Object* value = context->get(slot); 803 Object* value = context->get(slot);
804 Isolate* isolate = instance->GetIsolate(); 804 Isolate* isolate = instance->GetIsolate();
805 if (value->IsTheHole()) { 805 if (value->IsTheHole()) {
806 Handle<String> name = v8::Utils::OpenHandle(*property); 806 Handle<String> name = v8::Utils::OpenHandle(*property);
807 isolate->ScheduleThrow( 807 isolate->ScheduleThrow(
808 *isolate->factory()->NewReferenceError("not_defined", 808 *isolate->factory()->NewReferenceError("not_defined",
809 HandleVector(&name, 1))); 809 HandleVector(&name, 1)));
810 return v8::Handle<v8::Value>(); 810 return;
811 } 811 }
812 return v8::Utils::ToLocal(Handle<Object>(value, isolate)); 812 info.GetReturnValue().Set(v8::Utils::ToLocal(Handle<Object>(value, isolate)));
813 } 813 }
814 814
815 815
816 static void ModuleSetExport( 816 static void ModuleSetExport(
817 v8::Local<v8::String> property, 817 v8::Local<v8::String> property,
818 v8::Local<v8::Value> value, 818 v8::Local<v8::Value> value,
819 const v8::AccessorInfo& info) { 819 const v8::PropertyCallbackInfo<v8::Value>& info) {
820 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); 820 JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder()));
821 Context* context = Context::cast(instance->context()); 821 Context* context = Context::cast(instance->context());
822 ASSERT(context->IsModuleContext()); 822 ASSERT(context->IsModuleContext());
823 int slot = info.Data()->Int32Value(); 823 int slot = info.Data()->Int32Value();
824 Object* old_value = context->get(slot); 824 Object* old_value = context->get(slot);
825 if (old_value->IsTheHole()) { 825 if (old_value->IsTheHole()) {
826 Handle<String> name = v8::Utils::OpenHandle(*property); 826 Handle<String> name = v8::Utils::OpenHandle(*property);
827 Isolate* isolate = instance->GetIsolate(); 827 Isolate* isolate = instance->GetIsolate();
828 isolate->ScheduleThrow( 828 isolate->ScheduleThrow(
829 *isolate->factory()->NewReferenceError("not_defined", 829 *isolate->factory()->NewReferenceError("not_defined",
(...skipping 17 matching lines...) Expand all
847 info->set_data(Smi::FromInt(index)); 847 info->set_data(Smi::FromInt(index));
848 Handle<Object> getter = v8::FromCData(&ModuleGetExport); 848 Handle<Object> getter = v8::FromCData(&ModuleGetExport);
849 Handle<Object> setter = v8::FromCData(&ModuleSetExport); 849 Handle<Object> setter = v8::FromCData(&ModuleSetExport);
850 info->set_getter(*getter); 850 info->set_getter(*getter);
851 if (!(attributes & ReadOnly)) info->set_setter(*setter); 851 if (!(attributes & ReadOnly)) info->set_setter(*setter);
852 return info; 852 return info;
853 } 853 }
854 854
855 855
856 } } // namespace v8::internal 856 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « samples/shell.cc ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698