OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/isolate_reload.h" | 5 #include "vm/isolate_reload.h" |
6 | 6 |
7 #include "vm/become.h" | 7 #include "vm/become.h" |
8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 // 1) Tag Handler is invoked and the embedder is in control. | 483 // 1) Tag Handler is invoked and the embedder is in control. |
484 // 2) All sources and libraries are loaded. | 484 // 2) All sources and libraries are loaded. |
485 // 3) Dart_FinalizeLoading is called by the embedder. | 485 // 3) Dart_FinalizeLoading is called by the embedder. |
486 // 4) Dart_FinalizeLoading invokes IsolateReloadContext::FinalizeLoading | 486 // 4) Dart_FinalizeLoading invokes IsolateReloadContext::FinalizeLoading |
487 // and we are temporarily back in control. | 487 // and we are temporarily back in control. |
488 // This is where we validate the reload and commit or reject. | 488 // This is where we validate the reload and commit or reject. |
489 // 5) Dart_FinalizeLoading invokes Dart code related to deferred libraries. | 489 // 5) Dart_FinalizeLoading invokes Dart code related to deferred libraries. |
490 // 6) The tag handler returns and we move on. | 490 // 6) The tag handler returns and we move on. |
491 // | 491 // |
492 // Even after a successful reload the Dart code invoked in (5) can result | 492 // Even after a successful reload the Dart code invoked in (5) can result |
493 // in an Unwind error or a StackOverflow error. This error will be returned | 493 // in an Unwind error or an UnhandledException error. This error will be |
494 // by the tag handler. The tag handler can return other errors, for example, | 494 // returned by the tag handler. The tag handler can return other errors, |
495 // top level parse errors. We want to capture these errors while propagating | 495 // for example, top level parse errors. We want to capture these errors while |
496 // the Unwind or StackOverflow errors. | 496 // propagating the UnwindError or an UnhandledException error. |
497 Object& result = Object::Handle(thread->zone()); | 497 Object& result = Object::Handle(thread->zone()); |
498 { | 498 { |
499 TransitionVMToNative transition(thread); | 499 TransitionVMToNative transition(thread); |
500 Api::Scope api_scope(thread); | 500 Api::Scope api_scope(thread); |
501 | 501 |
502 Dart_Handle retval = | 502 Dart_Handle retval = |
503 (I->library_tag_handler())(Dart_kScriptTag, | 503 (I->library_tag_handler())(Dart_kScriptTag, |
504 Api::NewHandle(thread, Library::null()), | 504 Api::NewHandle(thread, Library::null()), |
505 Api::NewHandle(thread, root_lib_url.raw())); | 505 Api::NewHandle(thread, root_lib_url.raw())); |
506 result = Api::UnwrapHandle(retval); | 506 result = Api::UnwrapHandle(retval); |
507 } | 507 } |
508 // | 508 // |
509 // WEIRD CONTROL FLOW ENDS. | 509 // WEIRD CONTROL FLOW ENDS. |
510 | 510 |
511 BackgroundCompiler::Enable(); | 511 BackgroundCompiler::Enable(); |
512 | 512 |
513 if (result.IsUnwindError() || | 513 if (result.IsUnwindError() || |
514 (result.raw() == isolate()->object_store()->stack_overflow())) { | 514 result.IsUnhandledException()) { |
515 // When returning from the tag handler with an Unwind error or a | 515 // If the tag handler returns with an UnwindError or an UnhandledException |
516 // StackOverflow error, propagate it and give up. | 516 // error, propagate it and give up. |
517 Exceptions::PropagateError(Error::Cast(result)); | 517 Exceptions::PropagateError(Error::Cast(result)); |
518 UNREACHABLE(); | 518 UNREACHABLE(); |
519 } | 519 } |
520 | 520 |
521 // Other errors (e.g. a parse error) are captured by the reload system. | 521 // Other errors (e.g. a parse error) are captured by the reload system. |
522 if (result.IsError()) { | 522 if (result.IsError()) { |
523 FinalizeFailedLoad(Error::Cast(result)); | 523 FinalizeFailedLoad(Error::Cast(result)); |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 ASSERT(!super_cls.IsNull()); | 1644 ASSERT(!super_cls.IsNull()); |
1645 super_cls.AddDirectSubclass(cls); | 1645 super_cls.AddDirectSubclass(cls); |
1646 } | 1646 } |
1647 } | 1647 } |
1648 } | 1648 } |
1649 } | 1649 } |
1650 | 1650 |
1651 #endif // !PRODUCT | 1651 #endif // !PRODUCT |
1652 | 1652 |
1653 } // namespace dart | 1653 } // namespace dart |
OLD | NEW |