| 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/dart.h" | 5 #include "vm/dart.h" |
| 6 | 6 |
| 7 #include "vm/become.h" | 7 #include "vm/become.h" |
| 8 #include "vm/clustered_snapshot.h" | 8 #include "vm/clustered_snapshot.h" |
| 9 #include "vm/code_observers.h" | 9 #include "vm/code_observers.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "vm/thread_interrupter.h" | 32 #include "vm/thread_interrupter.h" |
| 33 #include "vm/thread_pool.h" | 33 #include "vm/thread_pool.h" |
| 34 #include "vm/timeline.h" | 34 #include "vm/timeline.h" |
| 35 #include "vm/virtual_memory.h" | 35 #include "vm/virtual_memory.h" |
| 36 #include "vm/zone.h" | 36 #include "vm/zone.h" |
| 37 | 37 |
| 38 namespace dart { | 38 namespace dart { |
| 39 | 39 |
| 40 DECLARE_FLAG(bool, print_class_table); | 40 DECLARE_FLAG(bool, print_class_table); |
| 41 DECLARE_FLAG(bool, trace_time_all); | 41 DECLARE_FLAG(bool, trace_time_all); |
| 42 DEFINE_FLAG(bool, keep_code, false, | 42 DEFINE_FLAG(bool, keep_code, false, "Keep deoptimized code for profiling."); |
| 43 "Keep deoptimized code for profiling."); | |
| 44 DEFINE_FLAG(bool, trace_shutdown, false, "Trace VM shutdown on stderr"); | 43 DEFINE_FLAG(bool, trace_shutdown, false, "Trace VM shutdown on stderr"); |
| 45 | 44 |
| 46 Isolate* Dart::vm_isolate_ = NULL; | 45 Isolate* Dart::vm_isolate_ = NULL; |
| 47 int64_t Dart::start_time_ = 0; | 46 int64_t Dart::start_time_ = 0; |
| 48 ThreadPool* Dart::thread_pool_ = NULL; | 47 ThreadPool* Dart::thread_pool_ = NULL; |
| 49 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 48 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
| 50 ReadOnlyHandles* Dart::predefined_handles_ = NULL; | 49 ReadOnlyHandles* Dart::predefined_handles_ = NULL; |
| 51 Snapshot::Kind Dart::snapshot_kind_ = Snapshot::kInvalid; | 50 Snapshot::Kind Dart::snapshot_kind_ = Snapshot::kInvalid; |
| 52 const uint8_t* Dart::instructions_snapshot_buffer_ = NULL; | 51 const uint8_t* Dart::instructions_snapshot_buffer_ = NULL; |
| 53 const uint8_t* Dart::data_snapshot_buffer_ = NULL; | 52 const uint8_t* Dart::data_snapshot_buffer_ = NULL; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 64 // stored in the vm isolate ensures that we don't constantly create and | 63 // stored in the vm isolate ensures that we don't constantly create and |
| 65 // destroy handles for read-only objects referred in the VM code | 64 // destroy handles for read-only objects referred in the VM code |
| 66 // (e.g: symbols, null object, empty array etc.) | 65 // (e.g: symbols, null object, empty array etc.) |
| 67 // The ReadOnlyHandles C++ Wrapper around VMHandles which is a ValueObject is | 66 // The ReadOnlyHandles C++ Wrapper around VMHandles which is a ValueObject is |
| 68 // to ensure that the handles area is not trashed by automatic running of C++ | 67 // to ensure that the handles area is not trashed by automatic running of C++ |
| 69 // static destructors when 'exit()" is called by any isolate. There might be | 68 // static destructors when 'exit()" is called by any isolate. There might be |
| 70 // other isolates running at the same time and trashing the handles area will | 69 // other isolates running at the same time and trashing the handles area will |
| 71 // have unintended consequences. | 70 // have unintended consequences. |
| 72 class ReadOnlyHandles { | 71 class ReadOnlyHandles { |
| 73 public: | 72 public: |
| 74 ReadOnlyHandles() { } | 73 ReadOnlyHandles() {} |
| 75 | 74 |
| 76 private: | 75 private: |
| 77 VMHandles handles_; | 76 VMHandles handles_; |
| 78 LocalHandles api_handles_; | 77 LocalHandles api_handles_; |
| 79 | 78 |
| 80 friend class Dart; | 79 friend class Dart; |
| 81 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); | 80 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 | 83 |
| 85 static void CheckOffsets() { | 84 static void CheckOffsets() { |
| 86 #define CHECK_OFFSET(expr, offset) \ | 85 #define CHECK_OFFSET(expr, offset) \ |
| 87 if ((expr) != (offset)) { \ | 86 if ((expr) != (offset)) { \ |
| 88 FATAL2("%s == %" Pd, #expr, (expr)); \ | 87 FATAL2("%s == %" Pd, #expr, (expr)); \ |
| 89 } \ | 88 } |
| 90 | 89 |
| 91 #if defined(TARGET_ARCH_ARM) | 90 #if defined(TARGET_ARCH_ARM) |
| 92 // These offsets are embedded in precompiled instructions. We need simarm | 91 // These offsets are embedded in precompiled instructions. We need simarm |
| 93 // (compiler) and arm (runtime) to agree. | 92 // (compiler) and arm (runtime) to agree. |
| 94 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); | 93 CHECK_OFFSET(Heap::TopOffset(Heap::kNew), 8); |
| 95 CHECK_OFFSET(Thread::stack_limit_offset(), 4); | 94 CHECK_OFFSET(Thread::stack_limit_offset(), 4); |
| 96 CHECK_OFFSET(Thread::object_null_offset(), 36); | 95 CHECK_OFFSET(Thread::object_null_offset(), 36); |
| 97 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 14); | 96 CHECK_OFFSET(SingleTargetCache::upper_limit_offset(), 14); |
| 98 CHECK_OFFSET(Isolate::object_store_offset(), 28); | 97 CHECK_OFFSET(Isolate::object_store_offset(), 28); |
| 99 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 120)); | 98 NOT_IN_PRODUCT(CHECK_OFFSET(sizeof(ClassHeapStats), 120)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 } | 140 } |
| 142 set_thread_exit_callback(thread_exit); | 141 set_thread_exit_callback(thread_exit); |
| 143 SetFileCallbacks(file_open, file_read, file_write, file_close); | 142 SetFileCallbacks(file_open, file_read, file_write, file_close); |
| 144 set_entropy_source_callback(entropy_source); | 143 set_entropy_source_callback(entropy_source); |
| 145 OS::InitOnce(); | 144 OS::InitOnce(); |
| 146 VirtualMemory::InitOnce(); | 145 VirtualMemory::InitOnce(); |
| 147 OSThread::InitOnce(); | 146 OSThread::InitOnce(); |
| 148 if (FLAG_support_timeline) { | 147 if (FLAG_support_timeline) { |
| 149 Timeline::InitOnce(); | 148 Timeline::InitOnce(); |
| 150 } | 149 } |
| 151 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), | 150 NOT_IN_PRODUCT( |
| 152 "Dart::InitOnce")); | 151 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); |
| 153 Isolate::InitOnce(); | 152 Isolate::InitOnce(); |
| 154 PortMap::InitOnce(); | 153 PortMap::InitOnce(); |
| 155 FreeListElement::InitOnce(); | 154 FreeListElement::InitOnce(); |
| 156 ForwardingCorpse::InitOnce(); | 155 ForwardingCorpse::InitOnce(); |
| 157 Api::InitOnce(); | 156 Api::InitOnce(); |
| 158 NOT_IN_PRODUCT(CodeObservers::InitOnce()); | 157 NOT_IN_PRODUCT(CodeObservers::InitOnce()); |
| 159 if (FLAG_profiler) { | 158 if (FLAG_profiler) { |
| 160 ThreadInterrupter::InitOnce(); | 159 ThreadInterrupter::InitOnce(); |
| 161 Profiler::InitOnce(); | 160 Profiler::InitOnce(); |
| 162 } | 161 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 return strdup("Unexpected instructions snapshot"); | 233 return strdup("Unexpected instructions snapshot"); |
| 235 } | 234 } |
| 236 if (data_snapshot != NULL) { | 235 if (data_snapshot != NULL) { |
| 237 return strdup("Unexpected rodata snapshot"); | 236 return strdup("Unexpected rodata snapshot"); |
| 238 } | 237 } |
| 239 StubCode::InitOnce(); | 238 StubCode::InitOnce(); |
| 240 #endif | 239 #endif |
| 241 } else { | 240 } else { |
| 242 return strdup("Invalid vm isolate snapshot seen"); | 241 return strdup("Invalid vm isolate snapshot seen"); |
| 243 } | 242 } |
| 244 VmIsolateSnapshotReader reader(snapshot->kind(), | 243 VmIsolateSnapshotReader reader(snapshot->kind(), snapshot->content(), |
| 245 snapshot->content(), | 244 snapshot->length(), instructions_snapshot, |
| 246 snapshot->length(), | 245 data_snapshot, T); |
| 247 instructions_snapshot, | |
| 248 data_snapshot, | |
| 249 T); | |
| 250 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot()); | 246 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot()); |
| 251 if (!error.IsNull()) { | 247 if (!error.IsNull()) { |
| 252 // Must copy before leaving the zone. | 248 // Must copy before leaving the zone. |
| 253 return strdup(error.ToErrorCString()); | 249 return strdup(error.ToErrorCString()); |
| 254 } | 250 } |
| 255 NOT_IN_PRODUCT(if (tds.enabled()) { | 251 #if !defined(PRODUCT) |
| 252 if (tds.enabled()) { |
| 256 tds.SetNumArguments(2); | 253 tds.SetNumArguments(2); |
| 257 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length()); | 254 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length()); |
| 258 tds.FormatArgument(1, "heapSize", "%" Pd64, | 255 tds.FormatArgument( |
| 259 vm_isolate_->heap()->UsedInWords(Heap::kOld) * | 256 1, "heapSize", "%" Pd64, |
| 260 kWordSize); | 257 vm_isolate_->heap()->UsedInWords(Heap::kOld) * kWordSize); |
| 261 }); | 258 } |
| 259 #endif // !defined(PRODUCT) |
| 262 if (FLAG_trace_isolates) { | 260 if (FLAG_trace_isolates) { |
| 263 OS::Print("Size of vm isolate snapshot = %" Pd "\n", | 261 OS::Print("Size of vm isolate snapshot = %" Pd "\n", |
| 264 snapshot->length()); | 262 snapshot->length()); |
| 265 vm_isolate_->heap()->PrintSizes(); | 263 vm_isolate_->heap()->PrintSizes(); |
| 266 MegamorphicCacheTable::PrintSizes(vm_isolate_); | 264 MegamorphicCacheTable::PrintSizes(vm_isolate_); |
| 267 intptr_t size; | 265 intptr_t size; |
| 268 intptr_t capacity; | 266 intptr_t capacity; |
| 269 Symbols::GetStats(vm_isolate_, &size, &capacity); | 267 Symbols::GetStats(vm_isolate_, &size, &capacity); |
| 270 OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size); | 268 OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size); |
| 271 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); | 269 OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 346 } |
| 349 | 347 |
| 350 | 348 |
| 351 const char* Dart::Cleanup() { | 349 const char* Dart::Cleanup() { |
| 352 ASSERT(Isolate::Current() == NULL); | 350 ASSERT(Isolate::Current() == NULL); |
| 353 if (vm_isolate_ == NULL) { | 351 if (vm_isolate_ == NULL) { |
| 354 return "VM already terminated."; | 352 return "VM already terminated."; |
| 355 } | 353 } |
| 356 | 354 |
| 357 if (FLAG_trace_shutdown) { | 355 if (FLAG_trace_shutdown) { |
| 358 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n", | 356 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n", timestamp()); |
| 359 timestamp()); | |
| 360 } | 357 } |
| 361 | 358 |
| 362 if (FLAG_profiler) { | 359 if (FLAG_profiler) { |
| 363 // Shut down profiling. | 360 // Shut down profiling. |
| 364 if (FLAG_trace_shutdown) { | 361 if (FLAG_trace_shutdown) { |
| 365 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n", | 362 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n", |
| 366 timestamp()); | 363 timestamp()); |
| 367 } | 364 } |
| 368 Profiler::Shutdown(); | 365 Profiler::Shutdown(); |
| 369 } | 366 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 TargetCPUFeatures::Cleanup(); | 453 TargetCPUFeatures::Cleanup(); |
| 457 StoreBuffer::ShutDown(); | 454 StoreBuffer::ShutDown(); |
| 458 | 455 |
| 459 // Delete the current thread's TLS and set it's TLS to null. | 456 // Delete the current thread's TLS and set it's TLS to null. |
| 460 // If it is the last thread then the destructor would call | 457 // If it is the last thread then the destructor would call |
| 461 // OSThread::Cleanup. | 458 // OSThread::Cleanup. |
| 462 OSThread* os_thread = OSThread::Current(); | 459 OSThread* os_thread = OSThread::Current(); |
| 463 OSThread::SetCurrent(NULL); | 460 OSThread::SetCurrent(NULL); |
| 464 delete os_thread; | 461 delete os_thread; |
| 465 if (FLAG_trace_shutdown) { | 462 if (FLAG_trace_shutdown) { |
| 466 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n", | 463 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n", timestamp()); |
| 467 timestamp()); | |
| 468 } | 464 } |
| 469 | 465 |
| 470 if (FLAG_trace_shutdown) { | 466 if (FLAG_trace_shutdown) { |
| 471 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting code observers\n", | 467 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting code observers\n", |
| 472 timestamp()); | 468 timestamp()); |
| 473 } | 469 } |
| 474 NOT_IN_PRODUCT(CodeObservers::DeleteAll()); | 470 NOT_IN_PRODUCT(CodeObservers::DeleteAll()); |
| 475 if (FLAG_support_timeline) { | 471 if (FLAG_support_timeline) { |
| 476 if (FLAG_trace_shutdown) { | 472 if (FLAG_trace_shutdown) { |
| 477 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n", | 473 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n", |
| (...skipping 14 matching lines...) Expand all Loading... |
| 492 // Create a new isolate. | 488 // Create a new isolate. |
| 493 Isolate* isolate = Isolate::Init(name_prefix, api_flags); | 489 Isolate* isolate = Isolate::Init(name_prefix, api_flags); |
| 494 return isolate; | 490 return isolate; |
| 495 } | 491 } |
| 496 | 492 |
| 497 | 493 |
| 498 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { | 494 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { |
| 499 // Initialize the new isolate. | 495 // Initialize the new isolate. |
| 500 Thread* T = Thread::Current(); | 496 Thread* T = Thread::Current(); |
| 501 Isolate* I = T->isolate(); | 497 Isolate* I = T->isolate(); |
| 502 NOT_IN_PRODUCT( | 498 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), |
| 503 TimelineDurationScope tds(T, | 499 "InitializeIsolate"); |
| 504 Timeline::GetIsolateStream(), | 500 tds.SetNumArguments(1); |
| 505 "InitializeIsolate"); | 501 tds.CopyArgument(0, "isolateName", I->name());) |
| 506 tds.SetNumArguments(1); | |
| 507 tds.CopyArgument(0, "isolateName", I->name()); | |
| 508 ) | |
| 509 ASSERT(I != NULL); | 502 ASSERT(I != NULL); |
| 510 StackZone zone(T); | 503 StackZone zone(T); |
| 511 HandleScope handle_scope(T); | 504 HandleScope handle_scope(T); |
| 512 { | 505 { |
| 513 NOT_IN_PRODUCT(TimelineDurationScope tds(T, | 506 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), |
| 514 Timeline::GetIsolateStream(), "ObjectStore::Init")); | 507 "ObjectStore::Init")); |
| 515 ObjectStore::Init(I); | 508 ObjectStore::Init(I); |
| 516 } | 509 } |
| 517 | 510 |
| 518 const Error& error = Error::Handle(Object::Init(I)); | 511 const Error& error = Error::Handle(Object::Init(I)); |
| 519 if (!error.IsNull()) { | 512 if (!error.IsNull()) { |
| 520 return error.raw(); | 513 return error.raw(); |
| 521 } | 514 } |
| 522 if (snapshot_buffer != NULL) { | 515 if (snapshot_buffer != NULL) { |
| 523 // Read the snapshot and setup the initial state. | 516 // Read the snapshot and setup the initial state. |
| 524 NOT_IN_PRODUCT(TimelineDurationScope tds(T, | 517 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), |
| 525 Timeline::GetIsolateStream(), "IsolateSnapshotReader")); | 518 "IsolateSnapshotReader")); |
| 526 // TODO(turnidge): Remove once length is not part of the snapshot. | 519 // TODO(turnidge): Remove once length is not part of the snapshot. |
| 527 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); | 520 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); |
| 528 if (snapshot == NULL) { | 521 if (snapshot == NULL) { |
| 529 const String& message = String::Handle( | 522 const String& message = String::Handle(String::New("Invalid snapshot")); |
| 530 String::New("Invalid snapshot")); | |
| 531 return ApiError::New(message); | 523 return ApiError::New(message); |
| 532 } | 524 } |
| 533 ASSERT(Snapshot::IsFull(snapshot->kind())); | 525 ASSERT(Snapshot::IsFull(snapshot->kind())); |
| 534 ASSERT(snapshot->kind() == snapshot_kind_); | 526 ASSERT(snapshot->kind() == snapshot_kind_); |
| 535 if (FLAG_trace_isolates) { | 527 if (FLAG_trace_isolates) { |
| 536 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); | 528 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); |
| 537 } | 529 } |
| 538 IsolateSnapshotReader reader(snapshot->kind(), | 530 IsolateSnapshotReader reader( |
| 539 snapshot->content(), | 531 snapshot->kind(), snapshot->content(), snapshot->length(), |
| 540 snapshot->length(), | 532 Dart::instructions_snapshot_buffer(), Dart::data_snapshot_buffer(), T); |
| 541 Dart::instructions_snapshot_buffer(), | |
| 542 Dart::data_snapshot_buffer(), | |
| 543 T); | |
| 544 const Error& error = Error::Handle(reader.ReadFullSnapshot()); | 533 const Error& error = Error::Handle(reader.ReadFullSnapshot()); |
| 545 if (!error.IsNull()) { | 534 if (!error.IsNull()) { |
| 546 return error.raw(); | 535 return error.raw(); |
| 547 } | 536 } |
| 548 NOT_IN_PRODUCT(if (tds.enabled()) { | 537 #if !defined(PRODUCT) |
| 538 if (tds.enabled()) { |
| 549 tds.SetNumArguments(2); | 539 tds.SetNumArguments(2); |
| 550 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length()); | 540 tds.FormatArgument(0, "snapshotSize", "%" Pd, snapshot->length()); |
| 551 tds.FormatArgument(1, "heapSize", "%" Pd64, | 541 tds.FormatArgument(1, "heapSize", "%" Pd64, |
| 552 I->heap()->UsedInWords(Heap::kOld) * kWordSize); | 542 I->heap()->UsedInWords(Heap::kOld) * kWordSize); |
| 553 }); | 543 } |
| 544 #endif // !defined(PRODUCT) |
| 554 if (FLAG_trace_isolates) { | 545 if (FLAG_trace_isolates) { |
| 555 I->heap()->PrintSizes(); | 546 I->heap()->PrintSizes(); |
| 556 MegamorphicCacheTable::PrintSizes(I); | 547 MegamorphicCacheTable::PrintSizes(I); |
| 557 } | 548 } |
| 558 } else { | 549 } else { |
| 559 if (snapshot_kind_ != Snapshot::kNone) { | 550 if (snapshot_kind_ != Snapshot::kNone) { |
| 560 const String& message = String::Handle( | 551 const String& message = |
| 561 String::New("Missing isolate snapshot")); | 552 String::Handle(String::New("Missing isolate snapshot")); |
| 562 return ApiError::New(message); | 553 return ApiError::New(message); |
| 563 } | 554 } |
| 564 } | 555 } |
| 565 | 556 |
| 566 Object::VerifyBuiltinVtables(); | 557 Object::VerifyBuiltinVtables(); |
| 567 DEBUG_ONLY(I->heap()->Verify(kForbidMarked)); | 558 DEBUG_ONLY(I->heap()->Verify(kForbidMarked)); |
| 568 | 559 |
| 569 { | 560 { |
| 570 NOT_IN_PRODUCT(TimelineDurationScope tds(T, | 561 NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(), |
| 571 Timeline::GetIsolateStream(), "StubCode::Init")); | 562 "StubCode::Init")); |
| 572 StubCode::Init(I); | 563 StubCode::Init(I); |
| 573 } | 564 } |
| 574 | 565 |
| 575 #if !defined(DART_PRECOMPILED_RUNTIME) | 566 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 576 // When running precompiled, the megamorphic miss function/code comes from the | 567 // When running precompiled, the megamorphic miss function/code comes from the |
| 577 // snapshot. | 568 // snapshot. |
| 578 if (!Snapshot::IncludesCode(Dart::snapshot_kind())) { | 569 if (!Snapshot::IncludesCode(Dart::snapshot_kind())) { |
| 579 MegamorphicCacheTable::InitMissHandler(I); | 570 MegamorphicCacheTable::InitMissHandler(I); |
| 580 } | 571 } |
| 581 #endif | 572 #endif |
| (...skipping 13 matching lines...) Expand all Loading... |
| 595 I->set_init_callback_data(data); | 586 I->set_init_callback_data(data); |
| 596 Api::SetupAcquiredError(I); | 587 Api::SetupAcquiredError(I); |
| 597 if (FLAG_print_class_table) { | 588 if (FLAG_print_class_table) { |
| 598 I->class_table()->Print(); | 589 I->class_table()->Print(); |
| 599 } | 590 } |
| 600 | 591 |
| 601 ServiceIsolate::MaybeMakeServiceIsolate(I); | 592 ServiceIsolate::MaybeMakeServiceIsolate(I); |
| 602 if (!ServiceIsolate::IsServiceIsolate(I)) { | 593 if (!ServiceIsolate::IsServiceIsolate(I)) { |
| 603 I->message_handler()->set_should_pause_on_start( | 594 I->message_handler()->set_should_pause_on_start( |
| 604 FLAG_pause_isolates_on_start); | 595 FLAG_pause_isolates_on_start); |
| 605 I->message_handler()->set_should_pause_on_exit( | 596 I->message_handler()->set_should_pause_on_exit(FLAG_pause_isolates_on_exit); |
| 606 FLAG_pause_isolates_on_exit); | |
| 607 } | 597 } |
| 608 ServiceIsolate::SendIsolateStartupMessage(); | 598 ServiceIsolate::SendIsolateStartupMessage(); |
| 609 if (FLAG_support_debugger) { | 599 if (FLAG_support_debugger) { |
| 610 I->debugger()->NotifyIsolateCreated(); | 600 I->debugger()->NotifyIsolateCreated(); |
| 611 } | 601 } |
| 612 // Create tag table. | 602 // Create tag table. |
| 613 I->set_tag_table(GrowableObjectArray::Handle(GrowableObjectArray::New())); | 603 I->set_tag_table(GrowableObjectArray::Handle(GrowableObjectArray::New())); |
| 614 // Set up default UserTag. | 604 // Set up default UserTag. |
| 615 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); | 605 const UserTag& default_tag = UserTag::Handle(UserTag::DefaultTag()); |
| 616 I->set_current_tag(default_tag); | 606 I->set_current_tag(default_tag); |
| 617 | 607 |
| 618 if (FLAG_keep_code) { | 608 if (FLAG_keep_code) { |
| 619 I->set_deoptimized_code_array( | 609 I->set_deoptimized_code_array( |
| 620 GrowableObjectArray::Handle(GrowableObjectArray::New())); | 610 GrowableObjectArray::Handle(GrowableObjectArray::New())); |
| 621 } | 611 } |
| 622 return Error::null(); | 612 return Error::null(); |
| 623 } | 613 } |
| 624 | 614 |
| 625 | 615 |
| 626 const char* Dart::FeaturesString(Snapshot::Kind kind) { | 616 const char* Dart::FeaturesString(Snapshot::Kind kind) { |
| 627 TextBuffer buffer(64); | 617 TextBuffer buffer(64); |
| 628 | 618 |
| 629 // Different fields are included for DEBUG/RELEASE/PRODUCT. | 619 // Different fields are included for DEBUG/RELEASE/PRODUCT. |
| 630 #if defined(DEBUG) | 620 #if defined(DEBUG) |
| 631 buffer.AddString("debug"); | 621 buffer.AddString("debug"); |
| 632 #elif defined(PRODUCT) | 622 #elif defined(PRODUCT) |
| 633 buffer.AddString("product"); | 623 buffer.AddString("product"); |
| 634 #else | 624 #else |
| 635 buffer.AddString("release"); | 625 buffer.AddString("release"); |
| 636 #endif | 626 #endif |
| 637 | 627 |
| 638 if (Snapshot::IncludesCode(kind)) { | 628 if (Snapshot::IncludesCode(kind)) { |
| 639 // Checked mode affects deopt ids. | 629 // Checked mode affects deopt ids. |
| 640 buffer.AddString(FLAG_enable_asserts ? " asserts" : " no-asserts"); | 630 buffer.AddString(FLAG_enable_asserts ? " asserts" : " no-asserts"); |
| 641 buffer.AddString(FLAG_enable_type_checks ? " type-checks" | 631 buffer.AddString(FLAG_enable_type_checks ? " type-checks" |
| 642 : " no-type-checks"); | 632 : " no-type-checks"); |
| 643 | 633 |
| 644 // Generated code must match the host architecture and ABI. | 634 // Generated code must match the host architecture and ABI. |
| 645 #if defined(TARGET_ARCH_ARM) | 635 #if defined(TARGET_ARCH_ARM) |
| 646 #if defined(TARGET_ABI_IOS) | 636 #if defined(TARGET_ABI_IOS) |
| 647 buffer.AddString(" arm-ios"); | 637 buffer.AddString(" arm-ios"); |
| 648 #elif defined(TARGET_ABI_EABI) | 638 #elif defined(TARGET_ABI_EABI) |
| 649 buffer.AddString(" arm-eabi"); | 639 buffer.AddString(" arm-eabi"); |
| 650 #else | 640 #else |
| 651 #error Unknown ABI | 641 #error Unknown ABI |
| 652 #endif | 642 #endif |
| 653 buffer.AddString(TargetCPUFeatures::hardfp_supported() ? " hardfp" | 643 buffer.AddString(TargetCPUFeatures::hardfp_supported() ? " hardfp" |
| 654 : " softfp"); | 644 : " softfp"); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 return predefined_handles_->handles_.IsValidScopedHandle(address); | 719 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 730 } | 720 } |
| 731 | 721 |
| 732 | 722 |
| 733 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 723 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 734 ASSERT(predefined_handles_ != NULL); | 724 ASSERT(predefined_handles_ != NULL); |
| 735 return predefined_handles_->api_handles_.IsValidHandle(handle); | 725 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 736 } | 726 } |
| 737 | 727 |
| 738 } // namespace dart | 728 } // namespace dart |
| OLD | NEW |