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 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 | |
132 #ifndef V8_SHARED | 129 #ifndef V8_SHARED |
133 bool CounterMap::Match(void* key1, void* key2) { | 130 bool CounterMap::Match(void* key1, void* key2) { |
134 const char* name1 = reinterpret_cast<const char*>(key1); | 131 const char* name1 = reinterpret_cast<const char*>(key1); |
135 const char* name2 = reinterpret_cast<const char*>(key2); | 132 const char* name2 = reinterpret_cast<const char*>(key2); |
136 return strcmp(name1, name2) == 0; | 133 return strcmp(name1, name2) == 0; |
137 } | 134 } |
138 #endif // V8_SHARED | 135 #endif // V8_SHARED |
139 | 136 |
140 | 137 |
141 // Converts a V8 value to a C string. | 138 // Converts a V8 value to a C string. |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 const char* chars = ReadChars(name, &size); | 1184 const char* chars = ReadChars(name, &size); |
1188 if (chars == NULL) return Handle<String>(); | 1185 if (chars == NULL) return Handle<String>(); |
1189 Handle<String> result = String::New(chars, size); | 1186 Handle<String> result = String::New(chars, size); |
1190 delete[] chars; | 1187 delete[] chars; |
1191 return result; | 1188 return result; |
1192 } | 1189 } |
1193 | 1190 |
1194 | 1191 |
1195 #ifndef V8_SHARED | 1192 #ifndef V8_SHARED |
1196 i::Thread::Options SourceGroup::GetThreadOptions() { | 1193 i::Thread::Options SourceGroup::GetThreadOptions() { |
| 1194 i::Thread::Options options; |
| 1195 options.name = "IsolateThread"; |
1197 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less | 1196 // On some systems (OSX 10.6) the stack size default is 0.5Mb or less |
1198 // which is not enough to parse the big literal expressions used in tests. | 1197 // which is not enough to parse the big literal expressions used in tests. |
1199 // The stack size should be at least StackGuard::kLimitSize + some | 1198 // The stack size should be at least StackGuard::kLimitSize + some |
1200 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. | 1199 // OS-specific padding for thread startup code. |
1201 return i::Thread::Options("IsolateThread", 2 * MB); | 1200 options.stack_size = 2 << 20; // 2 Mb seems to be enough |
| 1201 return options; |
1202 } | 1202 } |
1203 | 1203 |
1204 | 1204 |
1205 void SourceGroup::ExecuteInThread() { | 1205 void SourceGroup::ExecuteInThread() { |
1206 Isolate* isolate = Isolate::New(); | 1206 Isolate* isolate = Isolate::New(); |
1207 do { | 1207 do { |
1208 if (next_semaphore_ != NULL) next_semaphore_->Wait(); | 1208 if (next_semaphore_ != NULL) next_semaphore_->Wait(); |
1209 { | 1209 { |
1210 Isolate::Scope iscope(isolate); | 1210 Isolate::Scope iscope(isolate); |
1211 Locker lock(isolate); | 1211 Locker lock(isolate); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 } | 1504 } |
1505 | 1505 |
1506 } // namespace v8 | 1506 } // namespace v8 |
1507 | 1507 |
1508 | 1508 |
1509 #ifndef GOOGLE3 | 1509 #ifndef GOOGLE3 |
1510 int main(int argc, char* argv[]) { | 1510 int main(int argc, char* argv[]) { |
1511 return v8::Shell::Main(argc, argv); | 1511 return v8::Shell::Main(argc, argv); |
1512 } | 1512 } |
1513 #endif | 1513 #endif |
OLD | NEW |