OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 5807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5818 __ andl(EDX, Immediate( | 5818 __ andl(EDX, Immediate( |
5819 Smi::RawValue(true_value) - Smi::RawValue(false_value))); | 5819 Smi::RawValue(true_value) - Smi::RawValue(false_value))); |
5820 if (false_value != 0) { | 5820 if (false_value != 0) { |
5821 __ addl(EDX, Immediate(Smi::RawValue(false_value))); | 5821 __ addl(EDX, Immediate(Smi::RawValue(false_value))); |
5822 } | 5822 } |
5823 } | 5823 } |
5824 } | 5824 } |
5825 | 5825 |
5826 | 5826 |
5827 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { | 5827 LocationSummary* ClosureCallInstr::MakeLocationSummary(bool opt) const { |
5828 const intptr_t kNumInputs = 0; | 5828 return MakeCallSummary(); |
5829 const intptr_t kNumTemps = 1; | |
5830 LocationSummary* result = | |
5831 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
5832 result->set_out(0, Location::RegisterLocation(EAX)); | |
5833 result->set_temp(0, Location::RegisterLocation(EDX)); // Arg. descriptor. | |
5834 return result; | |
5835 } | 5829 } |
5836 | 5830 |
5837 | 5831 |
5838 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5832 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5839 // The arguments to the stub include the closure, as does the arguments | 5833 // Load closure object (first argument) in EDI. |
5840 // descriptor. | 5834 intptr_t argument_count = ArgumentCount(); |
5841 Register temp_reg = locs()->temp(0).reg(); | 5835 __ movl(EDI, Address(ESP, (argument_count - 1) * kWordSize)); |
5842 int argument_count = ArgumentCount(); | 5836 |
| 5837 // Load arguments descriptors. |
5843 const Array& arguments_descriptor = | 5838 const Array& arguments_descriptor = |
5844 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 5839 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
5845 argument_names())); | 5840 argument_names())); |
5846 __ LoadObject(temp_reg, arguments_descriptor); | 5841 __ LoadObject(EDX, arguments_descriptor); |
5847 ASSERT(temp_reg == EDX); | 5842 |
5848 compiler->GenerateDartCall(deopt_id(), | 5843 // Load the closure function into EAX. |
5849 token_pos(), | 5844 __ movl(EAX, FieldAddress(EDI, Closure::function_offset())); |
5850 &StubCode::CallClosureFunctionLabel(), | 5845 |
5851 PcDescriptors::kClosureCall, | 5846 // Load closure context in CTX; note that CTX has already been preserved. |
5852 locs()); | 5847 __ movl(CTX, FieldAddress(EDI, Closure::context_offset())); |
| 5848 |
| 5849 // EBX: Code (compiled code or lazy compile stub). |
| 5850 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); |
| 5851 |
| 5852 // EAX: Function. |
| 5853 // EDX: Arguments descriptor array. |
| 5854 // ECX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
| 5855 __ xorl(ECX, ECX); |
| 5856 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset())); |
| 5857 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); |
| 5858 __ call(EBX); |
| 5859 compiler->AddCurrentDescriptor(PcDescriptors::kClosureCall, |
| 5860 deopt_id(), |
| 5861 token_pos()); |
| 5862 compiler->RecordSafepoint(locs()); |
| 5863 // Marks either the continuation point in unoptimized code or the |
| 5864 // deoptimization point in optimized code, after call. |
| 5865 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id()); |
| 5866 if (compiler->is_optimizing()) { |
| 5867 compiler->AddDeoptIndexAtCall(deopt_id_after, token_pos()); |
| 5868 } else { |
| 5869 // Add deoptimization continuation point after the call and before the |
| 5870 // arguments are removed. |
| 5871 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
| 5872 deopt_id_after, |
| 5873 token_pos()); |
| 5874 } |
5853 __ Drop(argument_count); | 5875 __ Drop(argument_count); |
5854 } | 5876 } |
5855 | 5877 |
5856 | 5878 |
5857 LocationSummary* BooleanNegateInstr::MakeLocationSummary(bool opt) const { | 5879 LocationSummary* BooleanNegateInstr::MakeLocationSummary(bool opt) const { |
5858 return LocationSummary::Make(1, | 5880 return LocationSummary::Make(1, |
5859 Location::RequiresRegister(), | 5881 Location::RequiresRegister(), |
5860 LocationSummary::kNoCall); | 5882 LocationSummary::kNoCall); |
5861 } | 5883 } |
5862 | 5884 |
(...skipping 24 matching lines...) Expand all Loading... |
5887 PcDescriptors::kOther, | 5909 PcDescriptors::kOther, |
5888 locs()); | 5910 locs()); |
5889 __ Drop(ArgumentCount()); // Discard arguments. | 5911 __ Drop(ArgumentCount()); // Discard arguments. |
5890 } | 5912 } |
5891 | 5913 |
5892 } // namespace dart | 5914 } // namespace dart |
5893 | 5915 |
5894 #undef __ | 5916 #undef __ |
5895 | 5917 |
5896 #endif // defined TARGET_ARCH_IA32 | 5918 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |