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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 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
« no previous file with comments | « runtime/vm/bootstrap_natives.cc ('k') | runtime/vm/branch_optimizer.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/bootstrap.h" 5 #include "vm/bootstrap.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #if !defined(DART_PRECOMPILED_RUNTIME) 9 #if !defined(DART_PRECOMPILED_RUNTIME)
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/kernel_reader.h" 12 #include "vm/kernel_reader.h"
13 #endif 13 #endif
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #if !defined(DART_PRECOMPILED_RUNTIME) 15 #if !defined(DART_PRECOMPILED_RUNTIME)
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #endif 17 #endif
18 18
19 namespace dart { 19 namespace dart {
20 20
21 #if !defined(DART_PRECOMPILED_RUNTIME) 21 #if !defined(DART_PRECOMPILED_RUNTIME)
22 #define MAKE_PROPERTIES(CamelName, name) \ 22 #define MAKE_PROPERTIES(CamelName, name) \
23 {ObjectStore::k##CamelName, "dart:" #name}, 23 {ObjectStore::k##CamelName, "dart:" #name},
24 24
25
26 struct BootstrapLibProps { 25 struct BootstrapLibProps {
27 ObjectStore::BootstrapLibraryId index; 26 ObjectStore::BootstrapLibraryId index;
28 const char* uri; 27 const char* uri;
29 }; 28 };
30 29
31
32 static BootstrapLibProps bootstrap_libraries[] = { 30 static BootstrapLibProps bootstrap_libraries[] = {
33 FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)}; 31 FOR_EACH_BOOTSTRAP_LIBRARY(MAKE_PROPERTIES)};
34 32
35
36 #undef MAKE_PROPERTIES 33 #undef MAKE_PROPERTIES
37 34
38
39 static const intptr_t bootstrap_library_count = ARRAY_SIZE(bootstrap_libraries); 35 static const intptr_t bootstrap_library_count = ARRAY_SIZE(bootstrap_libraries);
40 36
41
42 void Finish(Thread* thread, bool from_kernel) { 37 void Finish(Thread* thread, bool from_kernel) {
43 Bootstrap::SetupNativeResolver(); 38 Bootstrap::SetupNativeResolver();
44 ClassFinalizer::ProcessPendingClasses(from_kernel); 39 ClassFinalizer::ProcessPendingClasses(from_kernel);
45 40
46 // Eagerly compile the _Closure class as it is the class of all closure 41 // Eagerly compile the _Closure class as it is the class of all closure
47 // instances. This allows us to just finalize function types without going 42 // instances. This allows us to just finalize function types without going
48 // through the hoops of trying to compile their scope class. 43 // through the hoops of trying to compile their scope class.
49 ObjectStore* object_store = thread->isolate()->object_store(); 44 ObjectStore* object_store = thread->isolate()->object_store();
50 Zone* zone = thread->zone(); 45 Zone* zone = thread->zone();
51 Class& cls = Class::Handle(zone, object_store->closure_class()); 46 Class& cls = Class::Handle(zone, object_store->closure_class());
(...skipping 12 matching lines...) Expand all
64 ASSERT(field.Offset() == Closure::function_offset()); 59 ASSERT(field.Offset() == Closure::function_offset());
65 field ^= fields.At(3); 60 field ^= fields.At(3);
66 ASSERT(field.Offset() == Closure::context_offset()); 61 ASSERT(field.Offset() == Closure::context_offset());
67 #endif // defined(DEBUG) 62 #endif // defined(DEBUG)
68 63
69 // Eagerly compile Bool class, bool constants are used from within compiler. 64 // Eagerly compile Bool class, bool constants are used from within compiler.
70 cls = object_store->bool_class(); 65 cls = object_store->bool_class();
71 Compiler::CompileClass(cls); 66 Compiler::CompileClass(cls);
72 } 67 }
73 68
74
75 RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) { 69 RawError* BootstrapFromKernel(Thread* thread, kernel::Program* program) {
76 Zone* zone = thread->zone(); 70 Zone* zone = thread->zone();
77 kernel::KernelReader reader(program); 71 kernel::KernelReader reader(program);
78 Isolate* isolate = thread->isolate(); 72 Isolate* isolate = thread->isolate();
79 // Mark the already-pending classes. This mark bit will be used to avoid 73 // Mark the already-pending classes. This mark bit will be used to avoid
80 // adding classes to the list more than once. 74 // adding classes to the list more than once.
81 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle( 75 GrowableObjectArray& pending_classes = GrowableObjectArray::Handle(
82 zone, isolate->object_store()->pending_classes()); 76 zone, isolate->object_store()->pending_classes());
83 dart::Class& pending = dart::Class::Handle(zone); 77 dart::Class& pending = dart::Class::Handle(zone);
84 for (intptr_t i = 0; i < pending_classes.Length(); ++i) { 78 for (intptr_t i = 0; i < pending_classes.Length(); ++i) {
(...skipping 26 matching lines...) Expand all
111 reader.ReadProgram(); 105 reader.ReadProgram();
112 106
113 // The builtin library should be registered with the VM. 107 // The builtin library should be registered with the VM.
114 dart_name = String::New("dart:_builtin"); 108 dart_name = String::New("dart:_builtin");
115 library = Library::LookupLibrary(thread, dart_name); 109 library = Library::LookupLibrary(thread, dart_name);
116 isolate->object_store()->set_builtin_library(library); 110 isolate->object_store()->set_builtin_library(library);
117 111
118 return Error::null(); 112 return Error::null();
119 } 113 }
120 114
121
122 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { 115 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) {
123 Thread* thread = Thread::Current(); 116 Thread* thread = Thread::Current();
124 Isolate* isolate = thread->isolate(); 117 Isolate* isolate = thread->isolate();
125 Zone* zone = thread->zone(); 118 Zone* zone = thread->zone();
126 String& uri = String::Handle(zone); 119 String& uri = String::Handle(zone);
127 Library& lib = Library::Handle(zone); 120 Library& lib = Library::Handle(zone);
128 121
129 HANDLESCOPE(thread); 122 HANDLESCOPE(thread);
130 123
131 // Ensure there are library objects for all the bootstrap libraries. 124 // Ensure there are library objects for all the bootstrap libraries.
(...skipping 13 matching lines...) Expand all
145 return BootstrapFromKernel(thread, program); 138 return BootstrapFromKernel(thread, program);
146 } 139 }
147 #else 140 #else
148 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) { 141 RawError* Bootstrap::DoBootstrapping(kernel::Program* program) {
149 UNREACHABLE(); 142 UNREACHABLE();
150 return Error::null(); 143 return Error::null();
151 } 144 }
152 #endif // !defined(DART_PRECOMPILED_RUNTIME) 145 #endif // !defined(DART_PRECOMPILED_RUNTIME)
153 146
154 } // namespace dart 147 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.cc ('k') | runtime/vm/branch_optimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698