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 Type::RangeType* previous = previous_type->GetRange(); | 1122 if (current_type->IsRange() && previous_type->IsRange()) { |
1123 Type::RangeType* current = current_type->GetRange(); | 1123 Type::RangeType* previous = previous_type->AsRange(); |
1124 if (previous != NULL && current != NULL) { | 1124 Type::RangeType* current = current_type->AsRange(); |
| 1125 |
1125 double current_min = current->Min()->Number(); | 1126 double current_min = current->Min()->Number(); |
1126 Handle<Object> new_min = current->Min(); | 1127 Handle<Object> new_min = current->Min(); |
1127 | 1128 |
1128 // Find the closest lower entry in the list of allowed | 1129 // Find the closest lower entry in the list of allowed |
1129 // minima (or negative infinity if there is no such entry). | 1130 // minima (or negative infinity if there is no such entry). |
1130 if (current_min != previous->Min()->Number()) { | 1131 if (current_min != previous->Min()->Number()) { |
1131 new_min = typer_->integer->AsRange()->Min(); | 1132 new_min = typer_->integer->AsRange()->Min(); |
1132 for (const auto val : typer_->weaken_min_limits_) { | 1133 for (const auto val : typer_->weaken_min_limits_) { |
1133 if (val->Number() <= current_min) { | 1134 if (val->Number() <= current_min) { |
1134 new_min = val; | 1135 new_min = val; |
1135 break; | 1136 break; |
1136 } | 1137 } |
1137 } | 1138 } |
1138 } | 1139 } |
1139 | 1140 |
1140 double current_max = current->Max()->Number(); | 1141 double current_max = current->Max()->Number(); |
1141 Handle<Object> new_max = current->Max(); | 1142 Handle<Object> new_max = current->Max(); |
1142 // Find the closest greater entry in the list of allowed | 1143 // Find the closest greater entry in the list of allowed |
1143 // maxima (or infinity if there is no such entry). | 1144 // maxima (or infinity if there is no such entry). |
1144 if (current_max != previous->Max()->Number()) { | 1145 if (current_max != previous->Max()->Number()) { |
1145 new_max = typer_->integer->AsRange()->Max(); | 1146 new_max = typer_->integer->AsRange()->Max(); |
1146 for (const auto val : typer_->weaken_max_limits_) { | 1147 for (const auto val : typer_->weaken_max_limits_) { |
1147 if (val->Number() >= current_max) { | 1148 if (val->Number() >= current_max) { |
1148 new_max = val; | 1149 new_max = val; |
1149 break; | 1150 break; |
1150 } | 1151 } |
1151 } | 1152 } |
1152 } | 1153 } |
1153 | 1154 |
1154 return Type::Union(current_type, | 1155 return Type::Range(new_min, new_max, typer_->zone()); |
1155 Type::Range(new_min, new_max, typer_->zone()), | |
1156 typer_->zone()); | |
1157 } | 1156 } |
1158 return current_type; | 1157 return current_type; |
1159 } | 1158 } |
1160 | 1159 |
1161 | 1160 |
1162 Bounds Typer::Visitor::TypeJSStoreProperty(Node* node) { | 1161 Bounds Typer::Visitor::TypeJSStoreProperty(Node* node) { |
1163 UNREACHABLE(); | 1162 UNREACHABLE(); |
1164 return Bounds(); | 1163 return Bounds(); |
1165 } | 1164 } |
1166 | 1165 |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 return typer_->float64_array_fun_; | 1932 return typer_->float64_array_fun_; |
1934 } | 1933 } |
1935 } | 1934 } |
1936 } | 1935 } |
1937 return Type::Constant(value, zone()); | 1936 return Type::Constant(value, zone()); |
1938 } | 1937 } |
1939 | 1938 |
1940 } | 1939 } |
1941 } | 1940 } |
1942 } // namespace v8::internal::compiler | 1941 } // namespace v8::internal::compiler |
OLD | NEW |