Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: runtime/vm/dart.cc

Issue 1678203002: Remove more feature in product mode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/code_observers.h" 7 #include "vm/code_observers.h"
8 #include "vm/cpu.h" 8 #include "vm/cpu.h"
9 #include "vm/dart_api_state.h" 9 #include "vm/dart_api_state.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 Dart_GetVMServiceAssetsArchive get_service_assets) { 85 Dart_GetVMServiceAssetsArchive get_service_assets) {
86 // TODO(iposva): Fix race condition here. 86 // TODO(iposva): Fix race condition here.
87 if (vm_isolate_ != NULL || !Flags::Initialized()) { 87 if (vm_isolate_ != NULL || !Flags::Initialized()) {
88 return "VM already initialized or flags not initialized."; 88 return "VM already initialized or flags not initialized.";
89 } 89 }
90 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); 90 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close);
91 Isolate::SetEntropySourceCallback(entropy_source); 91 Isolate::SetEntropySourceCallback(entropy_source);
92 OS::InitOnce(); 92 OS::InitOnce();
93 VirtualMemory::InitOnce(); 93 VirtualMemory::InitOnce();
94 OSThread::InitOnce(); 94 OSThread::InitOnce();
95 Timeline::InitOnce(); 95 if (FLAG_support_timeline) {
96 Timeline::InitOnce();
97 }
98 #ifndef PRODUCT
96 TimelineDurationScope tds(Timeline::GetVMStream(), 99 TimelineDurationScope tds(Timeline::GetVMStream(),
97 "Dart::InitOnce"); 100 "Dart::InitOnce");
101 #endif
98 Isolate::InitOnce(); 102 Isolate::InitOnce();
99 PortMap::InitOnce(); 103 PortMap::InitOnce();
100 FreeListElement::InitOnce(); 104 FreeListElement::InitOnce();
101 Api::InitOnce(); 105 Api::InitOnce();
102 CodeObservers::InitOnce(); 106 CodeObservers::InitOnce();
103 ThreadInterrupter::InitOnce(); 107 if (FLAG_profiler) {
104 Profiler::InitOnce(); 108 ThreadInterrupter::InitOnce();
109 Profiler::InitOnce();
110 }
105 SemiSpace::InitOnce(); 111 SemiSpace::InitOnce();
106 Metric::InitOnce(); 112 Metric::InitOnce();
107 StoreBuffer::InitOnce(); 113 StoreBuffer::InitOnce();
108 MarkingStack::InitOnce(); 114 MarkingStack::InitOnce();
109 115
110 #if defined(USING_SIMULATOR) 116 #if defined(USING_SIMULATOR)
111 Simulator::InitOnce(); 117 Simulator::InitOnce();
112 #endif 118 #endif
113 // Create the read-only handles area. 119 // Create the read-only handles area.
114 ASSERT(predefined_handles_ == NULL); 120 ASSERT(predefined_handles_ == NULL);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate()); 227 ASSERT(Isolate::isolates_list_head_ == Dart::vm_isolate());
222 } 228 }
223 229
224 230
225 const char* Dart::Cleanup() { 231 const char* Dart::Cleanup() {
226 ASSERT(Isolate::Current() == NULL); 232 ASSERT(Isolate::Current() == NULL);
227 if (vm_isolate_ == NULL) { 233 if (vm_isolate_ == NULL) {
228 return "VM already terminated."; 234 return "VM already terminated.";
229 } 235 }
230 236
231 // Shut down profiling. 237 if (FLAG_profiler) {
232 Profiler::Shutdown(); 238 // Shut down profiling.
239 Profiler::Shutdown();
240 }
241
233 242
234 { 243 {
235 // Set the VM isolate as current isolate when shutting down 244 // Set the VM isolate as current isolate when shutting down
236 // Metrics so that we can use a StackZone. 245 // Metrics so that we can use a StackZone.
237 bool result = Thread::EnterIsolate(vm_isolate_); 246 bool result = Thread::EnterIsolate(vm_isolate_);
238 ASSERT(result); 247 ASSERT(result);
239 Metric::Cleanup(); 248 Metric::Cleanup();
240 Thread::ExitIsolate(); 249 Thread::ExitIsolate();
241 } 250 }
242 251
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 delete os_thread; 294 delete os_thread;
286 } else { 295 } else {
287 // Shutdown the service isolate. 296 // Shutdown the service isolate.
288 ServiceIsolate::Shutdown(); 297 ServiceIsolate::Shutdown();
289 298
290 // Disable thread creation. 299 // Disable thread creation.
291 OSThread::DisableOSThreadCreation(); 300 OSThread::DisableOSThreadCreation();
292 } 301 }
293 302
294 CodeObservers::DeleteAll(); 303 CodeObservers::DeleteAll();
295 Timeline::Shutdown(); 304 if (FLAG_support_timeline) {
305 Timeline::Shutdown();
306 }
296 307
297 return NULL; 308 return NULL;
298 } 309 }
299 310
300 311
301 Isolate* Dart::CreateIsolate(const char* name_prefix, 312 Isolate* Dart::CreateIsolate(const char* name_prefix,
302 const Dart_IsolateFlags& api_flags) { 313 const Dart_IsolateFlags& api_flags) {
303 // Create a new isolate. 314 // Create a new isolate.
304 Isolate* isolate = Isolate::Init(name_prefix, api_flags); 315 Isolate* isolate = Isolate::Init(name_prefix, api_flags);
305 return isolate; 316 return isolate;
306 } 317 }
307 318
308 319
309 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { 320 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
310 // Initialize the new isolate. 321 // Initialize the new isolate.
311 Thread* T = Thread::Current(); 322 Thread* T = Thread::Current();
312 Isolate* I = T->isolate(); 323 Isolate* I = T->isolate();
324 #ifndef PRODUCT
313 TimelineDurationScope tds(T, I->GetIsolateStream(), "InitializeIsolate"); 325 TimelineDurationScope tds(T, I->GetIsolateStream(), "InitializeIsolate");
314 tds.SetNumArguments(1); 326 tds.SetNumArguments(1);
315 tds.CopyArgument(0, "isolateName", I->name()); 327 tds.CopyArgument(0, "isolateName", I->name());
316 328 #endif // !PRODUCT
317 ASSERT(I != NULL); 329 ASSERT(I != NULL);
318 StackZone zone(T); 330 StackZone zone(T);
319 HandleScope handle_scope(T); 331 HandleScope handle_scope(T);
320 { 332 {
333 #ifndef PRODUCT
321 TimelineDurationScope tds(T, I->GetIsolateStream(), "ObjectStore::Init"); 334 TimelineDurationScope tds(T, I->GetIsolateStream(), "ObjectStore::Init");
335 #endif // !PRODUCT
322 ObjectStore::Init(I); 336 ObjectStore::Init(I);
323 } 337 }
324 338
325 const Error& error = Error::Handle(Object::Init(I)); 339 const Error& error = Error::Handle(Object::Init(I));
326 if (!error.IsNull()) { 340 if (!error.IsNull()) {
327 return error.raw(); 341 return error.raw();
328 } 342 }
329 if (snapshot_buffer != NULL) { 343 if (snapshot_buffer != NULL) {
330 // Read the snapshot and setup the initial state. 344 // Read the snapshot and setup the initial state.
345 #ifndef PRODUCT
331 TimelineDurationScope tds( 346 TimelineDurationScope tds(
332 T, I->GetIsolateStream(), "IsolateSnapshotReader"); 347 T, I->GetIsolateStream(), "IsolateSnapshotReader");
348 #endif // !PRODUCT
333 // TODO(turnidge): Remove once length is not part of the snapshot. 349 // TODO(turnidge): Remove once length is not part of the snapshot.
334 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); 350 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer);
335 if (snapshot == NULL) { 351 if (snapshot == NULL) {
336 const String& message = String::Handle( 352 const String& message = String::Handle(
337 String::New("Invalid snapshot.")); 353 String::New("Invalid snapshot."));
338 return ApiError::New(message); 354 return ApiError::New(message);
339 } 355 }
340 ASSERT(snapshot->kind() == Snapshot::kFull); 356 ASSERT(snapshot->kind() == Snapshot::kFull);
341 if (FLAG_trace_isolates) { 357 if (FLAG_trace_isolates) {
342 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); 358 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
(...skipping 17 matching lines...) Expand all
360 // read into the VM isolate. 376 // read into the VM isolate.
361 Symbols::AddPredefinedSymbolsToIsolate(); 377 Symbols::AddPredefinedSymbolsToIsolate();
362 } 378 }
363 379
364 Object::VerifyBuiltinVtables(); 380 Object::VerifyBuiltinVtables();
365 #if defined(DEBUG) 381 #if defined(DEBUG)
366 I->heap()->Verify(kForbidMarked); 382 I->heap()->Verify(kForbidMarked);
367 #endif 383 #endif
368 384
369 { 385 {
386 #ifndef PRODUCT
370 TimelineDurationScope tds(T, I->GetIsolateStream(), "StubCode::Init"); 387 TimelineDurationScope tds(T, I->GetIsolateStream(), "StubCode::Init");
388 #endif // !PRODUCT
371 StubCode::Init(I); 389 StubCode::Init(I);
372 } 390 }
373 391
374 // When running precompiled, the megamorphic miss function/code comes from the 392 // When running precompiled, the megamorphic miss function/code comes from the
375 // snapshot. 393 // snapshot.
376 if (!Dart::IsRunningPrecompiledCode()) { 394 if (!Dart::IsRunningPrecompiledCode()) {
377 MegamorphicCacheTable::InitMissHandler(I); 395 MegamorphicCacheTable::InitMissHandler(I);
378 } 396 }
379 const Code& miss_code = 397 const Code& miss_code =
380 Code::Handle(I->object_store()->megamorphic_miss_code()); 398 Code::Handle(I->object_store()->megamorphic_miss_code());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 return predefined_handles_->handles_.IsValidScopedHandle(address); 485 return predefined_handles_->handles_.IsValidScopedHandle(address);
468 } 486 }
469 487
470 488
471 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 489 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
472 ASSERT(predefined_handles_ != NULL); 490 ASSERT(predefined_handles_ != NULL);
473 return predefined_handles_->api_handles_.IsValidHandle(handle); 491 return predefined_handles_->api_handles_.IsValidHandle(handle);
474 } 492 }
475 493
476 } // namespace dart 494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698