| 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(); |
| 916 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); |
| 915 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), | 917 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), |
| 916 kNumberOfArguments, kNoArgumentNames, locs(), | 918 args_info, locs(), ICData::Handle()); |
| 917 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 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5318 __ cvttsd2siq(result, value_double); | 5319 __ cvttsd2siq(result, value_double); |
| 5319 // Overflow is signalled with minint. | 5320 // Overflow is signalled with minint. |
| 5320 Label do_call, done; | 5321 Label do_call, done; |
| 5321 // Check for overflow and that it fits into Smi. | 5322 // Check for overflow and that it fits into Smi. |
| 5322 __ movq(temp, result); | 5323 __ movq(temp, result); |
| 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); |
| 5329 __ pushq(value_obj); |
| 5328 ASSERT(instance_call()->HasICData()); | 5330 ASSERT(instance_call()->HasICData()); |
| 5329 const ICData& ic_data = *instance_call()->ic_data(); | 5331 const ICData& ic_data = *instance_call()->ic_data(); |
| 5330 ASSERT(ic_data.NumberOfChecksIs(1)); | 5332 ASSERT(ic_data.NumberOfChecksIs(1)); |
| 5331 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); | 5333 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
| 5332 | 5334 const int kTypeArgsLen = 0; |
| 5333 const intptr_t kNumberOfArguments = 1; | 5335 const int kNumberOfArguments = 1; |
| 5334 __ pushq(value_obj); | 5336 const Array& kNoArgumentNames = Object::null_array(); |
| 5337 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); |
| 5335 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, | 5338 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, |
| 5336 kNumberOfArguments, | 5339 args_info, locs(), ICData::Handle()); |
| 5337 Object::null_array(), // No argument names. | |
| 5338 locs(), ICData::Handle()); | |
| 5339 __ Bind(&done); | 5340 __ Bind(&done); |
| 5340 } | 5341 } |
| 5341 | 5342 |
| 5342 | 5343 |
| 5343 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, | 5344 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, |
| 5344 bool opt) const { | 5345 bool opt) const { |
| 5345 const intptr_t kNumInputs = 1; | 5346 const intptr_t kNumInputs = 1; |
| 5346 const intptr_t kNumTemps = 1; | 5347 const intptr_t kNumTemps = 1; |
| 5347 LocationSummary* result = new (zone) | 5348 LocationSummary* result = new (zone) |
| 5348 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5349 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| (...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6684 LocationSummary* summary = new (zone) | 6685 LocationSummary* summary = new (zone) |
| 6685 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 6686 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 6686 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. | 6687 summary->set_in(0, Location::RegisterLocation(RAX)); // Function. |
| 6687 summary->set_out(0, Location::RegisterLocation(RAX)); | 6688 summary->set_out(0, Location::RegisterLocation(RAX)); |
| 6688 return summary; | 6689 return summary; |
| 6689 } | 6690 } |
| 6690 | 6691 |
| 6691 | 6692 |
| 6692 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6693 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6693 // Arguments descriptor is expected in R10. | 6694 // Arguments descriptor is expected in R10. |
| 6694 intptr_t argument_count = ArgumentCount(); | 6695 const intptr_t argument_count = ArgumentCount(); // Includes type args. |
| 6695 const Array& arguments_descriptor = Array::ZoneHandle( | 6696 const Array& arguments_descriptor = |
| 6696 ArgumentsDescriptor::New(argument_count, argument_names())); | 6697 Array::ZoneHandle(Z, GetArgumentsDescriptor()); |
| 6697 __ LoadObject(R10, arguments_descriptor); | 6698 __ LoadObject(R10, arguments_descriptor); |
| 6698 | 6699 |
| 6699 // Function in RAX. | 6700 // Function in RAX. |
| 6700 ASSERT(locs()->in(0).reg() == RAX); | 6701 ASSERT(locs()->in(0).reg() == RAX); |
| 6701 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); | 6702 __ movq(CODE_REG, FieldAddress(RAX, Function::code_offset())); |
| 6702 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); | 6703 __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset())); |
| 6703 | 6704 |
| 6704 // RAX: Function. | 6705 // RAX: Function. |
| 6705 // R10: Arguments descriptor array. | 6706 // R10: Arguments descriptor array. |
| 6706 // RBX: Smi 0 (no IC data; the lazy-compile stub expects a GC-safe value). | 6707 // 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... |
| 6790 __ Drop(1); | 6791 __ Drop(1); |
| 6791 __ popq(result); | 6792 __ popq(result); |
| 6792 } | 6793 } |
| 6793 | 6794 |
| 6794 | 6795 |
| 6795 } // namespace dart | 6796 } // namespace dart |
| 6796 | 6797 |
| 6797 #undef __ | 6798 #undef __ |
| 6798 | 6799 |
| 6799 #endif // defined TARGET_ARCH_X64 | 6800 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |