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 "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 101 |
102 // Generate 1 byte NOP so that the debugger can patch the | 102 // Generate 1 byte NOP so that the debugger can patch the |
103 // return pattern with a call to the debug stub. | 103 // return pattern with a call to the debug stub. |
104 __ nop(1); | 104 __ nop(1); |
105 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | 105 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, |
106 Isolate::kNoDeoptId, | 106 Isolate::kNoDeoptId, |
107 token_pos()); | 107 token_pos()); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 LocationSummary* ClosureCallInstr::MakeLocationSummary() const { | |
112 const intptr_t kNumInputs = 0; | |
113 const intptr_t kNumTemps = 1; | |
114 LocationSummary* result = | |
115 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
116 result->set_out(Location::RegisterLocation(EAX)); | |
117 result->set_temp(0, Location::RegisterLocation(EDX)); // Arg. descriptor. | |
118 return result; | |
119 } | |
120 | |
121 | |
122 LocationSummary* LoadLocalInstr::MakeLocationSummary() const { | 111 LocationSummary* LoadLocalInstr::MakeLocationSummary() const { |
123 const intptr_t kNumInputs = 0; | 112 const intptr_t kNumInputs = 0; |
124 return LocationSummary::Make(kNumInputs, | 113 return LocationSummary::Make(kNumInputs, |
125 Location::RequiresRegister(), | 114 Location::RequiresRegister(), |
126 LocationSummary::kNoCall); | 115 LocationSummary::kNoCall); |
127 } | 116 } |
128 | 117 |
129 | 118 |
130 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 119 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
131 Register result = locs()->out().reg(); | 120 Register result = locs()->out().reg(); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { | 350 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
362 ASSERT(!original_ic_data.IsNull()); | 351 ASSERT(!original_ic_data.IsNull()); |
363 if (original_ic_data.NumberOfChecks() == 0) { | 352 if (original_ic_data.NumberOfChecks() == 0) { |
364 // IC call for reoptimization populates original ICData. | 353 // IC call for reoptimization populates original ICData. |
365 equality_ic_data = original_ic_data.raw(); | 354 equality_ic_data = original_ic_data.raw(); |
366 } else { | 355 } else { |
367 // Megamorphic call. | 356 // Megamorphic call. |
368 equality_ic_data = original_ic_data.AsUnaryClassChecks(); | 357 equality_ic_data = original_ic_data.AsUnaryClassChecks(); |
369 } | 358 } |
370 } else { | 359 } else { |
360 const Array& arguments_descriptor = | |
361 Array::ZoneHandle(ArgumentsDescriptor::New(kNumberOfArguments, | |
362 kNoArgumentNames)); | |
siva
2013/06/19 23:07:15
ZoneHandle not needed?
srdjan
2013/06/20 00:12:34
Done.
| |
371 equality_ic_data = ICData::New(compiler->parsed_function().function(), | 363 equality_ic_data = ICData::New(compiler->parsed_function().function(), |
372 Symbols::EqualOperator(), | 364 Symbols::EqualOperator(), |
365 arguments_descriptor, | |
373 deopt_id, | 366 deopt_id, |
374 kNumArgumentsChecked); | 367 kNumArgumentsChecked); |
375 } | 368 } |
376 compiler->GenerateInstanceCall(deopt_id, | 369 compiler->GenerateInstanceCall(deopt_id, |
377 token_pos, | 370 token_pos, |
378 kNumberOfArguments, | 371 kNumberOfArguments, |
379 kNoArgumentNames, | 372 kNoArgumentNames, |
380 locs, | 373 locs, |
381 equality_ic_data); | 374 equality_ic_data); |
382 Label check_ne; | 375 Label check_ne; |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1005 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { | 998 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
1006 ASSERT(!ic_data()->IsNull()); | 999 ASSERT(!ic_data()->IsNull()); |
1007 if (ic_data()->NumberOfChecks() == 0) { | 1000 if (ic_data()->NumberOfChecks() == 0) { |
1008 // IC call for reoptimization populates original ICData. | 1001 // IC call for reoptimization populates original ICData. |
1009 relational_ic_data = ic_data()->raw(); | 1002 relational_ic_data = ic_data()->raw(); |
1010 } else { | 1003 } else { |
1011 // Megamorphic call. | 1004 // Megamorphic call. |
1012 relational_ic_data = ic_data()->AsUnaryClassChecks(); | 1005 relational_ic_data = ic_data()->AsUnaryClassChecks(); |
1013 } | 1006 } |
1014 } else { | 1007 } else { |
1008 const Array& arguments_descriptor = | |
1009 Array::ZoneHandle(ArgumentsDescriptor::New(kNumArguments, | |
1010 Array::ZoneHandle())); | |
siva
2013/06/19 23:07:15
ZoneHandle not needed and Object::null_array()
srdjan
2013/06/20 00:12:34
Done.
| |
1015 relational_ic_data = ICData::New(compiler->parsed_function().function(), | 1011 relational_ic_data = ICData::New(compiler->parsed_function().function(), |
1016 function_name, | 1012 function_name, |
1013 arguments_descriptor, | |
1017 deopt_id(), | 1014 deopt_id(), |
1018 kNumArgsChecked); | 1015 kNumArgsChecked); |
1019 } | 1016 } |
1020 compiler->GenerateInstanceCall(deopt_id(), | 1017 compiler->GenerateInstanceCall(deopt_id(), |
1021 token_pos(), | 1018 token_pos(), |
1022 kNumArguments, | 1019 kNumArguments, |
1023 Array::ZoneHandle(), // No optional arguments. | 1020 Array::ZoneHandle(), // No optional arguments. |
1024 locs(), | 1021 locs(), |
1025 relational_ic_data); | 1022 relational_ic_data); |
1026 } | 1023 } |
(...skipping 3617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4644 __ subl(EDX, Immediate(1)); | 4641 __ subl(EDX, Immediate(1)); |
4645 __ andl(EDX, Immediate( | 4642 __ andl(EDX, Immediate( |
4646 Smi::RawValue(true_value) - Smi::RawValue(false_value))); | 4643 Smi::RawValue(true_value) - Smi::RawValue(false_value))); |
4647 if (false_value != 0) { | 4644 if (false_value != 0) { |
4648 __ addl(EDX, Immediate(Smi::RawValue(false_value))); | 4645 __ addl(EDX, Immediate(Smi::RawValue(false_value))); |
4649 } | 4646 } |
4650 } | 4647 } |
4651 } | 4648 } |
4652 | 4649 |
4653 | 4650 |
4651 LocationSummary* ClosureCallInstr::MakeLocationSummary() const { | |
4652 const intptr_t kNumInputs = 0; | |
4653 const intptr_t kNumTemps = 1; | |
4654 LocationSummary* result = | |
4655 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
4656 result->set_out(Location::RegisterLocation(EAX)); | |
4657 result->set_temp(0, Location::RegisterLocation(EDX)); // Arg. descriptor. | |
4658 return result; | |
4659 } | |
4660 | |
4661 | |
4654 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4662 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4655 // The arguments to the stub include the closure, as does the arguments | 4663 // The arguments to the stub include the closure, as does the arguments |
4656 // descriptor. | 4664 // descriptor. |
4657 Register temp_reg = locs()->temp(0).reg(); | 4665 Register temp_reg = locs()->temp(0).reg(); |
4658 int argument_count = ArgumentCount(); | 4666 int argument_count = ArgumentCount(); |
4659 const Array& arguments_descriptor = | 4667 const Array& arguments_descriptor = |
4660 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 4668 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
4661 argument_names())); | 4669 argument_names())); |
4662 __ LoadObject(temp_reg, arguments_descriptor); | 4670 __ LoadObject(temp_reg, arguments_descriptor); |
4671 ASSERT(temp_reg == EDX); | |
4663 compiler->GenerateDartCall(deopt_id(), | 4672 compiler->GenerateDartCall(deopt_id(), |
4664 token_pos(), | 4673 token_pos(), |
4665 &StubCode::CallClosureFunctionLabel(), | 4674 &StubCode::CallClosureFunctionLabel(), |
4666 PcDescriptors::kClosureCall, | 4675 PcDescriptors::kClosureCall, |
4667 locs()); | 4676 locs()); |
4668 __ Drop(argument_count); | 4677 __ Drop(argument_count); |
4669 } | 4678 } |
4670 | 4679 |
4671 | 4680 |
4672 LocationSummary* BooleanNegateInstr::MakeLocationSummary() const { | 4681 LocationSummary* BooleanNegateInstr::MakeLocationSummary() const { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4767 PcDescriptors::kOther, | 4776 PcDescriptors::kOther, |
4768 locs()); | 4777 locs()); |
4769 __ Drop(2); // Discard type arguments and receiver. | 4778 __ Drop(2); // Discard type arguments and receiver. |
4770 } | 4779 } |
4771 | 4780 |
4772 } // namespace dart | 4781 } // namespace dart |
4773 | 4782 |
4774 #undef __ | 4783 #undef __ |
4775 | 4784 |
4776 #endif // defined TARGET_ARCH_IA32 | 4785 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |