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

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

Issue 2914483002: Revert "Fix misoptimization of 'is' test" (Closed)
Patch Set: Created 3 years, 6 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.h ('k') | runtime/vm/intermediate_language_arm.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 const Object& constant_value = value()->BoundConstant(); 2729 const Object& constant_value = value()->BoundConstant();
2730 if (constant_value.IsSmi() && 2730 if (constant_value.IsSmi() &&
2731 cids_.Contains(Smi::Cast(constant_value).Value())) { 2731 cids_.Contains(Smi::Cast(constant_value).Value())) {
2732 return NULL; 2732 return NULL;
2733 } 2733 }
2734 } 2734 }
2735 return this; 2735 return this;
2736 } 2736 }
2737 2737
2738 2738
2739 TestCidsInstr::TestCidsInstr(TokenPosition token_pos,
2740 Token::Kind kind,
2741 Value* value,
2742 const ZoneGrowableArray<intptr_t>& cid_results,
2743 intptr_t deopt_id)
2744 : TemplateComparison(token_pos, kind, deopt_id),
2745 cid_results_(cid_results),
2746 licm_hoisted_(false) {
2747 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT));
2748 SetInputAt(0, value);
2749 set_operation_cid(kObjectCid);
2750 #ifdef DEBUG
2751 ASSERT(cid_results[0] == kSmiCid);
2752 if (deopt_id == Thread::kNoDeoptId) {
2753 // The entry for Smi can be special, but all other entries have
2754 // to match in the no-deopt case.
2755 for (intptr_t i = 4; i < cid_results.length(); i += 2) {
2756 ASSERT(cid_results[i + 1] == cid_results[3]);
2757 }
2758 }
2759 #endif
2760 }
2761
2762
2763 Definition* TestCidsInstr::Canonicalize(FlowGraph* flow_graph) { 2739 Definition* TestCidsInstr::Canonicalize(FlowGraph* flow_graph) {
2764 CompileType* in_type = left()->Type(); 2740 CompileType* in_type = left()->Type();
2765 intptr_t cid = in_type->ToCid(); 2741 intptr_t cid = in_type->ToCid();
2766 if (cid == kDynamicCid) return this; 2742 if (cid == kDynamicCid) return this;
2767 2743
2768 const ZoneGrowableArray<intptr_t>& data = cid_results(); 2744 const ZoneGrowableArray<intptr_t>& data = cid_results();
2769 const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; 2745 const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0;
2770 for (intptr_t i = 0; i < data.length(); i += 2) { 2746 for (intptr_t i = 0; i < data.length(); i += 2) {
2771 if (data[i] == cid) { 2747 if (data[i] == cid) {
2772 return (data[i + 1] == true_result) 2748 return (data[i + 1] == true_result)
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 "native function '%s' (%" Pd " arguments) cannot be found", 4331 "native function '%s' (%" Pd " arguments) cannot be found",
4356 native_name().ToCString(), function().NumParameters()); 4332 native_name().ToCString(), function().NumParameters());
4357 } 4333 }
4358 set_is_auto_scope(auto_setup_scope); 4334 set_is_auto_scope(auto_setup_scope);
4359 set_native_c_function(native_function); 4335 set_native_c_function(native_function);
4360 } 4336 }
4361 4337
4362 #undef __ 4338 #undef __
4363 4339
4364 } // namespace dart 4340 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698