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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 case Token::kLTE: return LESS_EQUAL; | 233 case Token::kLTE: return LESS_EQUAL; |
234 case Token::kGTE: return GREATER_EQUAL; | 234 case Token::kGTE: return GREATER_EQUAL; |
235 default: | 235 default: |
236 UNREACHABLE(); | 236 UNREACHABLE(); |
237 return OVERFLOW; | 237 return OVERFLOW; |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 | 241 |
242 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 242 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
243 const intptr_t dart_object_cid = | |
244 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
245 const intptr_t kNumInputs = 2; | 243 const intptr_t kNumInputs = 2; |
246 const bool is_checked_strict_equal = | 244 const bool is_checked_strict_equal = |
247 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); | 245 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); |
248 if ((receiver_class_id() == kSmiCid) || | 246 if ((receiver_class_id() == kSmiCid) || |
249 (receiver_class_id() == kDoubleCid) || | 247 (receiver_class_id() == kDoubleCid) || |
250 is_checked_strict_equal) { | 248 is_checked_strict_equal) { |
251 const intptr_t kNumTemps = 1; | 249 const intptr_t kNumTemps = 1; |
252 LocationSummary* locs = | 250 LocationSummary* locs = |
253 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 251 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
254 locs->set_in(0, Location::RequiresRegister()); | 252 locs->set_in(0, Location::RequiresRegister()); |
255 locs->set_in(1, Location::RequiresRegister()); | 253 locs->set_in(1, Location::RequiresRegister()); |
256 locs->set_temp(0, Location::RequiresRegister()); | 254 locs->set_temp(0, Location::RequiresRegister()); |
257 locs->set_out(Location::RequiresRegister()); | 255 locs->set_out(Location::RequiresRegister()); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 629 EmitSmiComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
632 deopt_id(), token_pos(), try_index()); | 630 deopt_id(), token_pos(), try_index()); |
633 return; | 631 return; |
634 } | 632 } |
635 if (receiver_class_id() == kDoubleCid) { | 633 if (receiver_class_id() == kDoubleCid) { |
636 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. | 634 // Deoptimizes if both arguments are Smi, or if none is Double or Smi. |
637 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. | 635 EmitDoubleComparisonOp(compiler, *locs(), kind(), NULL, // No branch. |
638 deopt_id(), token_pos(), try_index()); | 636 deopt_id(), token_pos(), try_index()); |
639 return; | 637 return; |
640 } | 638 } |
641 const intptr_t dart_object_cid = | |
642 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
643 const bool is_checked_strict_equal = | 639 const bool is_checked_strict_equal = |
644 HasICData() && ic_data()->AllTargetsHaveSameOwner(dart_object_cid); | 640 HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); |
645 if (is_checked_strict_equal) { | 641 if (is_checked_strict_equal) { |
646 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, | 642 EmitCheckedStrictEqual(compiler, *ic_data(), *locs(), kind(), NULL, |
647 deopt_id(), token_pos(), try_index()); | 643 deopt_id(), token_pos(), try_index()); |
648 return; | 644 return; |
649 } | 645 } |
650 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 646 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
651 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), | 647 EmitGenericEqualityCompare(compiler, *locs(), kind(), NULL, *ic_data(), |
652 deopt_id(), token_pos(), try_index()); | 648 deopt_id(), token_pos(), try_index()); |
653 } else { | 649 } else { |
654 Register left = locs()->in(0).reg(); | 650 Register left = locs()->in(0).reg(); |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 if (ic_data.num_args_tested() != 2) return false; | 2030 if (ic_data.num_args_tested() != 2) return false; |
2035 if (ic_data.NumberOfChecks() != 1) return false; | 2031 if (ic_data.NumberOfChecks() != 1) return false; |
2036 Function& target = Function::Handle(); | 2032 Function& target = Function::Handle(); |
2037 GrowableArray<intptr_t> class_ids; | 2033 GrowableArray<intptr_t> class_ids; |
2038 ic_data.GetCheckAt(0, &class_ids, &target); | 2034 ic_data.GetCheckAt(0, &class_ids, &target); |
2039 return (class_ids[0] == class_id) && (class_ids[1] == class_id); | 2035 return (class_ids[0] == class_id) && (class_ids[1] == class_id); |
2040 } | 2036 } |
2041 | 2037 |
2042 | 2038 |
2043 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { | 2039 static bool IsCheckedStrictEquals(const ICData& ic_data, Token::Kind kind) { |
2044 const intptr_t dart_object_cid = | |
2045 Class::Handle(Isolate::Current()->object_store()->object_class()).id(); | |
2046 if ((kind == Token::kEQ) || (kind == Token::kNE)) { | 2040 if ((kind == Token::kEQ) || (kind == Token::kNE)) { |
2047 return ic_data.AllTargetsHaveSameOwner(dart_object_cid); | 2041 return ic_data.AllTargetsHaveSameOwner(kInstanceCid); |
2048 } | 2042 } |
2049 return false; | 2043 return false; |
2050 } | 2044 } |
2051 | 2045 |
2052 | 2046 |
2053 LocationSummary* BranchInstr::MakeLocationSummary() const { | 2047 LocationSummary* BranchInstr::MakeLocationSummary() const { |
2054 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2048 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
2055 const int kNumInputs = 2; | 2049 const int kNumInputs = 2; |
2056 const int kNumTemps = 0; | 2050 const int kNumTemps = 0; |
2057 LocationSummary* locs = | 2051 LocationSummary* locs = |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 } | 2204 } |
2211 } | 2205 } |
2212 __ Bind(&is_ok); | 2206 __ Bind(&is_ok); |
2213 } | 2207 } |
2214 | 2208 |
2215 } // namespace dart | 2209 } // namespace dart |
2216 | 2210 |
2217 #undef __ | 2211 #undef __ |
2218 | 2212 |
2219 #endif // defined TARGET_ARCH_X64 | 2213 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |