| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 | 810 |
| 811 // The function type of a closure may have type arguments. In that case, pass | 811 // The function type of a closure may have type arguments. In that case, pass |
| 812 // the type arguments of the instantiator. | 812 // the type arguments of the instantiator. |
| 813 const Class& cls = Class::Handle(function.signature_class()); | 813 const Class& cls = Class::Handle(function.signature_class()); |
| 814 ASSERT(!cls.IsNull()); | 814 ASSERT(!cls.IsNull()); |
| 815 const bool requires_type_arguments = cls.HasTypeArguments(); | 815 const bool requires_type_arguments = cls.HasTypeArguments(); |
| 816 if (requires_type_arguments) { | 816 if (requires_type_arguments) { |
| 817 ASSERT(!function.IsImplicitStaticClosureFunction()); | 817 ASSERT(!function.IsImplicitStaticClosureFunction()); |
| 818 const bool kPushInstantiator = false; | 818 const bool kPushInstantiator = false; |
| 819 GenerateInstantiatorTypeArguments(node->token_index(), kPushInstantiator); | 819 GenerateInstantiatorTypeArguments(node->token_index(), kPushInstantiator); |
| 820 } else { |
| 821 const Immediate raw_null = |
| 822 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 823 __ pushl(raw_null); // No type arguments. |
| 820 } | 824 } |
| 821 const Code& stub = Code::Handle( | 825 const Code& stub = Code::Handle( |
| 822 StubCode::GetAllocationStubForClosure(function)); | 826 StubCode::GetAllocationStubForClosure(function)); |
| 823 const ExternalLabel label(function.ToCString(), stub.EntryPoint()); | 827 const ExternalLabel label(function.ToCString(), stub.EntryPoint()); |
| 824 GenerateCall(node->token_index(), &label, PcDescriptors::kOther); | 828 GenerateCall(node->token_index(), &label, PcDescriptors::kOther); |
| 825 if (requires_type_arguments) { | 829 __ popl(ECX); // Pop type arguments. |
| 826 __ popl(ECX); // Pop type arguments. | |
| 827 } | |
| 828 if (function.IsImplicitInstanceClosureFunction()) { | 830 if (function.IsImplicitInstanceClosureFunction()) { |
| 829 __ popl(ECX); // Pop receiver. | 831 __ popl(ECX); // Pop receiver. |
| 830 } | 832 } |
| 831 if (IsResultNeeded(node)) { | 833 if (IsResultNeeded(node)) { |
| 832 __ pushl(EAX); | 834 __ pushl(EAX); |
| 833 } | 835 } |
| 834 } | 836 } |
| 835 | 837 |
| 836 | 838 |
| 837 void CodeGenerator::VisitPrimaryNode(PrimaryNode* node) { | 839 void CodeGenerator::VisitPrimaryNode(PrimaryNode* node) { |
| (...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 const Error& error = Error::Handle( | 2973 const Error& error = Error::Handle( |
| 2972 Parser::FormatError(script, token_index, "Error", format, args)); | 2974 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2973 va_end(args); | 2975 va_end(args); |
| 2974 Isolate::Current()->long_jump_base()->Jump(1, error); | 2976 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2975 UNREACHABLE(); | 2977 UNREACHABLE(); |
| 2976 } | 2978 } |
| 2977 | 2979 |
| 2978 } // namespace dart | 2980 } // namespace dart |
| 2979 | 2981 |
| 2980 #endif // defined TARGET_ARCH_IA32 | 2982 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |