| 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/verifier.h" | 5 #include "src/compiler/verifier.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <deque> | 8 #include <deque> | 
| 9 #include <queue> | 9 #include <queue> | 
| 10 #include <sstream> | 10 #include <sstream> | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 48 | 48 | 
| 49   Zone* zone; | 49   Zone* zone; | 
| 50   Typing typing; | 50   Typing typing; | 
| 51 | 51 | 
| 52  private: | 52  private: | 
| 53   // TODO(rossberg): Get rid of these once we got rid of NodeProperties. | 53   // TODO(rossberg): Get rid of these once we got rid of NodeProperties. | 
| 54   Bounds bounds(Node* node) { return NodeProperties::GetBounds(node); } | 54   Bounds bounds(Node* node) { return NodeProperties::GetBounds(node); } | 
| 55   Node* ValueInput(Node* node, int i = 0) { | 55   Node* ValueInput(Node* node, int i = 0) { | 
| 56     return NodeProperties::GetValueInput(node, i); | 56     return NodeProperties::GetValueInput(node, i); | 
| 57   } | 57   } | 
| 58   FieldAccess Field(Node* node) { |  | 
| 59     DCHECK(node->opcode() == IrOpcode::kLoadField || |  | 
| 60            node->opcode() == IrOpcode::kStoreField); |  | 
| 61     return OpParameter<FieldAccess>(node); |  | 
| 62   } |  | 
| 63   ElementAccess Element(Node* node) { |  | 
| 64     DCHECK(node->opcode() == IrOpcode::kLoadElement || |  | 
| 65            node->opcode() == IrOpcode::kStoreElement); |  | 
| 66     return OpParameter<ElementAccess>(node); |  | 
| 67   } |  | 
| 68   void CheckNotTyped(Node* node) { | 58   void CheckNotTyped(Node* node) { | 
| 69     if (NodeProperties::IsTyped(node)) { | 59     if (NodeProperties::IsTyped(node)) { | 
| 70       std::ostringstream str; | 60       std::ostringstream str; | 
| 71       str << "TypeError: node #" << node->id() << ":" << *node->op() | 61       str << "TypeError: node #" << node->id() << ":" << *node->op() | 
| 72           << " should never have a type"; | 62           << " should never have a type"; | 
| 73       FATAL(str.str().c_str()); | 63       FATAL(str.str().c_str()); | 
| 74     } | 64     } | 
| 75   } | 65   } | 
| 76   void CheckUpperIs(Node* node, Type* type) { | 66   void CheckUpperIs(Node* node, Type* type) { | 
| 77     if (typing == TYPED && !bounds(node).upper->Is(type)) { | 67     if (typing == TYPED && !bounds(node).upper->Is(type)) { | 
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 707       // Type* to = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); | 697       // Type* to = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); | 
| 708       // CheckValueInputIs(node, 0, from)); | 698       // CheckValueInputIs(node, 0, from)); | 
| 709       // CheckUpperIs(node, to)); | 699       // CheckUpperIs(node, to)); | 
| 710       break; | 700       break; | 
| 711     } | 701     } | 
| 712 | 702 | 
| 713     case IrOpcode::kLoadField: | 703     case IrOpcode::kLoadField: | 
| 714       // Object -> fieldtype | 704       // Object -> fieldtype | 
| 715       // TODO(rossberg): activate once machine ops are typed. | 705       // TODO(rossberg): activate once machine ops are typed. | 
| 716       // CheckValueInputIs(node, 0, Type::Object()); | 706       // CheckValueInputIs(node, 0, Type::Object()); | 
| 717       // CheckUpperIs(node, Field(node).type)); | 707       // CheckUpperIs(node, FieldAccessOf(node->op()).type)); | 
| 718       break; | 708       break; | 
| 719     case IrOpcode::kLoadBuffer: | 709     case IrOpcode::kLoadBuffer: | 
| 720       break; | 710       break; | 
| 721     case IrOpcode::kLoadElement: | 711     case IrOpcode::kLoadElement: | 
| 722       // Object -> elementtype | 712       // Object -> elementtype | 
| 723       // TODO(rossberg): activate once machine ops are typed. | 713       // TODO(rossberg): activate once machine ops are typed. | 
| 724       // CheckValueInputIs(node, 0, Type::Object()); | 714       // CheckValueInputIs(node, 0, Type::Object()); | 
| 725       // CheckUpperIs(node, Element(node).type)); | 715       // CheckUpperIs(node, ElementAccessOf(node->op()).type)); | 
| 726       break; | 716       break; | 
| 727     case IrOpcode::kStoreField: | 717     case IrOpcode::kStoreField: | 
| 728       // (Object, fieldtype) -> _|_ | 718       // (Object, fieldtype) -> _|_ | 
| 729       // TODO(rossberg): activate once machine ops are typed. | 719       // TODO(rossberg): activate once machine ops are typed. | 
| 730       // CheckValueInputIs(node, 0, Type::Object()); | 720       // CheckValueInputIs(node, 0, Type::Object()); | 
| 731       // CheckValueInputIs(node, 1, Field(node).type)); | 721       // CheckValueInputIs(node, 1, FieldAccessOf(node->op()).type)); | 
| 732       CheckNotTyped(node); | 722       CheckNotTyped(node); | 
| 733       break; | 723       break; | 
| 734     case IrOpcode::kStoreBuffer: | 724     case IrOpcode::kStoreBuffer: | 
| 735       break; | 725       break; | 
| 736     case IrOpcode::kStoreElement: | 726     case IrOpcode::kStoreElement: | 
| 737       // (Object, elementtype) -> _|_ | 727       // (Object, elementtype) -> _|_ | 
| 738       // TODO(rossberg): activate once machine ops are typed. | 728       // TODO(rossberg): activate once machine ops are typed. | 
| 739       // CheckValueInputIs(node, 0, Type::Object()); | 729       // CheckValueInputIs(node, 0, Type::Object()); | 
| 740       // CheckValueInputIs(node, 1, Element(node).type)); | 730       // CheckValueInputIs(node, 1, ElementAccessOf(node->op()).type)); | 
| 741       CheckNotTyped(node); | 731       CheckNotTyped(node); | 
| 742       break; | 732       break; | 
| 743 | 733 | 
| 744     // Machine operators | 734     // Machine operators | 
| 745     // ----------------------- | 735     // ----------------------- | 
| 746     case IrOpcode::kLoad: | 736     case IrOpcode::kLoad: | 
| 747     case IrOpcode::kStore: | 737     case IrOpcode::kStore: | 
| 748     case IrOpcode::kWord32And: | 738     case IrOpcode::kWord32And: | 
| 749     case IrOpcode::kWord32Or: | 739     case IrOpcode::kWord32Or: | 
| 750     case IrOpcode::kWord32Xor: | 740     case IrOpcode::kWord32Xor: | 
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1091     // Check inputs for all nodes in the block. | 1081     // Check inputs for all nodes in the block. | 
| 1092     for (size_t i = 0; i < block->NodeCount(); i++) { | 1082     for (size_t i = 0; i < block->NodeCount(); i++) { | 
| 1093       Node* node = block->NodeAt(i); | 1083       Node* node = block->NodeAt(i); | 
| 1094       CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 1084       CheckInputsDominate(schedule, block, node, static_cast<int>(i) - 1); | 
| 1095     } | 1085     } | 
| 1096   } | 1086   } | 
| 1097 } | 1087 } | 
| 1098 } | 1088 } | 
| 1099 } | 1089 } | 
| 1100 }  // namespace v8::internal::compiler | 1090 }  // namespace v8::internal::compiler | 
| OLD | NEW | 
|---|