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

Side by Side Diff: runtime/bin/dfe.cc

Issue 2947243002: Revert "Load service isolate from a .dill file." (Closed)
Patch Set: Created 3 years, 6 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/bin/dfe.h ('k') | runtime/bin/main.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 "bin/dfe.h" 5 #include "bin/dfe.h"
6 #include "bin/dartutils.h" 6 #include "bin/dartutils.h"
7 #include "bin/error_exit.h" 7 #include "bin/error_exit.h"
8 #include "bin/file.h" 8 #include "bin/file.h"
9 9
10 #include "vm/kernel.h" 10 #include "vm/kernel.h"
11 11
12 namespace dart { 12 namespace dart {
13 namespace bin { 13 namespace bin {
14 14
15 const char kPlatformBinaryName[] = "platform.dill"; 15 const char kPlatformBinaryName[] = "platform.dill";
16 const char kVMServiceIOBinaryName[] = "vmservice_io.dill";
17 16
18 17
19 DFE::DFE() 18 DFE::DFE()
20 : frontend_filename_(NULL), 19 : frontend_filename_(NULL),
21 platform_binary_filename_(NULL), 20 platform_binary_filename_(NULL),
22 vmservice_io_binary_filename_(NULL), 21 kernel_platform_(NULL) {}
23 kernel_platform_(NULL),
24 kernel_vmservice_io_(NULL) {}
25 22
26 23
27 DFE::~DFE() { 24 DFE::~DFE() {
28 frontend_filename_ = NULL; 25 frontend_filename_ = NULL;
29 26
30 if (platform_binary_filename_ != NULL) { 27 if (platform_binary_filename_ != NULL) {
31 delete platform_binary_filename_; 28 delete platform_binary_filename_;
32 platform_binary_filename_ = NULL; 29 platform_binary_filename_ = NULL;
33 } 30 }
34 31
35 if (kernel_platform_ != NULL) { 32 if (kernel_platform_ != NULL) {
36 delete reinterpret_cast<kernel::Program*>(kernel_platform_); 33 delete reinterpret_cast<kernel::Program*>(kernel_platform_);
37 kernel_platform_ = NULL; 34 kernel_platform_ = NULL;
38 } 35 }
39
40 if (kernel_vmservice_io_ != NULL) {
41 delete reinterpret_cast<kernel::Program*>(kernel_vmservice_io_);
42 kernel_vmservice_io_ = NULL;
43 }
44 } 36 }
45 37
46 38
47 void DFE::SetKernelBinaries(const char* name) { 39 void DFE::SetKernelBinaries(const char* name) {
48 intptr_t len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(), 40 intptr_t len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(),
49 kPlatformBinaryName) + 41 kPlatformBinaryName) +
50 1; 42 1;
51 platform_binary_filename_ = new char[len]; 43 platform_binary_filename_ = new char[len];
52 snprintf(platform_binary_filename_, len, "%s%s%s", name, 44 snprintf(platform_binary_filename_, len, "%s%s%s", name,
53 File::PathSeparator(), kPlatformBinaryName); 45 File::PathSeparator(), kPlatformBinaryName);
54
55 len = snprintf(NULL, 0, "%s%s%s", name, File::PathSeparator(),
56 kVMServiceIOBinaryName) +
57 1;
58 vmservice_io_binary_filename_ = new char[len];
59 snprintf(vmservice_io_binary_filename_, len, "%s%s%s", name,
60 File::PathSeparator(), kVMServiceIOBinaryName);
61 } 46 }
62 47
63 48
64 Dart_Handle DFE::ReloadScript(Dart_Isolate isolate, const char* url_string) { 49 Dart_Handle DFE::ReloadScript(Dart_Isolate isolate, const char* url_string) {
65 ASSERT(!Dart_IsServiceIsolate(isolate) && !Dart_IsKernelIsolate(isolate)); 50 ASSERT(!Dart_IsServiceIsolate(isolate) && !Dart_IsKernelIsolate(isolate));
66 // First check if the URL points to a Kernel IR file in which case we 51 // First check if the URL points to a Kernel IR file in which case we
67 // skip the compilation step and directly reload the file. 52 // skip the compilation step and directly reload the file.
68 const uint8_t* kernel_ir = NULL; 53 const uint8_t* kernel_ir = NULL;
69 intptr_t kernel_ir_size = -1; 54 intptr_t kernel_ir_size = -1;
70 if (!TryReadKernelFile(url_string, &kernel_ir, &kernel_ir_size)) { 55 if (!TryReadKernelFile(url_string, &kernel_ir, &kernel_ir_size)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 102 }
118 return NULL; 103 return NULL;
119 } 104 }
120 105
121 106
122 void* DFE::ReadPlatform() { 107 void* DFE::ReadPlatform() {
123 return kernel_platform_ = ReadScript(platform_binary_filename_); 108 return kernel_platform_ = ReadScript(platform_binary_filename_);
124 } 109 }
125 110
126 111
127 void* DFE::ReadVMServiceIO() {
128 return kernel_vmservice_io_ = ReadScript(vmservice_io_binary_filename_);
129 }
130
131
132 void* DFE::ReadScript(const char* script_uri) { 112 void* DFE::ReadScript(const char* script_uri) {
133 const uint8_t* buffer = NULL; 113 const uint8_t* buffer = NULL;
134 intptr_t buffer_length = -1; 114 intptr_t buffer_length = -1;
135 bool result = TryReadKernelFile(script_uri, &buffer, &buffer_length); 115 bool result = TryReadKernelFile(script_uri, &buffer, &buffer_length);
136 if (result) { 116 if (result) {
137 return Dart_ReadKernelBinary(buffer, buffer_length); 117 return Dart_ReadKernelBinary(buffer, buffer_length);
138 } 118 }
139 return NULL; 119 return NULL;
140 } 120 }
141 121
(...skipping 27 matching lines...) Expand all
169 return true; 149 return true;
170 } 150 }
171 } 151 }
172 } 152 }
173 return false; 153 return false;
174 } 154 }
175 155
176 156
177 } // namespace bin 157 } // namespace bin
178 } // namespace dart 158 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dfe.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698