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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #endif | 150 #endif |
151 return Shell::ReadFromStdin(isolate_); | 151 return Shell::ReadFromStdin(isolate_); |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 #ifndef V8_SHARED | 155 #ifndef V8_SHARED |
156 CounterMap* Shell::counter_map_; | 156 CounterMap* Shell::counter_map_; |
157 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL; | 157 i::OS::MemoryMappedFile* Shell::counters_file_ = NULL; |
158 CounterCollection Shell::local_counters_; | 158 CounterCollection Shell::local_counters_; |
159 CounterCollection* Shell::counters_ = &local_counters_; | 159 CounterCollection* Shell::counters_ = &local_counters_; |
160 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); | 160 i::Mutex Shell::context_mutex_; |
161 Persistent<Context> Shell::utility_context_; | 161 Persistent<Context> Shell::utility_context_; |
162 #endif // V8_SHARED | 162 #endif // V8_SHARED |
163 | 163 |
164 Persistent<Context> Shell::evaluation_context_; | 164 Persistent<Context> Shell::evaluation_context_; |
165 ShellOptions Shell::options; | 165 ShellOptions Shell::options; |
166 const char* Shell::kPrompt = "d8> "; | 166 const char* Shell::kPrompt = "d8> "; |
167 | 167 |
168 | 168 |
169 const int MB = 1024 * 1024; | 169 const int MB = 1024 * 1024; |
170 | 170 |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); | 918 v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); |
919 } | 919 } |
920 #endif // ENABLE_DEBUGGER_SUPPORT | 920 #endif // ENABLE_DEBUGGER_SUPPORT |
921 #endif // V8_SHARED | 921 #endif // V8_SHARED |
922 } | 922 } |
923 | 923 |
924 | 924 |
925 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { | 925 Local<Context> Shell::CreateEvaluationContext(Isolate* isolate) { |
926 #ifndef V8_SHARED | 926 #ifndef V8_SHARED |
927 // This needs to be a critical section since this is not thread-safe | 927 // This needs to be a critical section since this is not thread-safe |
928 i::ScopedLock lock(context_mutex_); | 928 i::LockGuard<i::Mutex> lock_guard(&context_mutex_); |
929 #endif // V8_SHARED | 929 #endif // V8_SHARED |
930 // Initialize the global objects | 930 // Initialize the global objects |
931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); | 931 Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate); |
932 HandleScope handle_scope(isolate); | 932 HandleScope handle_scope(isolate); |
933 Local<Context> context = Context::New(isolate, NULL, global_template); | 933 Local<Context> context = Context::New(isolate, NULL, global_template); |
934 ASSERT(!context.IsEmpty()); | 934 ASSERT(!context.IsEmpty()); |
935 Context::Scope scope(context); | 935 Context::Scope scope(context); |
936 | 936 |
937 #ifndef V8_SHARED | 937 #ifndef V8_SHARED |
938 i::Factory* factory = i::Isolate::Current()->factory(); | 938 i::Factory* factory = i::Isolate::Current()->factory(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 printf("| c:%-60s | %11i |\n", key, counter->count()); | 1004 printf("| c:%-60s | %11i |\n", key, counter->count()); |
1005 printf("| t:%-60s | %11i |\n", key, counter->sample_total()); | 1005 printf("| t:%-60s | %11i |\n", key, counter->sample_total()); |
1006 } else { | 1006 } else { |
1007 printf("| %-62s | %11i |\n", key, counter->count()); | 1007 printf("| %-62s | %11i |\n", key, counter->count()); |
1008 } | 1008 } |
1009 } | 1009 } |
1010 printf("+----------------------------------------------------------------+" | 1010 printf("+----------------------------------------------------------------+" |
1011 "-------------+\n"); | 1011 "-------------+\n"); |
1012 delete [] counters; | 1012 delete [] counters; |
1013 } | 1013 } |
1014 delete context_mutex_; | |
1015 delete counters_file_; | 1014 delete counters_file_; |
1016 delete counter_map_; | 1015 delete counter_map_; |
1017 #endif // V8_SHARED | 1016 #endif // V8_SHARED |
1018 } | 1017 } |
1019 | 1018 |
1020 | 1019 |
1021 | 1020 |
1022 static FILE* FOpen(const char* path, const char* mode) { | 1021 static FILE* FOpen(const char* path, const char* mode) { |
1023 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) | 1022 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) |
1024 FILE* result; | 1023 FILE* result; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 } | 1728 } |
1730 | 1729 |
1731 } // namespace v8 | 1730 } // namespace v8 |
1732 | 1731 |
1733 | 1732 |
1734 #ifndef GOOGLE3 | 1733 #ifndef GOOGLE3 |
1735 int main(int argc, char* argv[]) { | 1734 int main(int argc, char* argv[]) { |
1736 return v8::Shell::Main(argc, argv); | 1735 return v8::Shell::Main(argc, argv); |
1737 } | 1736 } |
1738 #endif | 1737 #endif |
OLD | NEW |