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

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

Issue 12218181: Recognize pattern (a << b) & c with c being a positive Smi and allow left shift to truncate the res… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.h ('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) 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/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 return AttributesEqual(other); 60 return AttributesEqual(other);
61 } 61 }
62 62
63 63
64 bool Value::Equals(Value* other) const { 64 bool Value::Equals(Value* other) const {
65 return definition() == other->definition(); 65 return definition() == other->definition();
66 } 66 }
67 67
68 68
69
70 CheckClassInstr::CheckClassInstr(Value* value, 69 CheckClassInstr::CheckClassInstr(Value* value,
71 intptr_t deopt_id, 70 intptr_t deopt_id,
72 const ICData& unary_checks) 71 const ICData& unary_checks)
73 : unary_checks_(unary_checks) { 72 : unary_checks_(unary_checks) {
74 ASSERT(value != NULL); 73 ASSERT(value != NULL);
75 ASSERT(unary_checks.IsZoneHandle()); 74 ASSERT(unary_checks.IsZoneHandle());
76 // Expected useful check data. 75 // Expected useful check data.
77 ASSERT(!unary_checks_.IsNull() && 76 ASSERT(!unary_checks_.IsNull() &&
78 (unary_checks_.NumberOfChecks() > 0) && 77 (unary_checks_.NumberOfChecks() > 0) &&
79 (unary_checks_.num_args_tested() == 1)); 78 (unary_checks_.num_args_tested() == 1));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 StrictCompareInstr* other_op = other->AsStrictCompare(); 130 StrictCompareInstr* other_op = other->AsStrictCompare();
132 ASSERT(other_op != NULL); 131 ASSERT(other_op != NULL);
133 return kind() == other_op->kind(); 132 return kind() == other_op->kind();
134 } 133 }
135 134
136 135
137 bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const { 136 bool BinarySmiOpInstr::AttributesEqual(Instruction* other) const {
138 BinarySmiOpInstr* other_op = other->AsBinarySmiOp(); 137 BinarySmiOpInstr* other_op = other->AsBinarySmiOp();
139 ASSERT(other_op != NULL); 138 ASSERT(other_op != NULL);
140 return (op_kind() == other_op->op_kind()) && 139 return (op_kind() == other_op->op_kind()) &&
141 (overflow_ == other_op->overflow_); 140 (overflow_ == other_op->overflow_) &&
141 (is_truncating_ == other_op->is_truncating_);
142 } 142 }
143 143
144 144
145 bool LoadFieldInstr::AttributesEqual(Instruction* other) const { 145 bool LoadFieldInstr::AttributesEqual(Instruction* other) const {
146 LoadFieldInstr* other_load = other->AsLoadField(); 146 LoadFieldInstr* other_load = other->AsLoadField();
147 ASSERT(other_load != NULL); 147 ASSERT(other_load != NULL);
148 ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) || 148 ASSERT((offset_in_bytes() != other_load->offset_in_bytes()) ||
149 ((immutable_ == other_load->immutable_))); 149 ((immutable_ == other_load->immutable_)));
150 return offset_in_bytes() == other_load->offset_in_bytes(); 150 return offset_in_bytes() == other_load->offset_in_bytes();
151 } 151 }
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 case Token::kBIT_AND: 875 case Token::kBIT_AND:
876 case Token::kBIT_OR: 876 case Token::kBIT_OR:
877 case Token::kBIT_XOR: 877 case Token::kBIT_XOR:
878 return false; 878 return false;
879 case Token::kSHR: { 879 case Token::kSHR: {
880 // Can't deopt if shift-count is known positive. 880 // Can't deopt if shift-count is known positive.
881 Range* right_range = this->right()->definition()->range(); 881 Range* right_range = this->right()->definition()->range();
882 return (right_range == NULL) 882 return (right_range == NULL)
883 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity); 883 || !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
884 } 884 }
885 case Token::kSHL: {
886 Range* right_range = this->right()->definition()->range();
887 if ((right_range != NULL) && is_truncating()) {
888 // Can deoptimize if right can be negative.
889 return !right_range->IsWithin(0, RangeBoundary::kPlusInfinity);
890 }
891 return true;
892 }
885 default: 893 default:
886 return overflow_; 894 return overflow_;
887 } 895 }
888 } 896 }
889 897
890 898
891 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const { 899 bool BinarySmiOpInstr::RightIsPowerOfTwoConstant() const {
892 if (!right()->definition()->IsConstant()) return false; 900 if (!right()->definition()->IsConstant()) return false;
893 const Object& constant = right()->definition()->AsConstant()->value(); 901 const Object& constant = right()->definition()->AsConstant()->value();
894 if (!constant.IsSmi()) return false; 902 if (!constant.IsSmi()) return false;
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 default: 2236 default:
2229 UNREACHABLE(); 2237 UNREACHABLE();
2230 } 2238 }
2231 return kPowRuntimeEntry; 2239 return kPowRuntimeEntry;
2232 } 2240 }
2233 2241
2234 2242
2235 #undef __ 2243 #undef __
2236 2244
2237 } // namespace dart 2245 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698