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

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

Issue 1263513002: VM: Load allocation-top and -end via Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixed cc tests Created 5 years, 4 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 15 matching lines...) Expand all
26 #include "vm/stub_code.h" 26 #include "vm/stub_code.h"
27 #include "vm/symbols.h" 27 #include "vm/symbols.h"
28 #include "vm/thread_interrupter.h" 28 #include "vm/thread_interrupter.h"
29 #include "vm/thread_pool.h" 29 #include "vm/thread_pool.h"
30 #include "vm/timeline.h" 30 #include "vm/timeline.h"
31 #include "vm/virtual_memory.h" 31 #include "vm/virtual_memory.h"
32 #include "vm/zone.h" 32 #include "vm/zone.h"
33 33
34 namespace dart { 34 namespace dart {
35 35
36 DEFINE_FLAG(int, new_gen_semi_max_size, (kWordSize <= 4) ? 16 : 32,
37 "Max size of new gen semi space in MB");
38 DEFINE_FLAG(int, old_gen_heap_size, 0,
39 "Max size of old gen heap size in MB, or 0 for unlimited,"
40 "e.g: --old_gen_heap_size=1024 allows up to 1024MB old gen heap");
41 DEFINE_FLAG(int, external_max_size, (kWordSize <= 4) ? 512 : 1024,
42 "Max total size of external allocations in MB, or 0 for unlimited,"
43 "e.g: --external_max_size=1024 allows up to 1024MB of externals");
44
45 DEFINE_FLAG(bool, keep_code, false, 36 DEFINE_FLAG(bool, keep_code, false,
46 "Keep deoptimized code for profiling."); 37 "Keep deoptimized code for profiling.");
47
48 DECLARE_FLAG(bool, print_class_table); 38 DECLARE_FLAG(bool, print_class_table);
49 DECLARE_FLAG(bool, trace_isolates); 39 DECLARE_FLAG(bool, trace_isolates);
50 40
51 Isolate* Dart::vm_isolate_ = NULL; 41 Isolate* Dart::vm_isolate_ = NULL;
52 ThreadPool* Dart::thread_pool_ = NULL; 42 ThreadPool* Dart::thread_pool_ = NULL;
53 DebugInfo* Dart::pprof_symbol_generator_ = NULL; 43 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
54 ReadOnlyHandles* Dart::predefined_handles_ = NULL; 44 ReadOnlyHandles* Dart::predefined_handles_ = NULL;
55 45
56 // Structure for managing read-only global handles allocation used for 46 // Structure for managing read-only global handles allocation used for
57 // creating global read-only handles that are pre created and initialized 47 // creating global read-only handles that are pre created and initialized
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const bool is_vm_isolate = true; 112 const bool is_vm_isolate = true;
123 113
124 // Setup default flags for the VM isolate. 114 // Setup default flags for the VM isolate.
125 Isolate::Flags vm_flags; 115 Isolate::Flags vm_flags;
126 Dart_IsolateFlags api_flags; 116 Dart_IsolateFlags api_flags;
127 vm_flags.CopyTo(&api_flags); 117 vm_flags.CopyTo(&api_flags);
128 vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate); 118 vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate);
129 119
130 StackZone zone(vm_isolate_); 120 StackZone zone(vm_isolate_);
131 HandleScope handle_scope(vm_isolate_); 121 HandleScope handle_scope(vm_isolate_);
132 Heap::Init(vm_isolate_,
133 0, // New gen size 0; VM isolate should only allocate in old.
134 FLAG_old_gen_heap_size * MBInWords,
135 FLAG_external_max_size * MBInWords);
136 Object::InitNull(vm_isolate_); 122 Object::InitNull(vm_isolate_);
137 ObjectStore::Init(vm_isolate_); 123 ObjectStore::Init(vm_isolate_);
138 TargetCPUFeatures::InitOnce(); 124 TargetCPUFeatures::InitOnce();
139 Object::InitOnce(vm_isolate_); 125 Object::InitOnce(vm_isolate_);
140 ArgumentsDescriptor::InitOnce(); 126 ArgumentsDescriptor::InitOnce();
141 StubCode::InitOnce(); 127 StubCode::InitOnce();
142 Thread::InitOnceAfterObjectAndStubCode(); 128 Thread::InitOnceAfterObjectAndStubCode();
143 // Now that the needed stub has been generated, set the stack limit. 129 // Now that the needed stub has been generated, set the stack limit.
144 vm_isolate_->InitializeStackLimit(); 130 vm_isolate_->InitializeStackLimit();
145 if (vm_isolate_snapshot != NULL) { 131 if (vm_isolate_snapshot != NULL) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 229 }
244 230
245 231
246 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { 232 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
247 // Initialize the new isolate. 233 // Initialize the new isolate.
248 Isolate* isolate = Isolate::Current(); 234 Isolate* isolate = Isolate::Current();
249 TIMERSCOPE(isolate, time_isolate_initialization); 235 TIMERSCOPE(isolate, time_isolate_initialization);
250 ASSERT(isolate != NULL); 236 ASSERT(isolate != NULL);
251 StackZone zone(isolate); 237 StackZone zone(isolate);
252 HandleScope handle_scope(isolate); 238 HandleScope handle_scope(isolate);
253 Heap::Init(isolate,
254 FLAG_new_gen_semi_max_size * MBInWords,
255 FLAG_old_gen_heap_size * MBInWords,
256 FLAG_external_max_size * MBInWords);
257 ObjectStore::Init(isolate); 239 ObjectStore::Init(isolate);
258 240
259 // Setup for profiling. 241 // Setup for profiling.
260 Profiler::InitProfilingForIsolate(isolate); 242 Profiler::InitProfilingForIsolate(isolate);
261 243
262 const Error& error = Error::Handle(Object::Init(isolate)); 244 const Error& error = Error::Handle(Object::Init(isolate));
263 if (!error.IsNull()) { 245 if (!error.IsNull()) {
264 return error.raw(); 246 return error.raw();
265 } 247 }
266 if (snapshot_buffer != NULL) { 248 if (snapshot_buffer != NULL) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 return predefined_handles_->handles_.IsValidScopedHandle(address); 355 return predefined_handles_->handles_.IsValidScopedHandle(address);
374 } 356 }
375 357
376 358
377 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 359 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
378 ASSERT(predefined_handles_ != NULL); 360 ASSERT(predefined_handles_ != NULL);
379 return predefined_handles_->api_handles_.IsValidHandle(handle); 361 return predefined_handles_->api_handles_.IsValidHandle(handle);
380 } 362 }
381 363
382 } // namespace dart 364 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/heap.h » ('j') | runtime/vm/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698