| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 } else { | 698 } else { |
| 699 __ LoadObject(EAX, literal); | 699 __ LoadObject(EAX, literal); |
| 700 } | 700 } |
| 701 } else { | 701 } else { |
| 702 // Pop the previously evaluated result value into EAX. | 702 // Pop the previously evaluated result value into EAX. |
| 703 __ popl(EAX); | 703 __ popl(EAX); |
| 704 } | 704 } |
| 705 | 705 |
| 706 // Generate type check. | 706 // Generate type check. |
| 707 if (FLAG_enable_type_checks) { | 707 if (FLAG_enable_type_checks) { |
| 708 const bool returns_null = node->value()->IsLiteralNode() && |
| 709 node->value()->AsLiteralNode()->literal().IsNull(); |
| 708 const RawFunction::Kind kind = parsed_function().function().kind(); | 710 const RawFunction::Kind kind = parsed_function().function().kind(); |
| 709 // Implicit getters do not need a type check at return. | 711 // Implicit getters do not need a type check at return. |
| 710 if ((kind != RawFunction::kImplicitGetter) && | 712 if (!returns_null && |
| 713 (kind != RawFunction::kImplicitGetter) && |
| 711 (kind != RawFunction::kConstImplicitGetter)) { | 714 (kind != RawFunction::kConstImplicitGetter)) { |
| 712 GenerateAssertAssignable( | 715 GenerateAssertAssignable( |
| 713 node->id(), | 716 node->id(), |
| 714 node->value()->token_index(), | 717 node->value()->token_index(), |
| 715 AbstractType::ZoneHandle(parsed_function().function().result_type()), | 718 AbstractType::ZoneHandle(parsed_function().function().result_type()), |
| 716 String::ZoneHandle(String::NewSymbol("function result"))); | 719 String::ZoneHandle(String::NewSymbol("function result"))); |
| 717 } | 720 } |
| 718 } | 721 } |
| 719 GenerateReturnEpilog(node); | 722 GenerateReturnEpilog(node); |
| 720 } | 723 } |
| (...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2697 const Error& error = Error::Handle( | 2700 const Error& error = Error::Handle( |
| 2698 Parser::FormatError(script, token_index, "Error", format, args)); | 2701 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2699 va_end(args); | 2702 va_end(args); |
| 2700 Isolate::Current()->long_jump_base()->Jump(1, error); | 2703 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2701 UNREACHABLE(); | 2704 UNREACHABLE(); |
| 2702 } | 2705 } |
| 2703 | 2706 |
| 2704 } // namespace dart | 2707 } // namespace dart |
| 2705 | 2708 |
| 2706 #endif // defined TARGET_ARCH_IA32 | 2709 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |