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/graph-reducer.h" | 7 #include "src/compiler/graph-reducer.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 Bounds BoundsOrNone(Node* node) { | 309 Bounds BoundsOrNone(Node* node) { |
310 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) | 310 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) |
311 : Bounds(Type::None()); | 311 : Bounds(Type::None()); |
312 } | 312 } |
313 | 313 |
314 Bounds Operand(Node* node, int i) { | 314 Bounds Operand(Node* node, int i) { |
315 Node* operand_node = NodeProperties::GetValueInput(node, i); | 315 Node* operand_node = NodeProperties::GetValueInput(node, i); |
316 return BoundsOrNone(operand_node); | 316 return BoundsOrNone(operand_node); |
317 } | 317 } |
318 | 318 |
319 Bounds ContextOperand(Node* node) { | 319 Bounds WrapContextBoundsForInput(Node* node); |
320 Bounds result = BoundsOrNone(NodeProperties::GetContextInput(node)); | |
321 DCHECK(result.upper->Maybe(Type::Internal())); | |
322 // TODO(rossberg): More precisely, instead of the above assertion, we should | |
323 // back-propagate the constraint that it has to be a subtype of Internal. | |
324 return result; | |
325 } | |
326 | |
327 Type* Weaken(Type* current_type, Type* previous_type); | 320 Type* Weaken(Type* current_type, Type* previous_type); |
328 | 321 |
329 Zone* zone() { return typer_->zone(); } | 322 Zone* zone() { return typer_->zone(); } |
330 Isolate* isolate() { return typer_->isolate(); } | 323 Isolate* isolate() { return typer_->isolate(); } |
331 Graph* graph() { return typer_->graph(); } | 324 Graph* graph() { return typer_->graph(); } |
332 MaybeHandle<Context> context() { return typer_->context(); } | 325 MaybeHandle<Context> context() { return typer_->context(); } |
333 | 326 |
334 typedef Type* (*UnaryTyperFun)(Type*, Typer* t); | 327 typedef Type* (*UnaryTyperFun)(Type*, Typer* t); |
335 typedef Type* (*BinaryTyperFun)(Type*, Type*, Typer* t); | 328 typedef Type* (*BinaryTyperFun)(Type*, Type*, Typer* t); |
336 | 329 |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 } | 1367 } |
1375 } | 1368 } |
1376 | 1369 |
1377 | 1370 |
1378 Bounds Typer::Visitor::TypeJSStoreContext(Node* node) { | 1371 Bounds Typer::Visitor::TypeJSStoreContext(Node* node) { |
1379 UNREACHABLE(); | 1372 UNREACHABLE(); |
1380 return Bounds(); | 1373 return Bounds(); |
1381 } | 1374 } |
1382 | 1375 |
1383 | 1376 |
| 1377 Bounds Typer::Visitor::WrapContextBoundsForInput(Node* node) { |
| 1378 Bounds outer = BoundsOrNone(NodeProperties::GetContextInput(node)); |
| 1379 if (outer.upper->Is(Type::None())) { |
| 1380 return Bounds(Type::None()); |
| 1381 } else { |
| 1382 DCHECK(outer.upper->Maybe(Type::Internal())); |
| 1383 return Bounds(Type::Context(outer.upper, zone())); |
| 1384 } |
| 1385 } |
| 1386 |
| 1387 |
1384 Bounds Typer::Visitor::TypeJSCreateFunctionContext(Node* node) { | 1388 Bounds Typer::Visitor::TypeJSCreateFunctionContext(Node* node) { |
1385 Bounds outer = ContextOperand(node); | 1389 return WrapContextBoundsForInput(node); |
1386 return Bounds(Type::Context(outer.upper, zone())); | |
1387 } | 1390 } |
1388 | 1391 |
1389 | 1392 |
1390 Bounds Typer::Visitor::TypeJSCreateCatchContext(Node* node) { | 1393 Bounds Typer::Visitor::TypeJSCreateCatchContext(Node* node) { |
1391 Bounds outer = ContextOperand(node); | 1394 return WrapContextBoundsForInput(node); |
1392 return Bounds(Type::Context(outer.upper, zone())); | |
1393 } | 1395 } |
1394 | 1396 |
1395 | 1397 |
1396 Bounds Typer::Visitor::TypeJSCreateWithContext(Node* node) { | 1398 Bounds Typer::Visitor::TypeJSCreateWithContext(Node* node) { |
1397 Bounds outer = ContextOperand(node); | 1399 return WrapContextBoundsForInput(node); |
1398 return Bounds(Type::Context(outer.upper, zone())); | |
1399 } | 1400 } |
1400 | 1401 |
1401 | 1402 |
1402 Bounds Typer::Visitor::TypeJSCreateBlockContext(Node* node) { | 1403 Bounds Typer::Visitor::TypeJSCreateBlockContext(Node* node) { |
1403 Bounds outer = ContextOperand(node); | 1404 return WrapContextBoundsForInput(node); |
1404 return Bounds(Type::Context(outer.upper, zone())); | |
1405 } | 1405 } |
1406 | 1406 |
1407 | 1407 |
1408 Bounds Typer::Visitor::TypeJSCreateModuleContext(Node* node) { | 1408 Bounds Typer::Visitor::TypeJSCreateModuleContext(Node* node) { |
1409 // TODO(rossberg): this is probably incorrect | 1409 // TODO(rossberg): this is probably incorrect |
1410 Bounds outer = ContextOperand(node); | 1410 return WrapContextBoundsForInput(node); |
1411 return Bounds(Type::Context(outer.upper, zone())); | |
1412 } | 1411 } |
1413 | 1412 |
1414 | 1413 |
1415 Bounds Typer::Visitor::TypeJSCreateScriptContext(Node* node) { | 1414 Bounds Typer::Visitor::TypeJSCreateScriptContext(Node* node) { |
1416 Bounds outer = ContextOperand(node); | 1415 return WrapContextBoundsForInput(node); |
1417 return Bounds(Type::Context(outer.upper, zone())); | |
1418 } | 1416 } |
1419 | 1417 |
1420 | 1418 |
1421 // JS other operators. | 1419 // JS other operators. |
1422 | 1420 |
1423 | 1421 |
1424 Bounds Typer::Visitor::TypeJSYield(Node* node) { | 1422 Bounds Typer::Visitor::TypeJSYield(Node* node) { |
1425 return Bounds::Unbounded(zone()); | 1423 return Bounds::Unbounded(zone()); |
1426 } | 1424 } |
1427 | 1425 |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2115 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2118 #undef TYPED_ARRAY_CASE | 2116 #undef TYPED_ARRAY_CASE |
2119 } | 2117 } |
2120 } | 2118 } |
2121 return Type::Constant(value, zone()); | 2119 return Type::Constant(value, zone()); |
2122 } | 2120 } |
2123 | 2121 |
2124 } // namespace compiler | 2122 } // namespace compiler |
2125 } // namespace internal | 2123 } // namespace internal |
2126 } // namespace v8 | 2124 } // namespace v8 |
OLD | NEW |