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

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

Issue 2044753002: Make compile-time errors catchable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 3 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) 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 159
160 // Compile a function. Should call only if the function has not been compiled. 160 // Compile a function. Should call only if the function has not been compiled.
161 // Arg0: function object. 161 // Arg0: function object.
162 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) { 162 DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
163 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); 163 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
164 ASSERT(!function.HasCode()); 164 ASSERT(!function.HasCode());
165 const Error& error = 165 const Error& error =
166 Error::Handle(Compiler::CompileFunction(thread, function)); 166 Error::Handle(Compiler::CompileFunction(thread, function));
167 if (!error.IsNull()) { 167 if (!error.IsNull()) {
168 if (error.IsLanguageError()) {
169 Exceptions::ThrowSyntaxError(LanguageError::Cast(error));
170 UNREACHABLE();
171 }
168 Exceptions::PropagateError(error); 172 Exceptions::PropagateError(error);
169 } 173 }
170 } 174 }
171 175
172 176
173 bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) { 177 bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
174 if (FLAG_support_debugger) { 178 if (FLAG_support_debugger) {
175 Isolate* isolate = thread->isolate(); 179 Isolate* isolate = thread->isolate();
176 if (isolate->debugger()->IsStepping() || 180 if (isolate->debugger()->IsStepping() ||
177 isolate->debugger()->HasBreakpoint(function, thread->zone())) { 181 isolate->debugger()->HasBreakpoint(function, thread->zone())) {
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 2183
2180 2184
2181 bool BackgroundCompiler::IsDisabled() { 2185 bool BackgroundCompiler::IsDisabled() {
2182 UNREACHABLE(); 2186 UNREACHABLE();
2183 return true; 2187 return true;
2184 } 2188 }
2185 2189
2186 #endif // DART_PRECOMPILED_RUNTIME 2190 #endif // DART_PRECOMPILED_RUNTIME
2187 2191
2188 } // namespace dart 2192 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698