| 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 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 const intptr_t kNumTemps = 0; | 1965 const intptr_t kNumTemps = 0; |
| 1966 LocationSummary* summary = | 1966 LocationSummary* summary = |
| 1967 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1967 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1968 summary->set_in(0, Location::RequiresRegister()); | 1968 summary->set_in(0, Location::RequiresRegister()); |
| 1969 summary->set_out(Location::SameAsFirstInput()); | 1969 summary->set_out(Location::SameAsFirstInput()); |
| 1970 return summary; | 1970 return summary; |
| 1971 } | 1971 } |
| 1972 | 1972 |
| 1973 | 1973 |
| 1974 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1974 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1975 const ICData& ic_data = *instance_call()->ic_data(); | |
| 1976 ASSERT(!ic_data.IsNull()); | |
| 1977 ASSERT(ic_data.num_args_tested() == 1); | |
| 1978 // TODO(srdjan): Implement for more checks. | |
| 1979 ASSERT(ic_data.NumberOfChecks() == 1); | |
| 1980 intptr_t test_class_id; | |
| 1981 Function& target = Function::Handle(); | |
| 1982 ic_data.GetOneClassCheckAt(0, &test_class_id, &target); | |
| 1983 | |
| 1984 Register value = locs()->in(0).reg(); | 1975 Register value = locs()->in(0).reg(); |
| 1985 Register result = locs()->out().reg(); | 1976 ASSERT(value == locs()->out().reg()); |
| 1986 ASSERT(value == result); | 1977 switch (op_kind()) { |
| 1987 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), | 1978 case Token::kNEGATE: { |
| 1988 instance_call()->try_index(), | 1979 Label* deopt = compiler->AddDeoptStub(instance_call()->deopt_id(), |
| 1989 kDeoptUnaryOp); | 1980 instance_call()->try_index(), |
| 1990 if (test_class_id == kSmiCid) { | 1981 kDeoptUnaryOp); |
| 1991 __ testq(value, Immediate(kSmiTagMask)); | 1982 __ negq(value); |
| 1992 __ j(NOT_ZERO, deopt); | 1983 __ j(OVERFLOW, deopt); |
| 1993 switch (op_kind()) { | 1984 break; |
| 1994 case Token::kNEGATE: | |
| 1995 __ negq(value); | |
| 1996 __ j(OVERFLOW, deopt); | |
| 1997 break; | |
| 1998 case Token::kBIT_NOT: | |
| 1999 __ notq(value); | |
| 2000 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. | |
| 2001 break; | |
| 2002 default: | |
| 2003 UNREACHABLE(); | |
| 2004 } | 1985 } |
| 2005 } else { | 1986 case Token::kBIT_NOT: |
| 2006 UNREACHABLE(); | 1987 __ notq(value); |
| 1988 __ andq(value, Immediate(~kSmiTagMask)); // Remove inverted smi-tag. |
| 1989 break; |
| 1990 default: |
| 1991 UNREACHABLE(); |
| 2007 } | 1992 } |
| 2008 } | 1993 } |
| 2009 | 1994 |
| 2010 | 1995 |
| 2011 LocationSummary* NumberNegateComp::MakeLocationSummary() const { | 1996 LocationSummary* NumberNegateComp::MakeLocationSummary() const { |
| 2012 const intptr_t kNumInputs = 1; | 1997 const intptr_t kNumInputs = 1; |
| 2013 const intptr_t kNumTemps = 1; // Needed for doubles. | 1998 const intptr_t kNumTemps = 1; // Needed for doubles. |
| 2014 LocationSummary* summary = | 1999 LocationSummary* summary = |
| 2015 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 2000 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2016 summary->set_in(0, Location::RegisterLocation(RAX)); | 2001 summary->set_in(0, Location::RegisterLocation(RAX)); |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 __ testq(value, Immediate(kSmiTagMask)); | 2376 __ testq(value, Immediate(kSmiTagMask)); |
| 2392 __ j(NOT_ZERO, deopt); | 2377 __ j(NOT_ZERO, deopt); |
| 2393 } | 2378 } |
| 2394 | 2379 |
| 2395 | 2380 |
| 2396 } // namespace dart | 2381 } // namespace dart |
| 2397 | 2382 |
| 2398 #undef __ | 2383 #undef __ |
| 2399 | 2384 |
| 2400 #endif // defined TARGET_ARCH_X64 | 2385 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |