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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 case Token::kLTE: return LESS_EQUAL; | 242 case Token::kLTE: return LESS_EQUAL; |
243 case Token::kGTE: return GREATER_EQUAL; | 243 case Token::kGTE: return GREATER_EQUAL; |
244 default: | 244 default: |
245 UNREACHABLE(); | 245 UNREACHABLE(); |
246 return OVERFLOW; | 246 return OVERFLOW; |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 | 250 |
251 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 251 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
252 const intptr_t dart_object_cid = | |
253 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
254 const intptr_t kNumInputs = 2; | 252 const intptr_t kNumInputs = 2; |
255 const bool is_checked_strict_equal = | 253 const bool is_checked_strict_equal = |
256 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); | 254 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); |
257 if ((receiver_class_id() == kSmiCid) || | 255 if ((receiver_class_id() == kSmiCid) || |
258 (receiver_class_id() == kDoubleCid) || | 256 (receiver_class_id() == kDoubleCid) || |
259 is_checked_strict_equal) { | 257 is_checked_strict_equal) { |
260 const intptr_t kNumTemps = 1; | 258 const intptr_t kNumTemps = 1; |
261 LocationSummary* locs = | 259 LocationSummary* locs = |
262 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 260 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
263 locs->set_in(0, Location::RequiresRegister()); | 261 locs->set_in(0, Location::RequiresRegister()); |
264 locs->set_in(1, Location::RequiresRegister()); | 262 locs->set_in(1, Location::RequiresRegister()); |
265 locs->set_temp(0, Location::RequiresRegister()); | 263 locs->set_temp(0, Location::RequiresRegister()); |
266 locs->set_out(Location::RequiresRegister()); | 264 locs->set_out(Location::RequiresRegister()); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 639 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
642 deopt_id(), token_pos(), try_index()); | 640 deopt_id(), token_pos(), try_index()); |
643 return; | 641 return; |
644 } | 642 } |
645 if (receiver_class_id() == kDoubleCid) { | 643 if (receiver_class_id() == kDoubleCid) { |
646 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 644 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
647 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 645 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
648 deopt_id(), token_pos(), try_index()); | 646 deopt_id(), token_pos(), try_index()); |
649 return; | 647 return; |
650 } | 648 } |
651 const intptr_t dart_object_cid = | |
652 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
653 const bool is_checked_strict_equal = | 649 const bool is_checked_strict_equal = |
654 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); | 650 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); |
655 if (is_checked_strict_equal) { | 651 if (is_checked_strict_equal) { |
656 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, | 652 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, |
657 deopt_id(), token_pos(), try_index()); | 653 deopt_id(), token_pos(), try_index()); |
658 return; | 654 return; |
659 } | 655 } |
660 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 656 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
661 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), | 657 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), |
662 deopt_id(), token_pos(), try_index()); | 658 deopt_id(), token_pos(), try_index()); |
663 } else { | 659 } else { |
664 Register left = locs()->in(0).reg(); | 660 Register left = locs()->in(0).reg(); |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 if (ic_data.NumberOfChecks() != 1) return false; | 2045 if (ic_data.NumberOfChecks() != 1) return false; |
2050 Function& target = Function::Handle(); | 2046 Function& target = Function::Handle(); |
2051 GrowableArray<intptr_t> class_ids; | 2047 GrowableArray<intptr_t> class_ids; |
2052 ic_data.GetCheckAt(0, &class_ids, &target); | 2048 ic_data.GetCheckAt(0, &class_ids, &target); |
2053 return (class_ids[0] == class_id) && (class_ids[1] == class_id); | 2049 return (class_ids[0] == class_id) && (class_ids[1] == class_id); |
2054 } | 2050 } |
2055 | 2051 |
2056 | 2052 |
2057 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { | 2053 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { |
2058 if ((kind == Token::kEQ) || (kind == Token::kNE)) { | 2054 if ((kind == Token::kEQ) || (kind == Token::kNE)) { |
2059 const intptr_t dart_object_cid = | 2055 return ic_data.AllTargetsHaveSameOwner(kInstanceCid); |
2060 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
2061 return ic_data.AllTargetsHaveSameOwner(dart_object_cid); | |
2062 } | 2056 } |
2063 return false; | 2057 return false; |
2064 } | 2058 } |
2065 | 2059 |
2066 | 2060 |
2067 LocationSummary* BranchInstr::MakeLocationSummary() const { | 2061 LocationSummary* BranchInstr::MakeLocationSummary() const { |
2068 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2062 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
2069 const int kNumInputs = 2; | 2063 const int kNumInputs = 2; |
2070 const int kNumTemps = 0; | 2064 const int kNumTemps = 0; |
2071 LocationSummary* locs = | 2065 LocationSummary* locs = |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 } | 2217 } |
2224 } | 2218 } |
2225 __ Bind(&is_ok); | 2219 __ Bind(&is_ok); |
2226 } | 2220 } |
2227 | 2221 |
2228 } // namespace dart | 2222 } // namespace dart |
2229 | 2223 |
2230 #undef __ | 2224 #undef __ |
2231 | 2225 |
2232 #endif // defined TARGET_ARCH_X64 | 2226 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |