OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) |
| 7 |
| 8 #include "vm/flow_graph_compiler.h" |
| 9 #include "vm/locations.h" |
| 10 |
| 11 #define __ compiler->assembler()-> |
| 12 |
| 13 namespace dart { |
| 14 |
| 15 |
| 16 static LocationSummary* MakeSimpleLocationSummary( |
| 17 intptr_t input_count, Location out) { |
| 18 LocationSummary* summary = new LocationSummary(input_count); |
| 19 for (intptr_t i = 0; i < input_count; i++) { |
| 20 summary->set_in(i, UnallocatedLocation::Register()); |
| 21 } |
| 22 summary->set_out(out); |
| 23 return summary; |
| 24 } |
| 25 |
| 26 |
| 27 LocationSummary* StrictCompareComp::MakeLocationSummary() { |
| 28 return MakeSimpleLocationSummary(2, UnallocatedLocation::SameAsFirstInput()); |
| 29 } |
| 30 |
| 31 |
| 32 void StrictCompareComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 33 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); |
| 34 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); |
| 35 |
| 36 Register left = locs()->in(0).AsRegister(); |
| 37 Register right = locs()->in(1).AsRegister(); |
| 38 Register result = locs()->out().AsRegister(); |
| 39 |
| 40 __ cmpq(left, right); |
| 41 Label load_true, done; |
| 42 if (kind() == Token::kEQ_STRICT) { |
| 43 __ j(EQUAL, &load_true, Assembler::kNearJump); |
| 44 } else { |
| 45 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); |
| 46 } |
| 47 __ LoadObject(result, bool_false); |
| 48 __ jmp(&done, Assembler::kNearJump); |
| 49 __ Bind(&load_true); |
| 50 __ LoadObject(result, bool_true); |
| 51 __ Bind(&done); |
| 52 } |
| 53 |
| 54 |
| 55 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 56 computation()->EmitNativeCode(compiler); |
| 57 __ pushq(locs()->out().AsRegister()); |
| 58 } |
| 59 |
| 60 |
| 61 #undef __ |
| 62 |
| 63 |
| 64 } // namespace dart |
| 65 |
| 66 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |