OLD | NEW |
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 if (result == BZ_OK) { | 851 if (result == BZ_OK) { |
852 *raw_data_size = decompressed_size; | 852 *raw_data_size = decompressed_size; |
853 } | 853 } |
854 return result; | 854 return result; |
855 } | 855 } |
856 }; | 856 }; |
857 #endif | 857 #endif |
858 | 858 |
859 | 859 |
860 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { | 860 Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { |
861 Handle<ObjectTemplate> global_template = ObjectTemplate::New(); | 861 Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate); |
862 global_template->Set(String::NewFromUtf8(isolate, "print"), | 862 global_template->Set(String::NewFromUtf8(isolate, "print"), |
863 FunctionTemplate::New(isolate, Print)); | 863 FunctionTemplate::New(isolate, Print)); |
864 global_template->Set(String::NewFromUtf8(isolate, "write"), | 864 global_template->Set(String::NewFromUtf8(isolate, "write"), |
865 FunctionTemplate::New(isolate, Write)); | 865 FunctionTemplate::New(isolate, Write)); |
866 global_template->Set(String::NewFromUtf8(isolate, "read"), | 866 global_template->Set(String::NewFromUtf8(isolate, "read"), |
867 FunctionTemplate::New(isolate, Read)); | 867 FunctionTemplate::New(isolate, Read)); |
868 global_template->Set(String::NewFromUtf8(isolate, "readbuffer"), | 868 global_template->Set(String::NewFromUtf8(isolate, "readbuffer"), |
869 FunctionTemplate::New(isolate, ReadBuffer)); | 869 FunctionTemplate::New(isolate, ReadBuffer)); |
870 global_template->Set(String::NewFromUtf8(isolate, "readline"), | 870 global_template->Set(String::NewFromUtf8(isolate, "readline"), |
871 FunctionTemplate::New(isolate, ReadLine)); | 871 FunctionTemplate::New(isolate, ReadLine)); |
872 global_template->Set(String::NewFromUtf8(isolate, "load"), | 872 global_template->Set(String::NewFromUtf8(isolate, "load"), |
873 FunctionTemplate::New(isolate, Load)); | 873 FunctionTemplate::New(isolate, Load)); |
874 global_template->Set(String::NewFromUtf8(isolate, "quit"), | 874 global_template->Set(String::NewFromUtf8(isolate, "quit"), |
875 FunctionTemplate::New(isolate, Quit)); | 875 FunctionTemplate::New(isolate, Quit)); |
876 global_template->Set(String::NewFromUtf8(isolate, "version"), | 876 global_template->Set(String::NewFromUtf8(isolate, "version"), |
877 FunctionTemplate::New(isolate, Version)); | 877 FunctionTemplate::New(isolate, Version)); |
878 | 878 |
879 // Bind the Realm object. | 879 // Bind the Realm object. |
880 Handle<ObjectTemplate> realm_template = ObjectTemplate::New(); | 880 Handle<ObjectTemplate> realm_template = ObjectTemplate::New(isolate); |
881 realm_template->Set(String::NewFromUtf8(isolate, "current"), | 881 realm_template->Set(String::NewFromUtf8(isolate, "current"), |
882 FunctionTemplate::New(isolate, RealmCurrent)); | 882 FunctionTemplate::New(isolate, RealmCurrent)); |
883 realm_template->Set(String::NewFromUtf8(isolate, "owner"), | 883 realm_template->Set(String::NewFromUtf8(isolate, "owner"), |
884 FunctionTemplate::New(isolate, RealmOwner)); | 884 FunctionTemplate::New(isolate, RealmOwner)); |
885 realm_template->Set(String::NewFromUtf8(isolate, "global"), | 885 realm_template->Set(String::NewFromUtf8(isolate, "global"), |
886 FunctionTemplate::New(isolate, RealmGlobal)); | 886 FunctionTemplate::New(isolate, RealmGlobal)); |
887 realm_template->Set(String::NewFromUtf8(isolate, "create"), | 887 realm_template->Set(String::NewFromUtf8(isolate, "create"), |
888 FunctionTemplate::New(isolate, RealmCreate)); | 888 FunctionTemplate::New(isolate, RealmCreate)); |
889 realm_template->Set(String::NewFromUtf8(isolate, "dispose"), | 889 realm_template->Set(String::NewFromUtf8(isolate, "dispose"), |
890 FunctionTemplate::New(isolate, RealmDispose)); | 890 FunctionTemplate::New(isolate, RealmDispose)); |
891 realm_template->Set(String::NewFromUtf8(isolate, "switch"), | 891 realm_template->Set(String::NewFromUtf8(isolate, "switch"), |
892 FunctionTemplate::New(isolate, RealmSwitch)); | 892 FunctionTemplate::New(isolate, RealmSwitch)); |
893 realm_template->Set(String::NewFromUtf8(isolate, "eval"), | 893 realm_template->Set(String::NewFromUtf8(isolate, "eval"), |
894 FunctionTemplate::New(isolate, RealmEval)); | 894 FunctionTemplate::New(isolate, RealmEval)); |
895 realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"), | 895 realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"), |
896 RealmSharedGet, RealmSharedSet); | 896 RealmSharedGet, RealmSharedSet); |
897 global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template); | 897 global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template); |
898 | 898 |
899 #ifndef V8_SHARED | 899 #ifndef V8_SHARED |
900 Handle<ObjectTemplate> performance_template = ObjectTemplate::New(); | 900 Handle<ObjectTemplate> performance_template = ObjectTemplate::New(isolate); |
901 performance_template->Set(String::NewFromUtf8(isolate, "now"), | 901 performance_template->Set(String::NewFromUtf8(isolate, "now"), |
902 FunctionTemplate::New(isolate, PerformanceNow)); | 902 FunctionTemplate::New(isolate, PerformanceNow)); |
903 global_template->Set(String::NewFromUtf8(isolate, "performance"), | 903 global_template->Set(String::NewFromUtf8(isolate, "performance"), |
904 performance_template); | 904 performance_template); |
905 #endif // V8_SHARED | 905 #endif // V8_SHARED |
906 | 906 |
907 #if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64) | 907 #if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64) |
908 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(); | 908 Handle<ObjectTemplate> os_templ = ObjectTemplate::New(isolate); |
909 AddOSMethods(isolate, os_templ); | 909 AddOSMethods(isolate, os_templ); |
910 global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ); | 910 global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ); |
911 #endif // V8_SHARED | 911 #endif // V8_SHARED |
912 | 912 |
913 return global_template; | 913 return global_template; |
914 } | 914 } |
915 | 915 |
916 | 916 |
917 void Shell::Initialize(Isolate* isolate) { | 917 void Shell::Initialize(Isolate* isolate) { |
918 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 918 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 } | 1762 } |
1763 | 1763 |
1764 } // namespace v8 | 1764 } // namespace v8 |
1765 | 1765 |
1766 | 1766 |
1767 #ifndef GOOGLE3 | 1767 #ifndef GOOGLE3 |
1768 int main(int argc, char* argv[]) { | 1768 int main(int argc, char* argv[]) { |
1769 return v8::Shell::Main(argc, argv); | 1769 return v8::Shell::Main(argc, argv); |
1770 } | 1770 } |
1771 #endif | 1771 #endif |
OLD | NEW |