OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); | 119 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); |
120 Persistent<Context> Shell::utility_context_; | 120 Persistent<Context> Shell::utility_context_; |
121 LineEditor* Shell::console = NULL; | 121 LineEditor* Shell::console = NULL; |
122 #endif // V8_SHARED | 122 #endif // V8_SHARED |
123 | 123 |
124 Persistent<Context> Shell::evaluation_context_; | 124 Persistent<Context> Shell::evaluation_context_; |
125 ShellOptions Shell::options; | 125 ShellOptions Shell::options; |
126 const char* Shell::kPrompt = "d8> "; | 126 const char* Shell::kPrompt = "d8> "; |
127 | 127 |
128 | 128 |
| 129 const int MB = 1024 * 1024; |
| 130 |
| 131 |
129 #ifndef V8_SHARED | 132 #ifndef V8_SHARED |
130 bool CounterMap::Match(void* key1, void* key2) { | 133 bool CounterMap::Match(void* key1, void* key2) { |
131 const char* name1 = reinterpret_cast<const char*>(key1); | 134 const char* name1 = reinterpret_cast<const char*>(key1); |
132 const char* name2 = reinterpret_cast<const char*>(key2); | 135 const char* name2 = reinterpret_cast<const char*>(key2); |
133 return strcmp(name1, name2) == 0; | 136 return strcmp(name1, name2) == 0; |
134 } | 137 } |
135 #endif // V8_SHARED | 138 #endif // V8_SHARED |
136 | 139 |
137 | 140 |
138 // Converts a V8 value to a C string. | 141 // Converts a V8 value to a C string. |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 const char* chars = ReadChars(name, &size); | 1076 const char* chars = ReadChars(name, &size); |
1074 if (chars == NULL) return Handle<String>(); | 1077 if (chars == NULL) return Handle<String>(); |
1075 Handle<String> result = String::New(chars, size); | 1078 Handle<String> result = String::New(chars, size); |
1076 delete[] chars; | 1079 delete[] chars; |
1077 return result; | 1080 return result; |
1078 } | 1081 } |
1079 | 1082 |
1080 | 1083 |
1081 #ifndef V8_SHARED | 1084 #ifndef V8_SHARED |
1082 i::Thread::Options SourceGroup::GetThreadOptions() { | 1085 i::Thread::Options SourceGroup::GetThreadOptions() { |
1083 i::Thread::Options options; | |
1084 options.name = "IsolateThread"; | |
1085 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less | 1086 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less |
1086 // which is not enough to parse the big literal expressions used in tests. | 1087 // which is not enough to parse the big literal expressions used in tests. |
1087 // The stack size should be at least StackGuard::kLimitSize + some | 1088 // The stack size should be at least StackGuard::kLimitSize + some |
1088 // OS-specific padding for thread startup code. | 1089 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. |
1089 options.stack_size = 2 << 20; // 2 Mb seems to be enough | 1090 return i::Thread::Options("IsolateThread", 2 * MB); |
1090 return options; | |
1091 } | 1091 } |
1092 | 1092 |
1093 | 1093 |
1094 void SourceGroup::ExecuteInThread() { | 1094 void SourceGroup::ExecuteInThread() { |
1095 Isolate* isolate = Isolate::New(); | 1095 Isolate* isolate = Isolate::New(); |
1096 do { | 1096 do { |
1097 if (next_semaphore_ != NULL) next_semaphore_->Wait(); | 1097 if (next_semaphore_ != NULL) next_semaphore_->Wait(); |
1098 { | 1098 { |
1099 Isolate::Scope iscope(isolate); | 1099 Isolate::Scope iscope(isolate); |
1100 Locker lock(isolate); | 1100 Locker lock(isolate); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 } | 1393 } |
1394 | 1394 |
1395 } // namespace v8 | 1395 } // namespace v8 |
1396 | 1396 |
1397 | 1397 |
1398 #ifndef GOOGLE3 | 1398 #ifndef GOOGLE3 |
1399 int main(int argc, char* argv[]) { | 1399 int main(int argc, char* argv[]) { |
1400 return v8::Shell::Main(argc, argv); | 1400 return v8::Shell::Main(argc, argv); |
1401 } | 1401 } |
1402 #endif | 1402 #endif |
OLD | NEW |