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

Side by Side Diff: src/d8.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/d8.h ('k') | src/d8-debug.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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 static const int kArgc = 3; 619 static const int kArgc = 3;
620 v8::Local<v8::Context> evaluation_context = 620 v8::Local<v8::Context> evaluation_context =
621 v8::Local<v8::Context>::New(isolate, evaluation_context_); 621 v8::Local<v8::Context>::New(isolate, evaluation_context_);
622 Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full }; 622 Handle<Value> argv[kArgc] = { evaluation_context->Global(), text, full };
623 Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv); 623 Local<Value> val = Local<Function>::Cast(fun)->Call(global, kArgc, argv);
624 return handle_scope.Escape(Local<Array>::Cast(val)); 624 return handle_scope.Escape(Local<Array>::Cast(val));
625 } 625 }
626 626
627 627
628 #ifdef ENABLE_DEBUGGER_SUPPORT 628 #ifdef ENABLE_DEBUGGER_SUPPORT
629 Handle<Object> Shell::DebugMessageDetails(Isolate* isolate, 629 Local<Object> Shell::DebugMessageDetails(Isolate* isolate,
630 Handle<String> message) { 630 Handle<String> message) {
631 HandleScope handle_scope(isolate); 631 EscapableHandleScope handle_scope(isolate);
632 v8::Local<v8::Context> context = 632 v8::Local<v8::Context> context =
633 v8::Local<v8::Context>::New(isolate, utility_context_); 633 v8::Local<v8::Context>::New(isolate, utility_context_);
634 v8::Context::Scope context_scope(context); 634 v8::Context::Scope context_scope(context);
635 Handle<Object> global = context->Global(); 635 Handle<Object> global = context->Global();
636 Handle<Value> fun = 636 Handle<Value> fun =
637 global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails")); 637 global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails"));
638 static const int kArgc = 1; 638 static const int kArgc = 1;
639 Handle<Value> argv[kArgc] = { message }; 639 Handle<Value> argv[kArgc] = { message };
640 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 640 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
641 return Handle<Object>::Cast(val); 641 return handle_scope.Escape(Local<Object>(Handle<Object>::Cast(val)));
642 } 642 }
643 643
644 644
645 Handle<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate, 645 Local<Value> Shell::DebugCommandToJSONRequest(Isolate* isolate,
646 Handle<String> command) { 646 Handle<String> command) {
647 HandleScope handle_scope(isolate); 647 EscapableHandleScope handle_scope(isolate);
648 v8::Local<v8::Context> context = 648 v8::Local<v8::Context> context =
649 v8::Local<v8::Context>::New(isolate, utility_context_); 649 v8::Local<v8::Context>::New(isolate, utility_context_);
650 v8::Context::Scope context_scope(context); 650 v8::Context::Scope context_scope(context);
651 Handle<Object> global = context->Global(); 651 Handle<Object> global = context->Global();
652 Handle<Value> fun = 652 Handle<Value> fun =
653 global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest")); 653 global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest"));
654 static const int kArgc = 1; 654 static const int kArgc = 1;
655 Handle<Value> argv[kArgc] = { command }; 655 Handle<Value> argv[kArgc] = { command };
656 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv); 656 Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
657 return val; 657 return handle_scope.Escape(Local<Value>(val));
658 } 658 }
659 659
660 660
661 void Shell::DispatchDebugMessages() { 661 void Shell::DispatchDebugMessages() {
662 Isolate* isolate = v8::Isolate::GetCurrent(); 662 Isolate* isolate = v8::Isolate::GetCurrent();
663 HandleScope handle_scope(isolate); 663 HandleScope handle_scope(isolate);
664 v8::Local<v8::Context> context = 664 v8::Local<v8::Context> context =
665 v8::Local<v8::Context>::New(isolate, Shell::evaluation_context_); 665 v8::Local<v8::Context>::New(isolate, Shell::evaluation_context_);
666 v8::Context::Scope context_scope(context); 666 v8::Context::Scope context_scope(context);
667 v8::Debug::ProcessDebugMessages(); 667 v8::Debug::ProcessDebugMessages();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1126
1127 Isolate* isolate = args.GetIsolate(); 1127 Isolate* isolate = args.GetIsolate();
1128 DataAndPersistent* data = new DataAndPersistent; 1128 DataAndPersistent* data = new DataAndPersistent;
1129 data->data = reinterpret_cast<uint8_t*>( 1129 data->data = reinterpret_cast<uint8_t*>(
1130 ReadChars(args.GetIsolate(), *filename, &length)); 1130 ReadChars(args.GetIsolate(), *filename, &length));
1131 if (data->data == NULL) { 1131 if (data->data == NULL) {
1132 delete data; 1132 delete data;
1133 Throw(args.GetIsolate(), "Error reading file"); 1133 Throw(args.GetIsolate(), "Error reading file");
1134 return; 1134 return;
1135 } 1135 }
1136 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data, length); 1136 Handle<v8::ArrayBuffer> buffer =
1137 ArrayBuffer::New(isolate, data->data, length);
1137 data->handle.Reset(isolate, buffer); 1138 data->handle.Reset(isolate, buffer);
1138 data->handle.SetWeak(data, ReadBufferWeakCallback); 1139 data->handle.SetWeak(data, ReadBufferWeakCallback);
1139 data->handle.MarkIndependent(); 1140 data->handle.MarkIndependent();
1140 isolate->AdjustAmountOfExternalAllocatedMemory(length); 1141 isolate->AdjustAmountOfExternalAllocatedMemory(length);
1141 1142
1142 args.GetReturnValue().Set(buffer); 1143 args.GetReturnValue().Set(buffer);
1143 } 1144 }
1144 1145
1145 1146
1146 #ifndef V8_SHARED 1147 #ifndef V8_SHARED
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 } 1763 }
1763 1764
1764 } // namespace v8 1765 } // namespace v8
1765 1766
1766 1767
1767 #ifndef GOOGLE3 1768 #ifndef GOOGLE3
1768 int main(int argc, char* argv[]) { 1769 int main(int argc, char* argv[]) {
1769 return v8::Shell::Main(argc, argv); 1770 return v8::Shell::Main(argc, argv);
1770 } 1771 }
1771 #endif 1772 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/d8-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698