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

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

Issue 1225933002: Remove fixed contant pool entries by caching some global constants in Thread (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comments Created 5 years, 5 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Dart_FileCloseCallback file_close, 88 Dart_FileCloseCallback file_close,
89 Dart_EntropySource entropy_source) { 89 Dart_EntropySource entropy_source) {
90 // TODO(iposva): Fix race condition here. 90 // TODO(iposva): Fix race condition here.
91 if (vm_isolate_ != NULL || !Flags::Initialized()) { 91 if (vm_isolate_ != NULL || !Flags::Initialized()) {
92 return "VM already initialized or flags not initialized."; 92 return "VM already initialized or flags not initialized.";
93 } 93 }
94 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); 94 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close);
95 Isolate::SetEntropySourceCallback(entropy_source); 95 Isolate::SetEntropySourceCallback(entropy_source);
96 OS::InitOnce(); 96 OS::InitOnce();
97 VirtualMemory::InitOnce(); 97 VirtualMemory::InitOnce();
98 Thread::InitOnce(); 98 Thread::InitOnceBeforeIsolate();
99 Isolate::InitOnce(); 99 Isolate::InitOnce();
100 PortMap::InitOnce(); 100 PortMap::InitOnce();
101 FreeListElement::InitOnce(); 101 FreeListElement::InitOnce();
102 Api::InitOnce(); 102 Api::InitOnce();
103 CodeObservers::InitOnce(); 103 CodeObservers::InitOnce();
104 ThreadInterrupter::InitOnce(); 104 ThreadInterrupter::InitOnce();
105 Profiler::InitOnce(); 105 Profiler::InitOnce();
106 SemiSpace::InitOnce(); 106 SemiSpace::InitOnce();
107 Metric::InitOnce(); 107 Metric::InitOnce();
108 StoreBuffer::InitOnce(); 108 StoreBuffer::InitOnce();
109 109
110 #if defined(USING_SIMULATOR) 110 #if defined(USING_SIMULATOR)
111 Simulator::InitOnce(); 111 Simulator::InitOnce();
112 #endif 112 #endif
113 // Create the read-only handles area. 113 // Create the read-only handles area.
114 ASSERT(predefined_handles_ == NULL); 114 ASSERT(predefined_handles_ == NULL);
115 predefined_handles_ = new ReadOnlyHandles(); 115 predefined_handles_ = new ReadOnlyHandles();
116 // Create the VM isolate and finish the VM initialization. 116 // Create the VM isolate and finish the VM initialization.
117 ASSERT(thread_pool_ == NULL); 117 ASSERT(thread_pool_ == NULL);
118 thread_pool_ = new ThreadPool(); 118 thread_pool_ = new ThreadPool();
119 { 119 {
120 ASSERT(vm_isolate_ == NULL); 120 ASSERT(vm_isolate_ == NULL);
121 ASSERT(Flags::Initialized()); 121 ASSERT(Flags::Initialized());
122 const bool is_vm_isolate = true; 122 const bool is_vm_isolate = true;
123 Thread::EnsureInit();
124 123
125 // Setup default flags for the VM isolate. 124 // Setup default flags for the VM isolate.
126 Isolate::Flags vm_flags; 125 Isolate::Flags vm_flags;
127 Dart_IsolateFlags api_flags; 126 Dart_IsolateFlags api_flags;
128 vm_flags.CopyTo(&api_flags); 127 vm_flags.CopyTo(&api_flags);
129 vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate); 128 vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate);
130 129
131 StackZone zone(vm_isolate_); 130 StackZone zone(vm_isolate_);
132 HandleScope handle_scope(vm_isolate_); 131 HandleScope handle_scope(vm_isolate_);
133 Heap::Init(vm_isolate_, 132 Heap::Init(vm_isolate_,
134 0, // New gen size 0; VM isolate should only allocate in old. 133 0, // New gen size 0; VM isolate should only allocate in old.
135 FLAG_old_gen_heap_size * MBInWords, 134 FLAG_old_gen_heap_size * MBInWords,
136 FLAG_external_max_size * MBInWords); 135 FLAG_external_max_size * MBInWords);
137 Object::InitNull(vm_isolate_); 136 Object::InitNull(vm_isolate_);
138 ObjectStore::Init(vm_isolate_); 137 ObjectStore::Init(vm_isolate_);
139 TargetCPUFeatures::InitOnce(); 138 TargetCPUFeatures::InitOnce();
140 Object::InitOnce(vm_isolate_); 139 Object::InitOnce(vm_isolate_);
141 ArgumentsDescriptor::InitOnce(); 140 ArgumentsDescriptor::InitOnce();
142 StubCode::InitOnce(); 141 StubCode::InitOnce();
142 Thread::InitOnceAfterObjectAndStubCode();
143 // Now that the needed stub has been generated, set the stack limit. 143 // Now that the needed stub has been generated, set the stack limit.
144 vm_isolate_->InitializeStackLimit(); 144 vm_isolate_->InitializeStackLimit();
145 if (vm_isolate_snapshot != NULL) { 145 if (vm_isolate_snapshot != NULL) {
146 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); 146 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot);
147 if (snapshot == NULL) { 147 if (snapshot == NULL) {
148 return "Invalid vm isolate snapshot seen."; 148 return "Invalid vm isolate snapshot seen.";
149 } 149 }
150 ASSERT(snapshot->kind() == Snapshot::kFull); 150 ASSERT(snapshot->kind() == Snapshot::kFull);
151 VmIsolateSnapshotReader reader(snapshot->content(), 151 VmIsolateSnapshotReader reader(snapshot->content(),
152 snapshot->length(), 152 snapshot->length(),
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 return predefined_handles_->handles_.IsValidScopedHandle(address); 373 return predefined_handles_->handles_.IsValidScopedHandle(address);
374 } 374 }
375 375
376 376
377 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 377 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
378 ASSERT(predefined_handles_ != NULL); 378 ASSERT(predefined_handles_ != NULL);
379 return predefined_handles_->api_handles_.IsValidHandle(handle); 379 return predefined_handles_->api_handles_.IsValidHandle(handle);
380 } 380 }
381 381
382 } // namespace dart 382 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/stub_code.h » ('j') | runtime/vm/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698