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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); | 113 i::Mutex* Shell::context_mutex_(i::OS::CreateMutex()); |
114 Persistent<Context> Shell::utility_context_; | 114 Persistent<Context> Shell::utility_context_; |
115 #endif // V8_SHARED | 115 #endif // V8_SHARED |
116 | 116 |
117 LineEditor* Shell::console = NULL; | 117 LineEditor* Shell::console = NULL; |
118 Persistent<Context> Shell::evaluation_context_; | 118 Persistent<Context> Shell::evaluation_context_; |
119 ShellOptions Shell::options; | 119 ShellOptions Shell::options; |
120 const char* Shell::kPrompt = "d8> "; | 120 const char* Shell::kPrompt = "d8> "; |
121 | 121 |
122 | 122 |
| 123 const int MB = 1024 * 1024; |
| 124 |
| 125 |
123 #ifndef V8_SHARED | 126 #ifndef V8_SHARED |
124 bool CounterMap::Match(void* key1, void* key2) { | 127 bool CounterMap::Match(void* key1, void* key2) { |
125 const char* name1 = reinterpret_cast<const char*>(key1); | 128 const char* name1 = reinterpret_cast<const char*>(key1); |
126 const char* name2 = reinterpret_cast<const char*>(key2); | 129 const char* name2 = reinterpret_cast<const char*>(key2); |
127 return strcmp(name1, name2) == 0; | 130 return strcmp(name1, name2) == 0; |
128 } | 131 } |
129 #endif // V8_SHARED | 132 #endif // V8_SHARED |
130 | 133 |
131 | 134 |
132 // Converts a V8 value to a C string. | 135 // Converts a V8 value to a C string. |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 const char* chars = ReadChars(name, &size); | 1206 const char* chars = ReadChars(name, &size); |
1204 if (chars == NULL) return Handle<String>(); | 1207 if (chars == NULL) return Handle<String>(); |
1205 Handle<String> result = String::New(chars, size); | 1208 Handle<String> result = String::New(chars, size); |
1206 delete[] chars; | 1209 delete[] chars; |
1207 return result; | 1210 return result; |
1208 } | 1211 } |
1209 | 1212 |
1210 | 1213 |
1211 #ifndef V8_SHARED | 1214 #ifndef V8_SHARED |
1212 i::Thread::Options SourceGroup::GetThreadOptions() { | 1215 i::Thread::Options SourceGroup::GetThreadOptions() { |
1213 i::Thread::Options options; | |
1214 options.name = "IsolateThread"; | |
1215 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less | 1216 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less |
1216 // which is not enough to parse the big literal expressions used in tests. | 1217 // which is not enough to parse the big literal expressions used in tests. |
1217 // The stack size should be at least StackGuard::kLimitSize + some | 1218 // The stack size should be at least StackGuard::kLimitSize + some |
1218 // OS-specific padding for thread startup code. | 1219 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. |
1219 options.stack_size = 2 << 20; // 2 Mb seems to be enough | 1220 return i::Thread::Options("IsolateThread", 2 * MB); |
1220 return options; | |
1221 } | 1221 } |
1222 | 1222 |
1223 | 1223 |
1224 void SourceGroup::ExecuteInThread() { | 1224 void SourceGroup::ExecuteInThread() { |
1225 Isolate* isolate = Isolate::New(); | 1225 Isolate* isolate = Isolate::New(); |
1226 do { | 1226 do { |
1227 if (next_semaphore_ != NULL) next_semaphore_->Wait(); | 1227 if (next_semaphore_ != NULL) next_semaphore_->Wait(); |
1228 { | 1228 { |
1229 Isolate::Scope iscope(isolate); | 1229 Isolate::Scope iscope(isolate); |
1230 Locker lock(isolate); | 1230 Locker lock(isolate); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 } | 1523 } |
1524 | 1524 |
1525 } // namespace v8 | 1525 } // namespace v8 |
1526 | 1526 |
1527 | 1527 |
1528 #ifndef GOOGLE3 | 1528 #ifndef GOOGLE3 |
1529 int main(int argc, char* argv[]) { | 1529 int main(int argc, char* argv[]) { |
1530 return v8::Shell::Main(argc, argv); | 1530 return v8::Shell::Main(argc, argv); |
1531 } | 1531 } |
1532 #endif | 1532 #endif |
OLD | NEW |