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 "lib/error.h" | 10 #include "lib/error.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 __ subq(RDX, Immediate(1)); | 267 __ subq(RDX, Immediate(1)); |
268 __ andq(RDX, Immediate( | 268 __ andq(RDX, Immediate( |
269 Smi::RawValue(true_value) - Smi::RawValue(false_value))); | 269 Smi::RawValue(true_value) - Smi::RawValue(false_value))); |
270 if (false_value != 0) { | 270 if (false_value != 0) { |
271 __ addq(RDX, Immediate(Smi::RawValue(false_value))); | 271 __ addq(RDX, Immediate(Smi::RawValue(false_value))); |
272 } | 272 } |
273 } | 273 } |
274 } | 274 } |
275 | 275 |
276 | 276 |
277 LocationSummary* ClosureCallInstr::MakeLocationSummary() const { | |
278 const intptr_t kNumInputs = 0; | |
279 const intptr_t kNumTemps = 1; | |
280 LocationSummary* result = | |
281 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
282 result->set_out(Location::RegisterLocation(RAX)); | |
283 result->set_temp(0, Location::RegisterLocation(R10)); // Arg. descriptor. | |
284 return result; | |
285 } | |
286 | |
287 | |
288 LocationSummary* LoadLocalInstr::MakeLocationSummary() const { | 277 LocationSummary* LoadLocalInstr::MakeLocationSummary() const { |
289 const intptr_t kNumInputs = 0; | 278 const intptr_t kNumInputs = 0; |
290 return LocationSummary::Make(kNumInputs, | 279 return LocationSummary::Make(kNumInputs, |
291 Location::RequiresRegister(), | 280 Location::RequiresRegister(), |
292 LocationSummary::kNoCall); | 281 LocationSummary::kNoCall); |
293 } | 282 } |
294 | 283 |
295 | 284 |
296 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 285 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
297 Register result = locs()->out().reg(); | 286 Register result = locs()->out().reg(); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { | 506 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
518 ASSERT(!original_ic_data.IsNull()); | 507 ASSERT(!original_ic_data.IsNull()); |
519 if (original_ic_data.NumberOfChecks() == 0) { | 508 if (original_ic_data.NumberOfChecks() == 0) { |
520 // IC call for reoptimization populates original ICData. | 509 // IC call for reoptimization populates original ICData. |
521 equality_ic_data = original_ic_data.raw(); | 510 equality_ic_data = original_ic_data.raw(); |
522 } else { | 511 } else { |
523 // Megamorphic call. | 512 // Megamorphic call. |
524 equality_ic_data = original_ic_data.AsUnaryClassChecks(); | 513 equality_ic_data = original_ic_data.AsUnaryClassChecks(); |
525 } | 514 } |
526 } else { | 515 } else { |
516 const Array& arguments_descriptor = | |
517 Array::ZoneHandle(ArgumentsDescriptor::New(kNumberOfArguments, | |
518 kNoArgumentNames)); | |
siva
2013/06/19 23:07:15
Ditto.
srdjan
2013/06/20 00:12:34
Done.
| |
527 equality_ic_data = ICData::New(compiler->parsed_function().function(), | 519 equality_ic_data = ICData::New(compiler->parsed_function().function(), |
528 Symbols::EqualOperator(), | 520 Symbols::EqualOperator(), |
521 arguments_descriptor, | |
529 deopt_id, | 522 deopt_id, |
530 kNumArgumentsChecked); | 523 kNumArgumentsChecked); |
531 } | 524 } |
532 compiler->GenerateInstanceCall(deopt_id, | 525 compiler->GenerateInstanceCall(deopt_id, |
533 token_pos, | 526 token_pos, |
534 kNumberOfArguments, | 527 kNumberOfArguments, |
535 kNoArgumentNames, | 528 kNoArgumentNames, |
536 locs, | 529 locs, |
537 equality_ic_data); | 530 equality_ic_data); |
538 Label check_ne; | 531 Label check_ne; |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1033 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { | 1026 if (compiler->is_optimizing() && FLAG_propagate_ic_data) { |
1034 ASSERT(!ic_data()->IsNull()); | 1027 ASSERT(!ic_data()->IsNull()); |
1035 if (ic_data()->NumberOfChecks() == 0) { | 1028 if (ic_data()->NumberOfChecks() == 0) { |
1036 // IC call for reoptimization populates original ICData. | 1029 // IC call for reoptimization populates original ICData. |
1037 relational_ic_data = ic_data()->raw(); | 1030 relational_ic_data = ic_data()->raw(); |
1038 } else { | 1031 } else { |
1039 // Megamorphic call. | 1032 // Megamorphic call. |
1040 relational_ic_data = ic_data()->AsUnaryClassChecks(); | 1033 relational_ic_data = ic_data()->AsUnaryClassChecks(); |
1041 } | 1034 } |
1042 } else { | 1035 } else { |
1036 const Array& arguments_descriptor = | |
1037 Array::ZoneHandle(ArgumentsDescriptor::New(kNumArguments, | |
1038 Array::ZoneHandle())); | |
siva
2013/06/19 23:07:15
ZoneHandle? and Object::null_array()
| |
1043 relational_ic_data = ICData::New(compiler->parsed_function().function(), | 1039 relational_ic_data = ICData::New(compiler->parsed_function().function(), |
1044 function_name, | 1040 function_name, |
1041 arguments_descriptor, | |
1045 deopt_id(), | 1042 deopt_id(), |
1046 kNumArgsChecked); | 1043 kNumArgsChecked); |
1047 } | 1044 } |
1048 compiler->GenerateInstanceCall(deopt_id(), | 1045 compiler->GenerateInstanceCall(deopt_id(), |
1049 token_pos(), | 1046 token_pos(), |
1050 kNumArguments, | 1047 kNumArguments, |
1051 Array::ZoneHandle(), // No optional arguments. | 1048 Array::ZoneHandle(), // No optional arguments. |
1052 locs(), | 1049 locs(), |
1053 relational_ic_data); | 1050 relational_ic_data); |
1054 } | 1051 } |
(...skipping 3259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4314 right.reg(), | 4311 right.reg(), |
4315 needs_number_check(), | 4312 needs_number_check(), |
4316 token_pos()); | 4313 token_pos()); |
4317 } | 4314 } |
4318 | 4315 |
4319 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 4316 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
4320 branch->EmitBranchOnCondition(compiler, true_condition); | 4317 branch->EmitBranchOnCondition(compiler, true_condition); |
4321 } | 4318 } |
4322 | 4319 |
4323 | 4320 |
4321 LocationSummary* ClosureCallInstr::MakeLocationSummary() const { | |
4322 const intptr_t kNumInputs = 0; | |
4323 const intptr_t kNumTemps = 1; | |
4324 LocationSummary* result = | |
4325 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
4326 result->set_out(Location::RegisterLocation(RAX)); | |
4327 result->set_temp(0, Location::RegisterLocation(R10)); // Arg. descriptor. | |
4328 return result; | |
4329 } | |
4330 | |
4331 | |
4324 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4332 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4325 // The arguments to the stub include the closure, as does the arguments | 4333 // The arguments to the stub include the closure, as does the arguments |
4326 // descriptor. | 4334 // descriptor. |
4327 Register temp_reg = locs()->temp(0).reg(); | 4335 Register temp_reg = locs()->temp(0).reg(); |
4328 int argument_count = ArgumentCount(); | 4336 int argument_count = ArgumentCount(); |
4329 const Array& arguments_descriptor = | 4337 const Array& arguments_descriptor = |
4330 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, | 4338 Array::ZoneHandle(ArgumentsDescriptor::New(argument_count, |
4331 argument_names())); | 4339 argument_names())); |
4332 __ LoadObject(temp_reg, arguments_descriptor); | 4340 __ LoadObject(temp_reg, arguments_descriptor); |
4341 ASSERT(temp_reg == R10); | |
4333 compiler->GenerateDartCall(deopt_id(), | 4342 compiler->GenerateDartCall(deopt_id(), |
4334 token_pos(), | 4343 token_pos(), |
4335 &StubCode::CallClosureFunctionLabel(), | 4344 &StubCode::CallClosureFunctionLabel(), |
4336 PcDescriptors::kClosureCall, | 4345 PcDescriptors::kClosureCall, |
4337 locs()); | 4346 locs()); |
4338 __ Drop(argument_count); | 4347 __ Drop(argument_count); |
4339 } | 4348 } |
4340 | 4349 |
4341 | 4350 |
4342 LocationSummary* BooleanNegateInstr::MakeLocationSummary() const { | 4351 LocationSummary* BooleanNegateInstr::MakeLocationSummary() const { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4437 PcDescriptors::kOther, | 4446 PcDescriptors::kOther, |
4438 locs()); | 4447 locs()); |
4439 __ Drop(2); // Discard type arguments and receiver. | 4448 __ Drop(2); // Discard type arguments and receiver. |
4440 } | 4449 } |
4441 | 4450 |
4442 } // namespace dart | 4451 } // namespace dart |
4443 | 4452 |
4444 #undef __ | 4453 #undef __ |
4445 | 4454 |
4446 #endif // defined TARGET_ARCH_X64 | 4455 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |