OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 uint16_t* name_buffer = NULL; | 222 uint16_t* name_buffer = NULL; |
223 if (name->IsString()) { | 223 if (name->IsString()) { |
224 Local<String> name_string = Local<String>::Cast(name); | 224 Local<String> name_string = Local<String>::Cast(name); |
225 name_length = name_string->Length(); | 225 name_length = name_string->Length(); |
226 name_buffer = new uint16_t[name_length]; | 226 name_buffer = new uint16_t[name_length]; |
227 name_string->Write(name_buffer, 0, name_length); | 227 name_string->Write(name_buffer, 0, name_length); |
228 } | 228 } |
229 ShellArrayBufferAllocator allocator; | 229 ShellArrayBufferAllocator allocator; |
230 Isolate::CreateParams create_params; | 230 Isolate::CreateParams create_params; |
231 create_params.array_buffer_allocator = &allocator; | 231 create_params.array_buffer_allocator = &allocator; |
| 232 create_params.shared_array_buffer_allocator = &allocator; |
232 Isolate* temp_isolate = Isolate::New(create_params); | 233 Isolate* temp_isolate = Isolate::New(create_params); |
233 ScriptCompiler::CachedData* result = NULL; | 234 ScriptCompiler::CachedData* result = NULL; |
234 { | 235 { |
235 Isolate::Scope isolate_scope(temp_isolate); | 236 Isolate::Scope isolate_scope(temp_isolate); |
236 HandleScope handle_scope(temp_isolate); | 237 HandleScope handle_scope(temp_isolate); |
237 Context::Scope context_scope(Context::New(temp_isolate)); | 238 Context::Scope context_scope(Context::New(temp_isolate)); |
238 Local<String> source_copy = v8::String::NewFromTwoByte( | 239 Local<String> source_copy = v8::String::NewFromTwoByte( |
239 temp_isolate, source_buffer, v8::String::kNormalString, source_length); | 240 temp_isolate, source_buffer, v8::String::kNormalString, source_length); |
240 Local<Value> name_copy; | 241 Local<Value> name_copy; |
241 if (name_buffer) { | 242 if (name_buffer) { |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 // The stack size should be at least StackGuard::kLimitSize + some | 1318 // The stack size should be at least StackGuard::kLimitSize + some |
1318 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. | 1319 // OS-specific padding for thread startup code. 2Mbytes seems to be enough. |
1319 return base::Thread::Options("IsolateThread", 2 * MB); | 1320 return base::Thread::Options("IsolateThread", 2 * MB); |
1320 } | 1321 } |
1321 | 1322 |
1322 | 1323 |
1323 void SourceGroup::ExecuteInThread() { | 1324 void SourceGroup::ExecuteInThread() { |
1324 ShellArrayBufferAllocator allocator; | 1325 ShellArrayBufferAllocator allocator; |
1325 Isolate::CreateParams create_params; | 1326 Isolate::CreateParams create_params; |
1326 create_params.array_buffer_allocator = &allocator; | 1327 create_params.array_buffer_allocator = &allocator; |
| 1328 create_params.shared_array_buffer_allocator = &allocator; |
1327 Isolate* isolate = Isolate::New(create_params); | 1329 Isolate* isolate = Isolate::New(create_params); |
1328 do { | 1330 do { |
1329 next_semaphore_.Wait(); | 1331 next_semaphore_.Wait(); |
1330 { | 1332 { |
1331 Isolate::Scope iscope(isolate); | 1333 Isolate::Scope iscope(isolate); |
1332 { | 1334 { |
1333 HandleScope scope(isolate); | 1335 HandleScope scope(isolate); |
1334 PerIsolateData data(isolate); | 1336 PerIsolateData data(isolate); |
1335 Local<Context> context = Shell::CreateEvaluationContext(isolate); | 1337 Local<Context> context = Shell::CreateEvaluationContext(isolate); |
1336 { | 1338 { |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 #endif | 1650 #endif |
1649 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); | 1651 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); |
1650 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg"); | 1652 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg"); |
1651 SetFlagsFromString("--redirect-code-traces-to=code.asm"); | 1653 SetFlagsFromString("--redirect-code-traces-to=code.asm"); |
1652 int result = 0; | 1654 int result = 0; |
1653 Isolate::CreateParams create_params; | 1655 Isolate::CreateParams create_params; |
1654 ShellArrayBufferAllocator array_buffer_allocator; | 1656 ShellArrayBufferAllocator array_buffer_allocator; |
1655 MockArrayBufferAllocator mock_arraybuffer_allocator; | 1657 MockArrayBufferAllocator mock_arraybuffer_allocator; |
1656 if (options.mock_arraybuffer_allocator) { | 1658 if (options.mock_arraybuffer_allocator) { |
1657 create_params.array_buffer_allocator = &mock_arraybuffer_allocator; | 1659 create_params.array_buffer_allocator = &mock_arraybuffer_allocator; |
| 1660 create_params.shared_array_buffer_allocator = &mock_arraybuffer_allocator; |
1658 } else { | 1661 } else { |
1659 create_params.array_buffer_allocator = &array_buffer_allocator; | 1662 create_params.array_buffer_allocator = &array_buffer_allocator; |
| 1663 create_params.shared_array_buffer_allocator = &array_buffer_allocator; |
1660 } | 1664 } |
1661 #if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE) | 1665 #if !defined(V8_SHARED) && defined(ENABLE_GDB_JIT_INTERFACE) |
1662 if (i::FLAG_gdbjit) { | 1666 if (i::FLAG_gdbjit) { |
1663 create_params.code_event_handler = i::GDBJITInterface::EventHandler; | 1667 create_params.code_event_handler = i::GDBJITInterface::EventHandler; |
1664 } | 1668 } |
1665 #endif | 1669 #endif |
1666 #ifdef ENABLE_VTUNE_JIT_INTERFACE | 1670 #ifdef ENABLE_VTUNE_JIT_INTERFACE |
1667 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler(); | 1671 create_params.code_event_handler = vTune::GetVtuneCodeEventHandler(); |
1668 #endif | 1672 #endif |
1669 #ifndef V8_SHARED | 1673 #ifndef V8_SHARED |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 } | 1752 } |
1749 | 1753 |
1750 } // namespace v8 | 1754 } // namespace v8 |
1751 | 1755 |
1752 | 1756 |
1753 #ifndef GOOGLE3 | 1757 #ifndef GOOGLE3 |
1754 int main(int argc, char* argv[]) { | 1758 int main(int argc, char* argv[]) { |
1755 return v8::Shell::Main(argc, argv); | 1759 return v8::Shell::Main(argc, argv); |
1756 } | 1760 } |
1757 #endif | 1761 #endif |
OLD | NEW |