| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 compiler->GenerateCallRuntime(cid(), | 106 compiler->GenerateCallRuntime(cid(), |
| 107 token_index(), | 107 token_index(), |
| 108 try_index(), | 108 try_index(), |
| 109 kReThrowRuntimeEntry); | 109 kReThrowRuntimeEntry); |
| 110 __ int3(); | 110 __ int3(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 LocationSummary* BranchInstr::MakeLocationSummary() const { | 114 LocationSummary* BranchInstr::MakeLocationSummary() const { |
| 115 const int kNumInputs = 1; | 115 const int kNumInputs = 1; |
| 116 const int kNumTemps = 1; | 116 const int kNumTemps = 0; |
| 117 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 117 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); |
| 118 locs->set_in(0, Location::RequiresRegister()); | 118 locs->set_in(0, Location::RequiresRegister()); |
| 119 locs->set_temp(0, Location::RequiresRegister()); | |
| 120 return locs; | 119 return locs; |
| 121 } | 120 } |
| 122 | 121 |
| 123 | 122 |
| 124 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 123 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 125 Register value = locs()->in(0).reg(); | 124 Register value = locs()->in(0).reg(); |
| 126 Register temp = locs()->temp(0).reg(); | |
| 127 | 125 |
| 128 __ LoadObject(temp, Bool::ZoneHandle(Bool::True())); | 126 __ CompareObject(value, Bool::ZoneHandle(Bool::True())); |
| 129 __ cmpq(value, temp); | |
| 130 if (compiler->IsNextBlock(false_successor())) { | 127 if (compiler->IsNextBlock(false_successor())) { |
| 131 // If the next block is the false sucessor we will fall through to it if | 128 // If the next block is the false successor we will fall through to it if |
| 132 // comparison with true fails. | 129 // comparison with true fails. |
| 133 __ j(EQUAL, compiler->GetBlockLabel(true_successor())); | 130 __ j(EQUAL, compiler->GetBlockLabel(true_successor())); |
| 134 } else { | 131 } else { |
| 135 // If the next block is the true sucessor we negate comparison and fall | 132 ASSERT(compiler->IsNextBlock(true_successor())); |
| 133 // If the next block is the true successor we negate comparison and fall |
| 136 // through to it. | 134 // through to it. |
| 137 __ j(NOT_EQUAL, compiler->GetBlockLabel(false_successor())); | 135 __ j(NOT_EQUAL, compiler->GetBlockLabel(false_successor())); |
| 138 } | 136 } |
| 139 } | 137 } |
| 140 | 138 |
| 141 | 139 |
| 142 LocationSummary* ReturnInstr::MakeLocationSummary() const { | 140 LocationSummary* ReturnInstr::MakeLocationSummary() const { |
| 143 const intptr_t kNumInputs = 1; | 141 const intptr_t kNumInputs = 1; |
| 144 const intptr_t kNumTemps = 1; | 142 const intptr_t kNumTemps = 1; |
| 145 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 143 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 240 |
| 243 Register left = locs()->in(0).reg(); | 241 Register left = locs()->in(0).reg(); |
| 244 Register right = locs()->in(1).reg(); | 242 Register right = locs()->in(1).reg(); |
| 245 Register result = locs()->out().reg(); | 243 Register result = locs()->out().reg(); |
| 246 | 244 |
| 247 __ cmpq(left, right); | 245 __ cmpq(left, right); |
| 248 Label load_true, done; | 246 Label load_true, done; |
| 249 if (kind() == Token::kEQ_STRICT) { | 247 if (kind() == Token::kEQ_STRICT) { |
| 250 __ j(EQUAL, &load_true, Assembler::kNearJump); | 248 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 251 } else { | 249 } else { |
| 250 ASSERT(kind() == Token::kNE_STRICT); |
| 252 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); | 251 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); |
| 253 } | 252 } |
| 254 __ LoadObject(result, bool_false); | 253 __ LoadObject(result, bool_false); |
| 255 __ jmp(&done, Assembler::kNearJump); | 254 __ jmp(&done, Assembler::kNearJump); |
| 256 __ Bind(&load_true); | 255 __ Bind(&load_true); |
| 257 __ LoadObject(result, bool_true); | 256 __ LoadObject(result, bool_true); |
| 258 __ Bind(&done); | 257 __ Bind(&done); |
| 259 } | 258 } |
| 260 | 259 |
| 261 | 260 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 // Preserve the value (second argument) under the arguments as the result | 563 // Preserve the value (second argument) under the arguments as the result |
| 565 // of the computation, then call the setter. | 564 // of the computation, then call the setter. |
| 566 const String& function_name = | 565 const String& function_name = |
| 567 String::ZoneHandle(Field::SetterSymbol(field_name())); | 566 String::ZoneHandle(Field::SetterSymbol(field_name())); |
| 568 | 567 |
| 569 // Insert a copy of the second (last) argument under the arguments. | 568 // Insert a copy of the second (last) argument under the arguments. |
| 570 // TODO(fschneider): Avoid preserving the value if the result is not used. | 569 // TODO(fschneider): Avoid preserving the value if the result is not used. |
| 571 __ pushq(value); | 570 __ pushq(value); |
| 572 __ pushq(receiver); | 571 __ pushq(receiver); |
| 573 __ pushq(value); | 572 __ pushq(value); |
| 573 const intptr_t kArgumentCount = 2; |
| 574 const intptr_t kCheckedArgumentCount = 1; |
| 574 compiler->GenerateInstanceCall(cid(), | 575 compiler->GenerateInstanceCall(cid(), |
| 575 token_index(), | 576 token_index(), |
| 576 try_index(), | 577 try_index(), |
| 577 function_name, | 578 function_name, |
| 578 2, | 579 kArgumentCount, |
| 579 Array::ZoneHandle(), | 580 Array::ZoneHandle(), |
| 580 1); | 581 kCheckedArgumentCount); |
| 581 __ popq(result); | 582 __ popq(result); |
| 582 } | 583 } |
| 583 | 584 |
| 584 | 585 |
| 585 LocationSummary* StaticSetterComp::MakeLocationSummary() const { | 586 LocationSummary* StaticSetterComp::MakeLocationSummary() const { |
| 586 const intptr_t kNumInputs = 1; | 587 const intptr_t kNumInputs = 1; |
| 587 return LocationSummary::Make(kNumInputs, Location::RequiresRegister()); | 588 return LocationSummary::Make(kNumInputs, Location::RequiresRegister()); |
| 588 } | 589 } |
| 589 | 590 |
| 590 | 591 |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 } else { | 1429 } else { |
| 1429 UNREACHABLE(); | 1430 UNREACHABLE(); |
| 1430 } | 1431 } |
| 1431 } | 1432 } |
| 1432 | 1433 |
| 1433 } // namespace dart | 1434 } // namespace dart |
| 1434 | 1435 |
| 1435 #undef __ | 1436 #undef __ |
| 1436 | 1437 |
| 1437 #endif // defined TARGET_ARCH_X64 | 1438 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |