| 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_; | 160 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); |
| 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::ScopedLock lock(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_; |
| 1014 delete counters_file_; | 1015 delete counters_file_; |
| 1015 delete counter_map_; | 1016 delete counter_map_; |
| 1016 #endif // V8_SHARED | 1017 #endif // V8_SHARED |
| 1017 } | 1018 } |
| 1018 | 1019 |
| 1019 | 1020 |
| 1020 | 1021 |
| 1021 static FILE* FOpen(const char* path, const char* mode) { | 1022 static FILE* FOpen(const char* path, const char* mode) { |
| 1022 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) | 1023 #if defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)) |
| 1023 FILE* result; | 1024 FILE* result; |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 } | 1647 } |
| 1647 | 1648 |
| 1648 } // namespace v8 | 1649 } // namespace v8 |
| 1649 | 1650 |
| 1650 | 1651 |
| 1651 #ifndef GOOGLE3 | 1652 #ifndef GOOGLE3 |
| 1652 int main(int argc, char* argv[]) { | 1653 int main(int argc, char* argv[]) { |
| 1653 return v8::Shell::Main(argc, argv); | 1654 return v8::Shell::Main(argc, argv); |
| 1654 } | 1655 } |
| 1655 #endif | 1656 #endif |
| OLD | NEW |