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_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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 903 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
904 summary->set_in(0, Location::RegisterLocation(RAX)); | 904 summary->set_in(0, Location::RegisterLocation(RAX)); |
905 summary->set_out(0, Location::RegisterLocation(RAX)); | 905 summary->set_out(0, Location::RegisterLocation(RAX)); |
906 return summary; | 906 return summary; |
907 } | 907 } |
908 | 908 |
909 | 909 |
910 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 910 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
911 Register array = locs()->in(0).reg(); | 911 Register array = locs()->in(0).reg(); |
912 __ pushq(array); | 912 __ pushq(array); |
| 913 const int kTypeArgsLen = 0; |
913 const int kNumberOfArguments = 1; | 914 const int kNumberOfArguments = 1; |
914 const Array& kNoArgumentNames = Object::null_array(); | 915 const Array& kNoArgumentNames = Object::null_array(); |
915 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), | 916 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), |
916 kNumberOfArguments, kNoArgumentNames, locs(), | 917 kTypeArgsLen, kNumberOfArguments, |
917 ICData::Handle()); | 918 kNoArgumentNames, locs(), ICData::Handle()); |
918 ASSERT(locs()->out(0).reg() == RAX); | 919 ASSERT(locs()->out(0).reg() == RAX); |
919 } | 920 } |
920 | 921 |
921 | 922 |
922 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, | 923 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, |
923 bool opt) const { | 924 bool opt) const { |
924 const intptr_t kNumInputs = 1; | 925 const intptr_t kNumInputs = 1; |
925 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), | 926 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), |
926 LocationSummary::kNoCall); | 927 LocationSummary::kNoCall); |
927 } | 928 } |
(...skipping 4395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5323 __ shlq(temp, Immediate(1)); | 5324 __ shlq(temp, Immediate(1)); |
5324 __ j(OVERFLOW, &do_call, Assembler::kNearJump); | 5325 __ j(OVERFLOW, &do_call, Assembler::kNearJump); |
5325 __ SmiTag(result); | 5326 __ SmiTag(result); |
5326 __ jmp(&done); | 5327 __ jmp(&done); |
5327 __ Bind(&do_call); | 5328 __ Bind(&do_call); |
5328 ASSERT(instance_call()->HasICData()); | 5329 ASSERT(instance_call()->HasICData()); |
5329 const ICData& ic_data = *instance_call()->ic_data(); | 5330 const ICData& ic_data = *instance_call()->ic_data(); |
5330 ASSERT(ic_data.NumberOfChecksIs(1)); | 5331 ASSERT(ic_data.NumberOfChecksIs(1)); |
5331 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); | 5332 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
5332 | 5333 |
| 5334 const intptr_t kTypeArgsLen = 0; |
5333 const intptr_t kNumberOfArguments = 1; | 5335 const intptr_t kNumberOfArguments = 1; |
5334 __ pushq(value_obj); | 5336 __ pushq(value_obj); |
5335 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, | 5337 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, |
5336 kNumberOfArguments, | 5338 kTypeArgsLen, kNumberOfArguments, |
5337 Object::null_array(), // No argument names. | 5339 Object::null_array(), // No argument names. |
5338 locs(), ICData::Handle()); | 5340 locs(), ICData::Handle()); |
5339 __ Bind(&done); | 5341 __ Bind(&done); |
5340 } | 5342 } |
5341 | 5343 |
5342 | 5344 |
5343 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, | 5345 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, |
5344 bool opt) const { | 5346 bool opt) const { |
5345 const intptr_t kNumInputs = 1; | 5347 const intptr_t kNumInputs = 1; |
5346 const intptr_t kNumTemps = 1; | 5348 const intptr_t kNumTemps = 1; |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6704 LocationSummary* summary = new (zone) | 6706 LocationSummary* summary = new (zone) |
6705 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 6707 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
6706 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. | 6708 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. |
6707 summary->set_out(0, Location::RegisterLocation(RAX)); | 6709 summary->set_out(0, Location::RegisterLocation(RAX)); |
6708 return summary; | 6710 return summary; |
6709 } | 6711 } |
6710 | 6712 |
6711 | 6713 |
6712 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6714 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
6713 // Arguments descriptor is expected in R10. | 6715 // Arguments descriptor is expected in R10. |
6714 intptr_t argument_count = ArgumentCount(); | 6716 const intptr_t ta_len = type_args_len(); |
6715 const Array& arguments_descriptor = Array::ZoneHandle( | 6717 const intptr_t argument_count = ArgumentCount(); // Includes type args. |
6716 ArgumentsDescriptor::New(argument_count, argument_names())); | 6718 const Array& arguments_descriptor = |
| 6719 Array::ZoneHandle(ArgumentsDescriptor::New( |
| 6720 ta_len, argument_count - (ta_len > 0 ? 1 : 0), argument_names())); |
6717 __ LoadObject(R10, arguments_descriptor); | 6721 __ LoadObject(R10, arguments_descriptor); |
6718 | 6722 |
6719 // Function in RAX. | 6723 // Function in RAX. |
6720 ASSERT(locs()->in(0).reg() == RAX); | 6724 ASSERT(locs()->in(0).reg() == RAX); |
6721 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 6725 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
6722 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); | 6726 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); |
6723 | 6727 |
6724 // RAX: Function. | 6728 // RAX: Function. |
6725 // R10: Arguments descriptor array. | 6729 // R10: Arguments descriptor array. |
6726 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 6730 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6810 __ Drop(1); | 6814 __ Drop(1); |
6811 __ popq(result); | 6815 __ popq(result); |
6812 } | 6816 } |
6813 | 6817 |
6814 | 6818 |
6815 } // namespace dart | 6819 } // namespace dart |
6816 | 6820 |
6817 #undef __ | 6821 #undef __ |
6818 | 6822 |
6819 #endif // defined TARGET_ARCH_X64 | 6823 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |