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