| 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/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } else { | 707 } else { |
| 708 // Pop the previously evaluated result value into RAX. | 708 // Pop the previously evaluated result value into RAX. |
| 709 __ popq(RAX); | 709 __ popq(RAX); |
| 710 } | 710 } |
| 711 | 711 |
| 712 // Generate type check. | 712 // Generate type check. |
| 713 if (FLAG_enable_type_checks) { | 713 if (FLAG_enable_type_checks) { |
| 714 const bool returns_null = node->value()->IsLiteralNode() && | 714 const bool returns_null = node->value()->IsLiteralNode() && |
| 715 node->value()->AsLiteralNode()->literal().IsNull(); | 715 node->value()->AsLiteralNode()->literal().IsNull(); |
| 716 const RawFunction::Kind kind = parsed_function().function().kind(); | 716 const RawFunction::Kind kind = parsed_function().function().kind(); |
| 717 // Implicit getters do not need a type check at return. | 717 const bool is_implicit_getter = |
| 718 if (!returns_null && | 718 (kind == RawFunction::kImplicitGetter) || |
| 719 (kind != RawFunction::kImplicitGetter) && | 719 (kind == RawFunction::kConstImplicitGetter); |
| 720 (kind != RawFunction::kConstImplicitGetter)) { | 720 const bool is_static = parsed_function().function().is_static(); |
| 721 // Implicit getters do not need a type check at return, unless they compute |
| 722 // the initial value of a static field. |
| 723 if (!returns_null && (is_static || !is_implicit_getter)) { |
| 721 GenerateAssertAssignable( | 724 GenerateAssertAssignable( |
| 722 node->id(), | 725 node->id(), |
| 723 node->value()->token_index(), | 726 node->value()->token_index(), |
| 724 AbstractType::ZoneHandle(parsed_function().function().result_type()), | 727 AbstractType::ZoneHandle(parsed_function().function().result_type()), |
| 725 String::ZoneHandle(String::NewSymbol("function result"))); | 728 String::ZoneHandle(String::NewSymbol("function result"))); |
| 726 } | 729 } |
| 727 } | 730 } |
| 728 GenerateReturnEpilog(node); | 731 GenerateReturnEpilog(node); |
| 729 } | 732 } |
| 730 | 733 |
| (...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2715 const Error& error = Error::Handle( | 2718 const Error& error = Error::Handle( |
| 2716 Parser::FormatError(script, token_index, "Error", format, args)); | 2719 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2717 va_end(args); | 2720 va_end(args); |
| 2718 Isolate::Current()->long_jump_base()->Jump(1, error); | 2721 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2719 UNREACHABLE(); | 2722 UNREACHABLE(); |
| 2720 } | 2723 } |
| 2721 | 2724 |
| 2722 } // namespace dart | 2725 } // namespace dart |
| 2723 | 2726 |
| 2724 #endif // defined TARGET_ARCH_X64 | 2727 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |