OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 return Bounds::Unbounded(zone()); | 1112 return Bounds::Unbounded(zone()); |
1113 } | 1113 } |
1114 | 1114 |
1115 | 1115 |
1116 // Returns a somewhat larger range if we previously assigned | 1116 // Returns a somewhat larger range if we previously assigned |
1117 // a (smaller) range to this node. This is used to speed up | 1117 // a (smaller) range to this node. This is used to speed up |
1118 // the fixpoint calculation in case there appears to be a loop | 1118 // the fixpoint calculation in case there appears to be a loop |
1119 // in the graph. In the current implementation, we are | 1119 // in the graph. In the current implementation, we are |
1120 // increasing the limits to the closest power of two. | 1120 // increasing the limits to the closest power of two. |
1121 Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) { | 1121 Type* Typer::Visitor::Weaken(Type* current_type, Type* previous_type) { |
1122 if (current_type->IsRange() && previous_type->IsRange()) { | 1122 Type::RangeType* previous = previous_type->GetRange(); |
1123 Type::RangeType* previous = previous_type->AsRange(); | 1123 Type::RangeType* current = current_type->GetRange(); |
1124 Type::RangeType* current = current_type->AsRange(); | 1124 if (previous != NULL && current != NULL) { |
1125 | |
1126 double current_min = current->Min()->Number(); | 1125 double current_min = current->Min()->Number(); |
1127 Handle<Object> new_min = current->Min(); | 1126 Handle<Object> new_min = current->Min(); |
1128 | 1127 |
1129 // Find the closest lower entry in the list of allowed | 1128 // Find the closest lower entry in the list of allowed |
1130 // minima (or negative infinity if there is no such entry). | 1129 // minima (or negative infinity if there is no such entry). |
1131 if (current_min != previous->Min()->Number()) { | 1130 if (current_min != previous->Min()->Number()) { |
1132 new_min = typer_->integer->AsRange()->Min(); | 1131 new_min = typer_->integer->AsRange()->Min(); |
1133 for (const auto val : typer_->weaken_min_limits_) { | 1132 for (const auto val : typer_->weaken_min_limits_) { |
1134 if (val->Number() <= current_min) { | 1133 if (val->Number() <= current_min) { |
1135 new_min = val; | 1134 new_min = val; |
1136 break; | 1135 break; |
1137 } | 1136 } |
1138 } | 1137 } |
1139 } | 1138 } |
1140 | 1139 |
1141 double current_max = current->Max()->Number(); | 1140 double current_max = current->Max()->Number(); |
1142 Handle<Object> new_max = current->Max(); | 1141 Handle<Object> new_max = current->Max(); |
1143 // Find the closest greater entry in the list of allowed | 1142 // Find the closest greater entry in the list of allowed |
1144 // maxima (or infinity if there is no such entry). | 1143 // maxima (or infinity if there is no such entry). |
1145 if (current_max != previous->Max()->Number()) { | 1144 if (current_max != previous->Max()->Number()) { |
1146 new_max = typer_->integer->AsRange()->Max(); | 1145 new_max = typer_->integer->AsRange()->Max(); |
1147 for (const auto val : typer_->weaken_max_limits_) { | 1146 for (const auto val : typer_->weaken_max_limits_) { |
1148 if (val->Number() >= current_max) { | 1147 if (val->Number() >= current_max) { |
1149 new_max = val; | 1148 new_max = val; |
1150 break; | 1149 break; |
1151 } | 1150 } |
1152 } | 1151 } |
1153 } | 1152 } |
1154 | 1153 |
1155 return Type::Range(new_min, new_max, typer_->zone()); | 1154 return Type::Union(current_type, |
| 1155 Type::Range(new_min, new_max, typer_->zone()), |
| 1156 typer_->zone()); |
1156 } | 1157 } |
1157 return current_type; | 1158 return current_type; |
1158 } | 1159 } |
1159 | 1160 |
1160 | 1161 |
1161 Bounds Typer::Visitor::TypeJSStoreProperty(Node* node) { | 1162 Bounds Typer::Visitor::TypeJSStoreProperty(Node* node) { |
1162 UNREACHABLE(); | 1163 UNREACHABLE(); |
1163 return Bounds(); | 1164 return Bounds(); |
1164 } | 1165 } |
1165 | 1166 |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 return typer_->float64_array_fun_; | 1933 return typer_->float64_array_fun_; |
1933 } | 1934 } |
1934 } | 1935 } |
1935 } | 1936 } |
1936 return Type::Constant(value, zone()); | 1937 return Type::Constant(value, zone()); |
1937 } | 1938 } |
1938 | 1939 |
1939 } | 1940 } |
1940 } | 1941 } |
1941 } // namespace v8::internal::compiler | 1942 } // namespace v8::internal::compiler |
OLD | NEW |