| OLD | NEW |
| 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 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_index_table.h" | 10 #include "vm/code_index_table.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 return CompileFunctionHelper(function, false); | 311 return CompileFunctionHelper(function, false); |
| 312 } | 312 } |
| 313 | 313 |
| 314 | 314 |
| 315 RawError* Compiler::CompileOptimizedFunction(const Function& function) { | 315 RawError* Compiler::CompileOptimizedFunction(const Function& function) { |
| 316 return CompileFunctionHelper(function, true); | 316 return CompileFunctionHelper(function, true); |
| 317 } | 317 } |
| 318 | 318 |
| 319 | 319 |
| 320 RawError* Compiler::CompileAllFunctions(const Class& cls) { | 320 RawError* Compiler::CompileAllFunctions(const Class& cls) { |
| 321 Isolate* isolate = Isolate::Current(); | |
| 322 Error& error = Error::Handle(); | 321 Error& error = Error::Handle(); |
| 323 LongJump* base = isolate->long_jump_base(); | 322 Array& functions = Array::Handle(cls.functions()); |
| 324 LongJump jump; | 323 Function& func = Function::Handle(); |
| 325 isolate->set_long_jump_base(&jump); | 324 for (int i = 0; i < functions.Length(); i++) { |
| 326 if (setjmp(*jump.Set()) == 0) { | 325 func ^= functions.At(i); |
| 327 Array& functions = Array::Handle(cls.functions()); | 326 ASSERT(!func.IsNull()); |
| 328 Function& func = Function::Handle(); | 327 if (!func.HasCode() && !func.IsAbstract()) { |
| 329 for (int i = 0; i < functions.Length(); i++) { | 328 error = CompileFunction(func); |
| 330 func ^= functions.At(i); | 329 if (!error.IsNull()) { |
| 331 ASSERT(!func.IsNull()); | 330 return error.raw(); |
| 332 if (!func.HasCode() && !func.IsAbstract()) { | |
| 333 const Error& error = Error::Handle(CompileFunction(func)); | |
| 334 if (!error.IsNull()) { | |
| 335 return error.raw(); | |
| 336 } | |
| 337 } | 331 } |
| 338 } | 332 } |
| 339 } else { | |
| 340 error = isolate->object_store()->sticky_error(); | |
| 341 isolate->object_store()->clear_sticky_error(); | |
| 342 } | 333 } |
| 343 isolate->set_long_jump_base(base); | |
| 344 return error.raw(); | 334 return error.raw(); |
| 345 } | 335 } |
| 346 | 336 |
| 347 | 337 |
| 348 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { | 338 RawObject* Compiler::ExecuteOnce(SequenceNode* fragment) { |
| 349 Isolate* isolate = Isolate::Current(); | 339 Isolate* isolate = Isolate::Current(); |
| 350 Object& result = Object::Handle(); | 340 Object& result = Object::Handle(); |
| 351 LongJump* base = isolate->long_jump_base(); | 341 LongJump* base = isolate->long_jump_base(); |
| 352 LongJump jump; | 342 LongJump jump; |
| 353 isolate->set_long_jump_base(&jump); | 343 isolate->set_long_jump_base(&jump); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } else { | 396 } else { |
| 407 result = isolate->object_store()->sticky_error(); | 397 result = isolate->object_store()->sticky_error(); |
| 408 isolate->object_store()->clear_sticky_error(); | 398 isolate->object_store()->clear_sticky_error(); |
| 409 } | 399 } |
| 410 isolate->set_long_jump_base(base); | 400 isolate->set_long_jump_base(base); |
| 411 return result.raw(); | 401 return result.raw(); |
| 412 } | 402 } |
| 413 | 403 |
| 414 | 404 |
| 415 } // namespace dart | 405 } // namespace dart |
| OLD | NEW |