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 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1998 LocationSummary* locs = | 1998 LocationSummary* locs = |
1999 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1999 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
2000 locs->set_in(0, Location::RegisterLocation(RAX)); | 2000 locs->set_in(0, Location::RegisterLocation(RAX)); |
2001 locs->set_in(1, Location::RegisterLocation(RCX)); | 2001 locs->set_in(1, Location::RegisterLocation(RCX)); |
2002 locs->set_temp(0, Location::RegisterLocation(RDX)); | 2002 locs->set_temp(0, Location::RegisterLocation(RDX)); |
2003 return locs; | 2003 return locs; |
2004 } | 2004 } |
2005 // Otherwise polymorphic dispatch. | 2005 // Otherwise polymorphic dispatch. |
2006 } | 2006 } |
2007 // Call. | 2007 // Call. |
2008 return Computation::MakeCallSummary(); | 2008 const intptr_t kNumInputs = 2; |
2009 const intptr_t kNumTemps = 0; | |
2010 LocationSummary* locs = | |
2011 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
2012 locs->set_in(0, Location::RegisterLocation(RAX)); | |
2013 locs->set_in(1, Location::RegisterLocation(RCX)); | |
srdjan
2012/08/09 19:56:49
ditto
| |
2014 return locs; | |
2009 } | 2015 } |
2010 | 2016 |
2011 | 2017 |
2012 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2018 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2013 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2019 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
2014 Register left = locs()->in(0).reg(); | 2020 Register left = locs()->in(0).reg(); |
2015 Register right = locs()->in(1).reg(); | 2021 Register right = locs()->in(1).reg(); |
2016 __ cmpq(left, right); | 2022 __ cmpq(left, right); |
2017 Condition cond = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 2023 Condition cond = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
2018 EmitBranchOnCondition(compiler, cond); | 2024 EmitBranchOnCondition(compiler, cond); |
(...skipping 12 matching lines...) Expand all Loading... | |
2031 return; | 2037 return; |
2032 } | 2038 } |
2033 // TODO(srdjan): Add Smi/Double, Double/Smi comparisons. | 2039 // TODO(srdjan): Add Smi/Double, Double/Smi comparisons. |
2034 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { | 2040 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { |
2035 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), | 2041 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), |
2036 deopt_id(), token_pos(), try_index()); | 2042 deopt_id(), token_pos(), try_index()); |
2037 return; | 2043 return; |
2038 } | 2044 } |
2039 // Otherwise polymorphic dispatch? | 2045 // Otherwise polymorphic dispatch? |
2040 } | 2046 } |
2047 Register left = locs()->in(0).reg(); | |
2048 Register right = locs()->in(1).reg(); | |
2049 __ pushq(left); | |
2050 __ pushq(right); | |
2041 // Not equal is always split into '==' and negate, | 2051 // Not equal is always split into '==' and negate, |
2042 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; | 2052 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; |
2043 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); | 2053 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); |
2044 const String& function_name = | 2054 const String& function_name = |
2045 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); | 2055 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); |
2046 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 2056 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
2047 deopt_id(), | 2057 deopt_id(), |
2048 token_pos(), | 2058 token_pos(), |
2049 try_index()); | 2059 try_index()); |
2050 const intptr_t kNumArguments = 2; | 2060 const intptr_t kNumArguments = 2; |
2051 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 2061 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
2052 compiler->GenerateInstanceCall(deopt_id(), | 2062 compiler->GenerateInstanceCall(deopt_id(), |
2053 token_pos(), | 2063 token_pos(), |
2054 try_index(), | 2064 try_index(), |
2055 function_name, | 2065 function_name, |
2056 kNumArguments, | 2066 kNumArguments, |
2057 Array::ZoneHandle(), // No optional arguments. | 2067 Array::ZoneHandle(), // No optional arguments. |
2058 kNumArgsChecked); | 2068 kNumArgsChecked); |
2059 ASSERT(locs()->out().reg() == RAX); | 2069 __ CompareObject(RAX, compiler->bool_true()); |
2060 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | |
2061 EmitBranchOnCondition(compiler, branch_condition); | 2070 EmitBranchOnCondition(compiler, branch_condition); |
2062 } | 2071 } |
2063 | 2072 |
2064 } // namespace dart | 2073 } // namespace dart |
2065 | 2074 |
2066 #undef __ | 2075 #undef __ |
2067 | 2076 |
2068 #endif // defined TARGET_ARCH_X64 | 2077 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |