| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 case Token::kLTE: return LESS_EQUAL; | 237 case Token::kLTE: return LESS_EQUAL; |
| 238 case Token::kGTE: return GREATER_EQUAL; | 238 case Token::kGTE: return GREATER_EQUAL; |
| 239 default: | 239 default: |
| 240 UNREACHABLE(); | 240 UNREACHABLE(); |
| 241 return OVERFLOW; | 241 return OVERFLOW; |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 246 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
| 247 const intptr_t dart_object_cid = |
| 248 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 247 const intptr_t kNumInputs = 2; | 249 const intptr_t kNumInputs = 2; |
| 248 const bool is_checked_strict_equal = | 250 const bool is_checked_strict_equal = |
| 249 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | 251 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); |
| 250 if ((receiver_class_id() == kSmiCid) || | 252 if ((receiver_class_id() == kSmiCid) || |
| 251 (receiver_class_id() == kDoubleCid) || | 253 (receiver_class_id() == kDoubleCid) || |
| 252 is_checked_strict_equal) { | 254 is_checked_strict_equal) { |
| 253 const intptr_t kNumTemps = 1; | 255 const intptr_t kNumTemps = 1; |
| 254 LocationSummary* locs = | 256 LocationSummary* locs = |
| 255 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 257 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 256 locs->set_in(0, Location::RequiresRegister()); | 258 locs->set_in(0, Location::RequiresRegister()); |
| 257 locs->set_in(1, Location::RequiresRegister()); | 259 locs->set_in(1, Location::RequiresRegister()); |
| 258 locs->set_temp(0, Location::RequiresRegister()); | 260 locs->set_temp(0, Location::RequiresRegister()); |
| 259 locs->set_out(Location::RequiresRegister()); | 261 locs->set_out(Location::RequiresRegister()); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 641 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
| 640 deopt_id(), token_pos(), try_index()); | 642 deopt_id(), token_pos(), try_index()); |
| 641 return; | 643 return; |
| 642 } | 644 } |
| 643 if (receiver_class_id() == kDoubleCid) { | 645 if (receiver_class_id() == kDoubleCid) { |
| 644 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 646 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
| 645 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 647 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
| 646 deopt_id(), token_pos(), try_index()); | 648 deopt_id(), token_pos(), try_index()); |
| 647 return; | 649 return; |
| 648 } | 650 } |
| 651 const intptr_t dart_object_cid = |
| 652 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 649 const bool is_checked_strict_equal = | 653 const bool is_checked_strict_equal = |
| 650 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | 654 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); |
| 651 if (is_checked_strict_equal) { | 655 if (is_checked_strict_equal) { |
| 652 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, | 656 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, |
| 653 deopt_id(), token_pos(), try_index()); | 657 deopt_id(), token_pos(), try_index()); |
| 654 return; | 658 return; |
| 655 } | 659 } |
| 656 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 660 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 657 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), | 661 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), |
| 658 deopt_id(), token_pos(), try_index()); | 662 deopt_id(), token_pos(), try_index()); |
| 659 } else { | 663 } else { |
| 660 Register left = locs()->in(0).reg(); | 664 Register left = locs()->in(0).reg(); |
| (...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2061 if (ic_data.num_args_tested() != 2) return false; | 2065 if (ic_data.num_args_tested() != 2) return false; |
| 2062 if (ic_data.NumberOfChecks() != 1) return false; | 2066 if (ic_data.NumberOfChecks() != 1) return false; |
| 2063 Function& target = Function::Handle(); | 2067 Function& target = Function::Handle(); |
| 2064 GrowableArray<intptr_t> class_ids; | 2068 GrowableArray<intptr_t> class_ids; |
| 2065 ic_data.GetCheckAt(0, &class_ids, &target); | 2069 ic_data.GetCheckAt(0, &class_ids, &target); |
| 2066 return (class_ids[0] == class_id) && (class_ids[1] == class_id); | 2070 return (class_ids[0] == class_id) && (class_ids[1] == class_id); |
| 2067 } | 2071 } |
| 2068 | 2072 |
| 2069 | 2073 |
| 2070 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { | 2074 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { |
| 2075 const intptr_t dart_object_cid = |
| 2076 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); |
| 2071 if ((kind == Token::kEQ) || (kind == Token::kNE)) { | 2077 if ((kind == Token::kEQ) || (kind == Token::kNE)) { |
| 2072 return ic_data.AllTargetsHaveSameOwner(kInstanceCid); | 2078 return ic_data.AllTargetsHaveSameOwner(dart_object_cid); |
| 2073 } | 2079 } |
| 2074 return false; | 2080 return false; |
| 2075 } | 2081 } |
| 2076 | 2082 |
| 2077 | 2083 |
| 2078 LocationSummary* BranchInstr::MakeLocationSummary() const { | 2084 LocationSummary* BranchInstr::MakeLocationSummary() const { |
| 2079 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2085 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
| 2080 const int kNumInputs = 2; | 2086 const int kNumInputs = 2; |
| 2081 const int kNumTemps = 0; | 2087 const int kNumTemps = 0; |
| 2082 LocationSummary* locs = | 2088 LocationSummary* locs = |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 } | 2235 } |
| 2230 } | 2236 } |
| 2231 __ Bind(&is_ok); | 2237 __ Bind(&is_ok); |
| 2232 } | 2238 } |
| 2233 | 2239 |
| 2234 } // namespace dart | 2240 } // namespace dart |
| 2235 | 2241 |
| 2236 #undef __ | 2242 #undef __ |
| 2237 | 2243 |
| 2238 #endif // defined TARGET_ARCH_X64 | 2244 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |