| 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 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } else { | 541 } else { |
| 542 function.set_unoptimized_code(code); | 542 function.set_unoptimized_code(code); |
| 543 function.SetCode(code); | 543 function.SetCode(code); |
| 544 ASSERT(CodePatcher::CodeIsPatchable(code)); | 544 ASSERT(CodePatcher::CodeIsPatchable(code)); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 is_compiled = true; | 547 is_compiled = true; |
| 548 done = true; | 548 done = true; |
| 549 } else { | 549 } else { |
| 550 // We bailed out. | 550 // We bailed out. |
| 551 const Error& bailout_error = Error::Handle( | |
| 552 isolate->object_store()->sticky_error()); | |
| 553 | 551 |
| 554 ASSERT(bailout_error.IsLanguageError()); | 552 if (isolate->object_store()->sticky_error() == |
| 555 const LanguageError& le = LanguageError::CheckedHandle( | 553 Object::branch_offset_error().raw()) { |
| 556 isolate->object_store()->sticky_error()); | 554 // Compilation failed due to an out of range branch offset in the |
| 557 const String& msg = String::Handle(le.message()); | 555 // assembler. We try again (done = false) with far branches enabled. |
| 558 if (msg.Equals("Branch offset overflow")) { | |
| 559 done = false; | 556 done = false; |
| 560 ASSERT(!use_far_branches); | 557 ASSERT(!use_far_branches); |
| 561 use_far_branches = true; | 558 use_far_branches = true; |
| 562 } else { | 559 } else { |
| 563 // If not for a branch offset overflow, we only bail out from | 560 // If the error isn't due to an out of range branch offset, we don't |
| 564 // generating ssa code. | 561 // try again (done = true), and indicate that we did not finish |
| 562 // compiling (is_compiled = false). |
| 565 if (FLAG_trace_bailout) { | 563 if (FLAG_trace_bailout) { |
| 564 const Error& bailout_error = Error::Handle( |
| 565 isolate->object_store()->sticky_error()); |
| 566 OS::Print("%s\n", bailout_error.ToErrorCString()); | 566 OS::Print("%s\n", bailout_error.ToErrorCString()); |
| 567 } | 567 } |
| 568 done = true; | 568 done = true; |
| 569 ASSERT(optimized); | 569 ASSERT(optimized); |
| 570 } | 570 } |
| 571 | 571 |
| 572 isolate->object_store()->clear_sticky_error(); | 572 isolate->object_store()->clear_sticky_error(); |
| 573 is_compiled = false; | 573 is_compiled = false; |
| 574 } | 574 } |
| 575 // Reset global isolate state. | 575 // Reset global isolate state. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 Object::Handle(isolate->object_store()->sticky_error()); | 908 Object::Handle(isolate->object_store()->sticky_error()); |
| 909 isolate->object_store()->clear_sticky_error(); | 909 isolate->object_store()->clear_sticky_error(); |
| 910 isolate->set_long_jump_base(base); | 910 isolate->set_long_jump_base(base); |
| 911 return result.raw(); | 911 return result.raw(); |
| 912 } | 912 } |
| 913 UNREACHABLE(); | 913 UNREACHABLE(); |
| 914 return Object::null(); | 914 return Object::null(); |
| 915 } | 915 } |
| 916 | 916 |
| 917 } // namespace dart | 917 } // namespace dart |
| OLD | NEW |