OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/isolate.h" | 5 #include "vm/isolate.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/json.h" | 9 #include "platform/json.h" |
10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 isolate_key = Thread::CreateThreadLocal(); | 362 isolate_key = Thread::CreateThreadLocal(); |
363 ASSERT(isolate_key != Thread::kUnsetThreadLocalKey); | 363 ASSERT(isolate_key != Thread::kUnsetThreadLocalKey); |
364 create_callback_ = NULL; | 364 create_callback_ = NULL; |
365 } | 365 } |
366 | 366 |
367 | 367 |
368 Isolate* Isolate::Init(const char* name_prefix) { | 368 Isolate* Isolate::Init(const char* name_prefix) { |
369 Isolate* result = new Isolate(); | 369 Isolate* result = new Isolate(); |
370 ASSERT(result != NULL); | 370 ASSERT(result != NULL); |
371 | 371 |
| 372 // Setup for profiling. |
| 373 ProfilerManager::SetupIsolateForProfiling(result); |
| 374 |
372 // TODO(5411455): For now just set the recently created isolate as | 375 // TODO(5411455): For now just set the recently created isolate as |
373 // the current isolate. | 376 // the current isolate. |
374 SetCurrent(result); | 377 SetCurrent(result); |
375 | 378 |
376 // Setup the isolate specific resuable handles. | 379 // Setup the isolate specific resuable handles. |
377 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 380 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
378 result->object##_handle_ = result->AllocateReusableHandle<object>(); \ | 381 result->object##_handle_ = result->AllocateReusableHandle<object>(); \ |
379 | 382 |
380 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 383 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
381 #undef REUSABLE_HANDLE_ALLOCATION | 384 #undef REUSABLE_HANDLE_ALLOCATION |
(...skipping 18 matching lines...) Expand all Loading... |
400 | 403 |
401 result->debugger_ = new Debugger(); | 404 result->debugger_ = new Debugger(); |
402 result->debugger_->Initialize(result); | 405 result->debugger_->Initialize(result); |
403 if (FLAG_trace_isolates) { | 406 if (FLAG_trace_isolates) { |
404 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 407 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
405 OS::Print("[+] Starting isolate:\n" | 408 OS::Print("[+] Starting isolate:\n" |
406 "\tisolate: %s\n", result->name()); | 409 "\tisolate: %s\n", result->name()); |
407 } | 410 } |
408 } | 411 } |
409 | 412 |
410 // Setup for profiling. | |
411 ProfilerManager::SetupIsolateForProfiling(result); | |
412 | 413 |
413 return result; | 414 return result; |
414 } | 415 } |
415 | 416 |
416 | 417 |
417 void Isolate::BuildName(const char* name_prefix) { | 418 void Isolate::BuildName(const char* name_prefix) { |
418 ASSERT(name_ == NULL); | 419 ASSERT(name_ == NULL); |
419 if (name_prefix == NULL) { | 420 if (name_prefix == NULL) { |
420 name_prefix = "isolate"; | 421 name_prefix = "isolate"; |
421 } | 422 } |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 return func.raw(); | 1120 return func.raw(); |
1120 } | 1121 } |
1121 | 1122 |
1122 | 1123 |
1123 void IsolateSpawnState::Cleanup() { | 1124 void IsolateSpawnState::Cleanup() { |
1124 SwitchIsolateScope switch_scope(isolate()); | 1125 SwitchIsolateScope switch_scope(isolate()); |
1125 Dart::ShutdownIsolate(); | 1126 Dart::ShutdownIsolate(); |
1126 } | 1127 } |
1127 | 1128 |
1128 } // namespace dart | 1129 } // namespace dart |
OLD | NEW |