Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2904543002: Fix misoptimization of 'is' test (Closed)
Patch Set: Feedback from Slava, do same optimization on AOT and JIT Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_DBC. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_DBC.
6 #if defined(TARGET_ARCH_DBC) 6 #if defined(TARGET_ARCH_DBC)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ASSERT(num_cases <= 255); 639 ASSERT(num_cases <= 255);
640 __ TestCids(value, num_cases); 640 __ TestCids(value, num_cases);
641 641
642 bool result = false; 642 bool result = false;
643 for (intptr_t i = 0; i < data.length(); i += 2) { 643 for (intptr_t i = 0; i < data.length(); i += 2) {
644 const intptr_t test_cid = data[i]; 644 const intptr_t test_cid = data[i];
645 result = data[i + 1] == true_result; 645 result = data[i + 1] == true_result;
646 __ Nop(result ? 1 : 0, compiler->ToEmbeddableCid(test_cid, this)); 646 __ Nop(result ? 1 : 0, compiler->ToEmbeddableCid(test_cid, this));
647 } 647 }
648 648
649 // No match found, deoptimize or false. 649 // No match found, deoptimize or default action.
650 if (CanDeoptimize()) { 650 if (CanDeoptimize()) {
651 compiler->EmitDeopt(deopt_id(), ICData::kDeoptTestCids, 651 compiler->EmitDeopt(deopt_id(), ICData::kDeoptTestCids,
652 licm_hoisted_ ? ICData::kHoisted : 0); 652 licm_hoisted_ ? ICData::kHoisted : 0);
653 } else { 653 } else {
654 // If the cid is not in the list, jump to the opposite label from the cids
655 // that are in the list. These must be all the same (see asserts in the
656 // constructor).
654 Label* target = result ? labels.false_label : labels.true_label; 657 Label* target = result ? labels.false_label : labels.true_label;
655 __ Jump(target); 658 __ Jump(target);
656 } 659 }
657 660
658 return NEXT_IS_TRUE; 661 return NEXT_IS_TRUE;
659 } 662 }
660 663
661 664
662 void TestCidsInstr::EmitBranchCode(FlowGraphCompiler* compiler, 665 void TestCidsInstr::EmitBranchCode(FlowGraphCompiler* compiler,
663 BranchInstr* branch) { 666 BranchInstr* branch) {
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 } 2076 }
2074 __ IfULe(length, index); 2077 __ IfULe(length, index);
2075 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, 2078 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound,
2076 (generalized_ ? ICData::kGeneralized : 0) | 2079 (generalized_ ? ICData::kGeneralized : 0) |
2077 (licm_hoisted_ ? ICData::kHoisted : 0)); 2080 (licm_hoisted_ ? ICData::kHoisted : 0));
2078 } 2081 }
2079 2082
2080 } // namespace dart 2083 } // namespace dart
2081 2084
2082 #endif // defined TARGET_ARCH_DBC 2085 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698