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/compiler/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
6 #include "src/compiler/js-operator.h" | 6 #include "src/compiler/js-operator.h" |
7 #include "src/compiler/node.h" | 7 #include "src/compiler/node.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 486 |
487 Bounds Typer::Visitor::TypeJSInstanceOf(Node* node) { | 487 Bounds Typer::Visitor::TypeJSInstanceOf(Node* node) { |
488 return Bounds(Type::Boolean(zone())); | 488 return Bounds(Type::Boolean(zone())); |
489 } | 489 } |
490 | 490 |
491 | 491 |
492 // JS context operators. | 492 // JS context operators. |
493 | 493 |
494 Bounds Typer::Visitor::TypeJSLoadContext(Node* node) { | 494 Bounds Typer::Visitor::TypeJSLoadContext(Node* node) { |
495 Bounds outer = OperandType(node, 0); | 495 Bounds outer = OperandType(node, 0); |
496 DCHECK(outer.upper->Is(Type::Internal())); | 496 DCHECK(outer.upper->Maybe(Type::Internal())); |
497 DCHECK(outer.lower->Equals(outer.upper)); | 497 // TODO(rossberg): More precisely, instead of the above assertion, we should |
| 498 // back-propagate the constraint that it has to be a subtype of Internal. |
| 499 |
498 ContextAccess access = OpParameter<ContextAccess>(node); | 500 ContextAccess access = OpParameter<ContextAccess>(node); |
499 Type* context_type = outer.upper; | 501 Type* context_type = outer.upper; |
500 MaybeHandle<Context> context; | 502 MaybeHandle<Context> context; |
501 if (context_type->IsConstant()) { | 503 if (context_type->IsConstant()) { |
502 context = Handle<Context>::cast(context_type->AsConstant()->Value()); | 504 context = Handle<Context>::cast(context_type->AsConstant()->Value()); |
503 } | 505 } |
504 // Walk context chain (as far as known), mirroring dynamic lookup. | 506 // Walk context chain (as far as known), mirroring dynamic lookup. |
505 // Since contexts are mutable, the information is only useful as a lower | 507 // Since contexts are mutable, the information is only useful as a lower |
506 // bound. | 508 // bound. |
507 // TODO(rossberg): Could use scope info to fix upper bounds for constant | 509 // TODO(rossberg): Could use scope info to fix upper bounds for constant |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 848 } |
847 | 849 |
848 | 850 |
849 void Typer::DecorateGraph(Graph* graph) { | 851 void Typer::DecorateGraph(Graph* graph) { |
850 graph->AddDecorator(new (zone()) TyperDecorator(this)); | 852 graph->AddDecorator(new (zone()) TyperDecorator(this)); |
851 } | 853 } |
852 | 854 |
853 } | 855 } |
854 } | 856 } |
855 } // namespace v8::internal::compiler | 857 } // namespace v8::internal::compiler |
OLD | NEW |