| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 case Token::kLTE: return LESS_EQUAL; | 246 case Token::kLTE: return LESS_EQUAL; |
| 247 case Token::kGTE: return GREATER_EQUAL; | 247 case Token::kGTE: return GREATER_EQUAL; |
| 248 default: | 248 default: |
| 249 UNREACHABLE(); | 249 UNREACHABLE(); |
| 250 return OVERFLOW; | 250 return OVERFLOW; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 255 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
| 256 const intptr_t dart_object_cid = |
| 257 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 256 const intptr_t kNumInputs = 2; | 258 const intptr_t kNumInputs = 2; |
| 257 const bool is_checked_strict_equal = | 259 const bool is_checked_strict_equal = |
| 258 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | 260 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); |
| 259 if ((receiver_class_id() == kSmiCid) || | 261 if ((receiver_class_id() == kSmiCid) || |
| 260 (receiver_class_id() == kDoubleCid) || | 262 (receiver_class_id() == kDoubleCid) || |
| 261 is_checked_strict_equal) { | 263 is_checked_strict_equal) { |
| 262 const intptr_t kNumTemps = 1; | 264 const intptr_t kNumTemps = 1; |
| 263 LocationSummary* locs = | 265 LocationSummary* locs = |
| 264 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 266 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 265 locs->set_in(0, Location::RequiresRegister()); | 267 locs->set_in(0, Location::RequiresRegister()); |
| 266 locs->set_in(1, Location::RequiresRegister()); | 268 locs->set_in(1, Location::RequiresRegister()); |
| 267 locs->set_temp(0, Location::RequiresRegister()); | 269 locs->set_temp(0, Location::RequiresRegister()); |
| 268 locs->set_out(Location::RequiresRegister()); | 270 locs->set_out(Location::RequiresRegister()); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 651 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
| 650 deopt_id(), token_pos(), try_index()); | 652 deopt_id(), token_pos(), try_index()); |
| 651 return; | 653 return; |
| 652 } | 654 } |
| 653 if (receiver_class_id() == kDoubleCid) { | 655 if (receiver_class_id() == kDoubleCid) { |
| 654 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 656 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
| 655 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 657 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
| 656 deopt_id(), token_pos(), try_index()); | 658 deopt_id(), token_pos(), try_index()); |
| 657 return; | 659 return; |
| 658 } | 660 } |
| 661 const intptr_t dart_object_cid = |
| 662 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 659 const bool is_checked_strict_equal = | 663 const bool is_checked_strict_equal = |
| 660 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | 664 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); |
| 661 if (is_checked_strict_equal) { | 665 if (is_checked_strict_equal) { |
| 662 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, | 666 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, |
| 663 deopt_id(), token_pos(), try_index()); | 667 deopt_id(), token_pos(), try_index()); |
| 664 return; | 668 return; |
| 665 } | 669 } |
| 666 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 670 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 667 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), | 671 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), |
| 668 deopt_id(), token_pos(), try_index()); | 672 deopt_id(), token_pos(), try_index()); |
| 669 } else { | 673 } else { |
| 670 Register left = locs()->in(0).reg(); | 674 Register left = locs()->in(0).reg(); |
| (...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 if (ic_data.NumberOfChecks() != 1) return false; | 2080 if (ic_data.NumberOfChecks() != 1) return false; |
| 2077 Function& target = Function::Handle(); | 2081 Function& target = Function::Handle(); |
| 2078 GrowableArray<intptr_t> class_ids; | 2082 GrowableArray<intptr_t> class_ids; |
| 2079 ic_data.GetCheckAt(0, &class_ids, &target); | 2083 ic_data.GetCheckAt(0, &class_ids, &target); |
| 2080 return (class_ids[0] == class_id) && (class_ids[1] == class_id); | 2084 return (class_ids[0] == class_id) && (class_ids[1] == class_id); |
| 2081 } | 2085 } |
| 2082 | 2086 |
| 2083 | 2087 |
| 2084 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { | 2088 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { |
| 2085 if ((kind == Token::kEQ) || (kind == Token::kNE)) { | 2089 if ((kind == Token::kEQ) || (kind == Token::kNE)) { |
| 2086 return ic_data.AllTargetsHaveSameOwner(kInstanceCid); | 2090 const intptr_t dart_object_cid = |
| 2091 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 2092 return ic_data.AllTargetsHaveSameOwner(dart_object_cid); |
| 2087 } | 2093 } |
| 2088 return false; | 2094 return false; |
| 2089 } | 2095 } |
| 2090 | 2096 |
| 2091 | 2097 |
| 2092 LocationSummary* BranchInstr::MakeLocationSummary() const { | 2098 LocationSummary* BranchInstr::MakeLocationSummary() const { |
| 2093 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2099 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
| 2094 const int kNumInputs = 2; | 2100 const int kNumInputs = 2; |
| 2095 const int kNumTemps = 0; | 2101 const int kNumTemps = 0; |
| 2096 LocationSummary* locs = | 2102 LocationSummary* locs = |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 } | 2248 } |
| 2243 } | 2249 } |
| 2244 __ Bind(&is_ok); | 2250 __ Bind(&is_ok); |
| 2245 } | 2251 } |
| 2246 | 2252 |
| 2247 } // namespace dart | 2253 } // namespace dart |
| 2248 | 2254 |
| 2249 #undef __ | 2255 #undef __ |
| 2250 | 2256 |
| 2251 #endif // defined TARGET_ARCH_X64 | 2257 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |