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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1992 LocationSummary* locs = | 1992 LocationSummary* locs = |
1993 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1993 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
1994 locs->set_in(0, Location::RegisterLocation(EAX)); | 1994 locs->set_in(0, Location::RegisterLocation(EAX)); |
1995 locs->set_in(1, Location::RegisterLocation(ECX)); | 1995 locs->set_in(1, Location::RegisterLocation(ECX)); |
1996 locs->set_temp(0, Location::RegisterLocation(EDX)); | 1996 locs->set_temp(0, Location::RegisterLocation(EDX)); |
1997 return locs; | 1997 return locs; |
1998 } | 1998 } |
1999 // Otherwise polymorphic dispatch. | 1999 // Otherwise polymorphic dispatch. |
2000 } | 2000 } |
2001 // Call. | 2001 // Call. |
2002 return Computation::MakeCallSummary(); | 2002 const intptr_t kNumInputs = 2; |
2003 const intptr_t kNumTemps = 0; | |
2004 LocationSummary* locs = | |
2005 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | |
2006 locs->set_in(0, Location::RegisterLocation(EAX)); | |
2007 locs->set_in(1, Location::RegisterLocation(ECX)); | |
srdjan
2012/08/09 19:56:49
Why do you require EAX, ECX to hold inputs?
| |
2008 return locs; | |
2003 } | 2009 } |
2004 | 2010 |
2005 | 2011 |
2006 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2012 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2007 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2013 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
2008 Register left = locs()->in(0).reg(); | 2014 Register left = locs()->in(0).reg(); |
2009 Register right = locs()->in(1).reg(); | 2015 Register right = locs()->in(1).reg(); |
2010 __ cmpl(left, right); | 2016 __ cmpl(left, right); |
2011 Condition cond = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 2017 Condition cond = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
2012 EmitBranchOnCondition(compiler, cond); | 2018 EmitBranchOnCondition(compiler, cond); |
(...skipping 12 matching lines...) Expand all Loading... | |
2025 return; | 2031 return; |
2026 } | 2032 } |
2027 // TODO(srdjan): Add Smi/Double, Double/Smi comparisons. | 2033 // TODO(srdjan): Add Smi/Double, Double/Smi comparisons. |
2028 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { | 2034 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { |
2029 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), | 2035 EmitGenericEqualityCompare(compiler, *locs(), kind(), this, *ic_data(), |
2030 deopt_id(), token_pos(), try_index()); | 2036 deopt_id(), token_pos(), try_index()); |
2031 return; | 2037 return; |
2032 } | 2038 } |
2033 // Otherwise polymorphic dispatch? | 2039 // Otherwise polymorphic dispatch? |
2034 } | 2040 } |
2041 Register left = locs()->in(0).reg(); | |
2042 Register right = locs()->in(1).reg(); | |
2043 __ pushl(left); | |
2044 __ pushl(right); | |
2035 // Not equal is always split into '==' and negate, | 2045 // Not equal is always split into '==' and negate, |
2036 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; | 2046 Condition branch_condition = (kind() == Token::kNE) ? NOT_EQUAL : EQUAL; |
2037 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); | 2047 Token::Kind call_kind = (kind() == Token::kNE) ? Token::kEQ : kind(); |
2038 const String& function_name = | 2048 const String& function_name = |
2039 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); | 2049 String::ZoneHandle(Symbols::New(Token::Str(call_kind))); |
2040 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, | 2050 compiler->AddCurrentDescriptor(PcDescriptors::kDeopt, |
2041 deopt_id(), | 2051 deopt_id(), |
2042 token_pos(), | 2052 token_pos(), |
2043 try_index()); | 2053 try_index()); |
2044 const intptr_t kNumArguments = 2; | 2054 const intptr_t kNumArguments = 2; |
2045 const intptr_t kNumArgsChecked = 2; // Type-feedback. | 2055 const intptr_t kNumArgsChecked = 2; // Type-feedback. |
2046 compiler->GenerateInstanceCall(deopt_id(), | 2056 compiler->GenerateInstanceCall(deopt_id(), |
2047 token_pos(), | 2057 token_pos(), |
2048 try_index(), | 2058 try_index(), |
2049 function_name, | 2059 function_name, |
2050 kNumArguments, | 2060 kNumArguments, |
2051 Array::ZoneHandle(), // No optional arguments. | 2061 Array::ZoneHandle(), // No optional arguments. |
2052 kNumArgsChecked); | 2062 kNumArgsChecked); |
2053 ASSERT(locs()->out().reg() == EAX); | 2063 __ CompareObject(EAX, compiler->bool_true()); |
2054 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | |
2055 EmitBranchOnCondition(compiler, branch_condition); | 2064 EmitBranchOnCondition(compiler, branch_condition); |
2056 } | 2065 } |
2057 | 2066 |
2058 } // namespace dart | 2067 } // namespace dart |
2059 | 2068 |
2060 #undef __ | 2069 #undef __ |
2061 | 2070 |
2062 #endif // defined TARGET_ARCH_X64 | 2071 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |