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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 private: | 42 private: |
43 void CheckNotTyped(Node* node) { | 43 void CheckNotTyped(Node* node) { |
44 if (NodeProperties::IsTyped(node)) { | 44 if (NodeProperties::IsTyped(node)) { |
45 std::ostringstream str; | 45 std::ostringstream str; |
46 str << "TypeError: node #" << node->id() << ":" << *node->op() | 46 str << "TypeError: node #" << node->id() << ":" << *node->op() |
47 << " should never have a type"; | 47 << " should never have a type"; |
48 FATAL(str.str().c_str()); | 48 FATAL(str.str().c_str()); |
49 } | 49 } |
50 } | 50 } |
51 void CheckUpperIs(Node* node, Type* type) { | 51 void CheckTypeIs(Node* node, Type* type) { |
52 if (typing == TYPED && !NodeProperties::GetType(node)->Is(type)) { | 52 if (typing == TYPED && !NodeProperties::GetType(node)->Is(type)) { |
53 std::ostringstream str; | 53 std::ostringstream str; |
54 str << "TypeError: node #" << node->id() << ":" << *node->op() | 54 str << "TypeError: node #" << node->id() << ":" << *node->op() |
55 << " type "; | 55 << " type "; |
56 NodeProperties::GetType(node)->PrintTo(str); | 56 NodeProperties::GetType(node)->PrintTo(str); |
57 str << " is not "; | 57 str << " is not "; |
58 type->PrintTo(str); | 58 type->PrintTo(str); |
59 FATAL(str.str().c_str()); | 59 FATAL(str.str().c_str()); |
60 } | 60 } |
61 } | 61 } |
62 void CheckUpperMaybe(Node* node, Type* type) { | 62 void CheckTypeMaybe(Node* node, Type* type) { |
63 if (typing == TYPED && !NodeProperties::GetType(node)->Maybe(type)) { | 63 if (typing == TYPED && !NodeProperties::GetType(node)->Maybe(type)) { |
64 std::ostringstream str; | 64 std::ostringstream str; |
65 str << "TypeError: node #" << node->id() << ":" << *node->op() | 65 str << "TypeError: node #" << node->id() << ":" << *node->op() |
66 << " type "; | 66 << " type "; |
67 NodeProperties::GetType(node)->PrintTo(str); | 67 NodeProperties::GetType(node)->PrintTo(str); |
68 str << " must intersect "; | 68 str << " must intersect "; |
69 type->PrintTo(str); | 69 type->PrintTo(str); |
70 FATAL(str.str().c_str()); | 70 FATAL(str.str().c_str()); |
71 } | 71 } |
72 } | 72 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 switch (node->opcode()) { | 178 switch (node->opcode()) { |
179 case IrOpcode::kStart: | 179 case IrOpcode::kStart: |
180 // Start has no inputs. | 180 // Start has no inputs. |
181 CHECK_EQ(0, input_count); | 181 CHECK_EQ(0, input_count); |
182 // Type is a tuple. | 182 // Type is a tuple. |
183 // TODO(rossberg): Multiple outputs are currently typed as Internal. | 183 // TODO(rossberg): Multiple outputs are currently typed as Internal. |
184 CheckUpperIs(node, Type::Internal()); | 184 CheckTypeIs(node, Type::Internal()); |
185 break; | 185 break; |
186 case IrOpcode::kEnd: | 186 case IrOpcode::kEnd: |
187 // End has no outputs. | 187 // End has no outputs. |
188 CHECK(node->op()->ValueOutputCount() == 0); | 188 CHECK(node->op()->ValueOutputCount() == 0); |
189 CHECK(node->op()->EffectOutputCount() == 0); | 189 CHECK(node->op()->EffectOutputCount() == 0); |
190 CHECK(node->op()->ControlOutputCount() == 0); | 190 CHECK(node->op()->ControlOutputCount() == 0); |
191 // Type is empty. | 191 // Type is empty. |
192 CheckNotTyped(node); | 192 CheckNotTyped(node); |
193 break; | 193 break; |
194 case IrOpcode::kDead: | 194 case IrOpcode::kDead: |
(...skipping 28 matching lines...) Expand all Loading... |
223 CHECK(!input->op()->HasProperty(Operator::kNoThrow)); | 223 CHECK(!input->op()->HasProperty(Operator::kNoThrow)); |
224 // Type is empty. | 224 // Type is empty. |
225 CheckNotTyped(node); | 225 CheckNotTyped(node); |
226 break; | 226 break; |
227 } | 227 } |
228 case IrOpcode::kIfException: { | 228 case IrOpcode::kIfException: { |
229 // IfSuccess and IfException continuation only on throwing nodes. | 229 // IfSuccess and IfException continuation only on throwing nodes. |
230 Node* input = NodeProperties::GetControlInput(node, 0); | 230 Node* input = NodeProperties::GetControlInput(node, 0); |
231 CHECK(!input->op()->HasProperty(Operator::kNoThrow)); | 231 CHECK(!input->op()->HasProperty(Operator::kNoThrow)); |
232 // Type can be anything. | 232 // Type can be anything. |
233 CheckUpperIs(node, Type::Any()); | 233 CheckTypeIs(node, Type::Any()); |
234 break; | 234 break; |
235 } | 235 } |
236 case IrOpcode::kSwitch: { | 236 case IrOpcode::kSwitch: { |
237 // Switch uses are Case and Default. | 237 // Switch uses are Case and Default. |
238 int count_case = 0, count_default = 0; | 238 int count_case = 0, count_default = 0; |
239 for (const Node* use : node->uses()) { | 239 for (const Node* use : node->uses()) { |
240 switch (use->opcode()) { | 240 switch (use->opcode()) { |
241 case IrOpcode::kIfValue: { | 241 case IrOpcode::kIfValue: { |
242 for (const Node* user : node->uses()) { | 242 for (const Node* user : node->uses()) { |
243 if (user != use && user->opcode() == IrOpcode::kIfValue) { | 243 if (user != use && user->opcode() == IrOpcode::kIfValue) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // Parameters have the start node as inputs. | 323 // Parameters have the start node as inputs. |
324 CHECK_EQ(1, input_count); | 324 CHECK_EQ(1, input_count); |
325 // Parameter has an input that produces enough values. | 325 // Parameter has an input that produces enough values. |
326 int const index = ParameterIndexOf(node->op()); | 326 int const index = ParameterIndexOf(node->op()); |
327 Node* const start = NodeProperties::GetValueInput(node, 0); | 327 Node* const start = NodeProperties::GetValueInput(node, 0); |
328 CHECK_EQ(IrOpcode::kStart, start->opcode()); | 328 CHECK_EQ(IrOpcode::kStart, start->opcode()); |
329 // Currently, parameter indices start at -1 instead of 0. | 329 // Currently, parameter indices start at -1 instead of 0. |
330 CHECK_LE(-1, index); | 330 CHECK_LE(-1, index); |
331 CHECK_LT(index + 1, start->op()->ValueOutputCount()); | 331 CHECK_LT(index + 1, start->op()->ValueOutputCount()); |
332 // Type can be anything. | 332 // Type can be anything. |
333 CheckUpperIs(node, Type::Any()); | 333 CheckTypeIs(node, Type::Any()); |
334 break; | 334 break; |
335 } | 335 } |
336 case IrOpcode::kInt32Constant: // TODO(rossberg): rename Word32Constant? | 336 case IrOpcode::kInt32Constant: // TODO(rossberg): rename Word32Constant? |
337 // Constants have no inputs. | 337 // Constants have no inputs. |
338 CHECK_EQ(0, input_count); | 338 CHECK_EQ(0, input_count); |
339 // Type is a 32 bit integer, signed or unsigned. | 339 // Type is a 32 bit integer, signed or unsigned. |
340 CheckUpperIs(node, Type::Integral32()); | 340 CheckTypeIs(node, Type::Integral32()); |
341 break; | 341 break; |
342 case IrOpcode::kInt64Constant: | 342 case IrOpcode::kInt64Constant: |
343 // Constants have no inputs. | 343 // Constants have no inputs. |
344 CHECK_EQ(0, input_count); | 344 CHECK_EQ(0, input_count); |
345 // Type is internal. | 345 // Type is internal. |
346 // TODO(rossberg): Introduce proper Int64 type. | 346 // TODO(rossberg): Introduce proper Int64 type. |
347 CheckUpperIs(node, Type::Internal()); | 347 CheckTypeIs(node, Type::Internal()); |
348 break; | 348 break; |
349 case IrOpcode::kFloat32Constant: | 349 case IrOpcode::kFloat32Constant: |
350 case IrOpcode::kFloat64Constant: | 350 case IrOpcode::kFloat64Constant: |
351 case IrOpcode::kNumberConstant: | 351 case IrOpcode::kNumberConstant: |
352 // Constants have no inputs. | 352 // Constants have no inputs. |
353 CHECK_EQ(0, input_count); | 353 CHECK_EQ(0, input_count); |
354 // Type is a number. | 354 // Type is a number. |
355 CheckUpperIs(node, Type::Number()); | 355 CheckTypeIs(node, Type::Number()); |
356 break; | 356 break; |
357 case IrOpcode::kRelocatableInt32Constant: | 357 case IrOpcode::kRelocatableInt32Constant: |
358 case IrOpcode::kRelocatableInt64Constant: | 358 case IrOpcode::kRelocatableInt64Constant: |
359 CHECK_EQ(0, input_count); | 359 CHECK_EQ(0, input_count); |
360 break; | 360 break; |
361 case IrOpcode::kHeapConstant: | 361 case IrOpcode::kHeapConstant: |
362 // Constants have no inputs. | 362 // Constants have no inputs. |
363 CHECK_EQ(0, input_count); | 363 CHECK_EQ(0, input_count); |
364 // Type can be anything represented as a heap pointer. | 364 // Type can be anything represented as a heap pointer. |
365 CheckUpperIs(node, Type::TaggedPointer()); | 365 CheckTypeIs(node, Type::TaggedPointer()); |
366 break; | 366 break; |
367 case IrOpcode::kExternalConstant: | 367 case IrOpcode::kExternalConstant: |
368 // Constants have no inputs. | 368 // Constants have no inputs. |
369 CHECK_EQ(0, input_count); | 369 CHECK_EQ(0, input_count); |
370 // Type is considered internal. | 370 // Type is considered internal. |
371 CheckUpperIs(node, Type::Internal()); | 371 CheckTypeIs(node, Type::Internal()); |
372 break; | 372 break; |
373 case IrOpcode::kOsrValue: | 373 case IrOpcode::kOsrValue: |
374 // OSR values have a value and a control input. | 374 // OSR values have a value and a control input. |
375 CHECK_EQ(1, control_count); | 375 CHECK_EQ(1, control_count); |
376 CHECK_EQ(1, input_count); | 376 CHECK_EQ(1, input_count); |
377 // Type is merged from other values in the graph and could be any. | 377 // Type is merged from other values in the graph and could be any. |
378 CheckUpperIs(node, Type::Any()); | 378 CheckTypeIs(node, Type::Any()); |
379 break; | 379 break; |
380 case IrOpcode::kProjection: { | 380 case IrOpcode::kProjection: { |
381 // Projection has an input that produces enough values. | 381 // Projection has an input that produces enough values. |
382 int index = static_cast<int>(ProjectionIndexOf(node->op())); | 382 int index = static_cast<int>(ProjectionIndexOf(node->op())); |
383 Node* input = NodeProperties::GetValueInput(node, 0); | 383 Node* input = NodeProperties::GetValueInput(node, 0); |
384 CHECK_GT(input->op()->ValueOutputCount(), index); | 384 CHECK_GT(input->op()->ValueOutputCount(), index); |
385 // Type can be anything. | 385 // Type can be anything. |
386 // TODO(rossberg): Introduce tuple types for this. | 386 // TODO(rossberg): Introduce tuple types for this. |
387 // TODO(titzer): Convince rossberg not to. | 387 // TODO(titzer): Convince rossberg not to. |
388 CheckUpperIs(node, Type::Any()); | 388 CheckTypeIs(node, Type::Any()); |
389 break; | 389 break; |
390 } | 390 } |
391 case IrOpcode::kSelect: { | 391 case IrOpcode::kSelect: { |
392 CHECK_EQ(0, effect_count); | 392 CHECK_EQ(0, effect_count); |
393 CHECK_EQ(0, control_count); | 393 CHECK_EQ(0, control_count); |
394 CHECK_EQ(3, value_count); | 394 CHECK_EQ(3, value_count); |
395 break; | 395 break; |
396 } | 396 } |
397 case IrOpcode::kPhi: { | 397 case IrOpcode::kPhi: { |
398 // Phi input count matches parent control node. | 398 // Phi input count matches parent control node. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 // -------------------- | 488 // -------------------- |
489 case IrOpcode::kJSEqual: | 489 case IrOpcode::kJSEqual: |
490 case IrOpcode::kJSNotEqual: | 490 case IrOpcode::kJSNotEqual: |
491 case IrOpcode::kJSStrictEqual: | 491 case IrOpcode::kJSStrictEqual: |
492 case IrOpcode::kJSStrictNotEqual: | 492 case IrOpcode::kJSStrictNotEqual: |
493 case IrOpcode::kJSLessThan: | 493 case IrOpcode::kJSLessThan: |
494 case IrOpcode::kJSGreaterThan: | 494 case IrOpcode::kJSGreaterThan: |
495 case IrOpcode::kJSLessThanOrEqual: | 495 case IrOpcode::kJSLessThanOrEqual: |
496 case IrOpcode::kJSGreaterThanOrEqual: | 496 case IrOpcode::kJSGreaterThanOrEqual: |
497 // Type is Boolean. | 497 // Type is Boolean. |
498 CheckUpperIs(node, Type::Boolean()); | 498 CheckTypeIs(node, Type::Boolean()); |
499 break; | 499 break; |
500 | 500 |
501 case IrOpcode::kJSBitwiseOr: | 501 case IrOpcode::kJSBitwiseOr: |
502 case IrOpcode::kJSBitwiseXor: | 502 case IrOpcode::kJSBitwiseXor: |
503 case IrOpcode::kJSBitwiseAnd: | 503 case IrOpcode::kJSBitwiseAnd: |
504 case IrOpcode::kJSShiftLeft: | 504 case IrOpcode::kJSShiftLeft: |
505 case IrOpcode::kJSShiftRight: | 505 case IrOpcode::kJSShiftRight: |
506 case IrOpcode::kJSShiftRightLogical: | 506 case IrOpcode::kJSShiftRightLogical: |
507 // Type is 32 bit integral. | 507 // Type is 32 bit integral. |
508 CheckUpperIs(node, Type::Integral32()); | 508 CheckTypeIs(node, Type::Integral32()); |
509 break; | 509 break; |
510 case IrOpcode::kJSAdd: | 510 case IrOpcode::kJSAdd: |
511 // Type is Number or String. | 511 // Type is Number or String. |
512 CheckUpperIs(node, Type::NumberOrString()); | 512 CheckTypeIs(node, Type::NumberOrString()); |
513 break; | 513 break; |
514 case IrOpcode::kJSSubtract: | 514 case IrOpcode::kJSSubtract: |
515 case IrOpcode::kJSMultiply: | 515 case IrOpcode::kJSMultiply: |
516 case IrOpcode::kJSDivide: | 516 case IrOpcode::kJSDivide: |
517 case IrOpcode::kJSModulus: | 517 case IrOpcode::kJSModulus: |
518 // Type is Number. | 518 // Type is Number. |
519 CheckUpperIs(node, Type::Number()); | 519 CheckTypeIs(node, Type::Number()); |
520 break; | 520 break; |
521 | 521 |
522 case IrOpcode::kJSToBoolean: | 522 case IrOpcode::kJSToBoolean: |
523 // Type is Boolean. | 523 // Type is Boolean. |
524 CheckUpperIs(node, Type::Boolean()); | 524 CheckTypeIs(node, Type::Boolean()); |
525 break; | 525 break; |
526 case IrOpcode::kJSToInteger: | 526 case IrOpcode::kJSToInteger: |
527 // Type is OrderedNumber. | 527 // Type is OrderedNumber. |
528 CheckUpperIs(node, Type::OrderedNumber()); | 528 CheckTypeIs(node, Type::OrderedNumber()); |
529 break; | 529 break; |
530 case IrOpcode::kJSToLength: | 530 case IrOpcode::kJSToLength: |
531 // Type is OrderedNumber. | 531 // Type is OrderedNumber. |
532 CheckUpperIs(node, Type::OrderedNumber()); | 532 CheckTypeIs(node, Type::OrderedNumber()); |
533 break; | 533 break; |
534 case IrOpcode::kJSToName: | 534 case IrOpcode::kJSToName: |
535 // Type is Name. | 535 // Type is Name. |
536 CheckUpperIs(node, Type::Name()); | 536 CheckTypeIs(node, Type::Name()); |
537 break; | 537 break; |
538 case IrOpcode::kJSToNumber: | 538 case IrOpcode::kJSToNumber: |
539 // Type is Number. | 539 // Type is Number. |
540 CheckUpperIs(node, Type::Number()); | 540 CheckTypeIs(node, Type::Number()); |
541 break; | 541 break; |
542 case IrOpcode::kJSToString: | 542 case IrOpcode::kJSToString: |
543 // Type is String. | 543 // Type is String. |
544 CheckUpperIs(node, Type::String()); | 544 CheckTypeIs(node, Type::String()); |
545 break; | 545 break; |
546 case IrOpcode::kJSToObject: | 546 case IrOpcode::kJSToObject: |
547 // Type is Receiver. | 547 // Type is Receiver. |
548 CheckUpperIs(node, Type::Receiver()); | 548 CheckTypeIs(node, Type::Receiver()); |
549 break; | 549 break; |
550 | 550 |
551 case IrOpcode::kJSCreate: | 551 case IrOpcode::kJSCreate: |
552 // Type is Object. | 552 // Type is Object. |
553 CheckUpperIs(node, Type::Object()); | 553 CheckTypeIs(node, Type::Object()); |
554 break; | 554 break; |
555 case IrOpcode::kJSCreateArguments: | 555 case IrOpcode::kJSCreateArguments: |
556 // Type is OtherObject. | 556 // Type is OtherObject. |
557 CheckUpperIs(node, Type::OtherObject()); | 557 CheckTypeIs(node, Type::OtherObject()); |
558 break; | 558 break; |
559 case IrOpcode::kJSCreateArray: | 559 case IrOpcode::kJSCreateArray: |
560 // Type is OtherObject. | 560 // Type is OtherObject. |
561 CheckUpperIs(node, Type::OtherObject()); | 561 CheckTypeIs(node, Type::OtherObject()); |
562 break; | 562 break; |
563 case IrOpcode::kJSCreateClosure: | 563 case IrOpcode::kJSCreateClosure: |
564 // Type is Function. | 564 // Type is Function. |
565 CheckUpperIs(node, Type::Function()); | 565 CheckTypeIs(node, Type::Function()); |
566 break; | 566 break; |
567 case IrOpcode::kJSCreateIterResultObject: | 567 case IrOpcode::kJSCreateIterResultObject: |
568 // Type is OtherObject. | 568 // Type is OtherObject. |
569 CheckUpperIs(node, Type::OtherObject()); | 569 CheckTypeIs(node, Type::OtherObject()); |
570 break; | 570 break; |
571 case IrOpcode::kJSCreateLiteralArray: | 571 case IrOpcode::kJSCreateLiteralArray: |
572 case IrOpcode::kJSCreateLiteralObject: | 572 case IrOpcode::kJSCreateLiteralObject: |
573 case IrOpcode::kJSCreateLiteralRegExp: | 573 case IrOpcode::kJSCreateLiteralRegExp: |
574 // Type is OtherObject. | 574 // Type is OtherObject. |
575 CheckUpperIs(node, Type::OtherObject()); | 575 CheckTypeIs(node, Type::OtherObject()); |
576 break; | 576 break; |
577 case IrOpcode::kJSLoadProperty: | 577 case IrOpcode::kJSLoadProperty: |
578 case IrOpcode::kJSLoadNamed: | 578 case IrOpcode::kJSLoadNamed: |
579 case IrOpcode::kJSLoadGlobal: | 579 case IrOpcode::kJSLoadGlobal: |
580 // Type can be anything. | 580 // Type can be anything. |
581 CheckUpperIs(node, Type::Any()); | 581 CheckTypeIs(node, Type::Any()); |
582 break; | 582 break; |
583 case IrOpcode::kJSStoreProperty: | 583 case IrOpcode::kJSStoreProperty: |
584 case IrOpcode::kJSStoreNamed: | 584 case IrOpcode::kJSStoreNamed: |
585 case IrOpcode::kJSStoreGlobal: | 585 case IrOpcode::kJSStoreGlobal: |
586 // Type is empty. | 586 // Type is empty. |
587 CheckNotTyped(node); | 587 CheckNotTyped(node); |
588 break; | 588 break; |
589 case IrOpcode::kJSDeleteProperty: | 589 case IrOpcode::kJSDeleteProperty: |
590 case IrOpcode::kJSHasProperty: | 590 case IrOpcode::kJSHasProperty: |
591 case IrOpcode::kJSInstanceOf: | 591 case IrOpcode::kJSInstanceOf: |
592 // Type is Boolean. | 592 // Type is Boolean. |
593 CheckUpperIs(node, Type::Boolean()); | 593 CheckTypeIs(node, Type::Boolean()); |
594 break; | 594 break; |
595 case IrOpcode::kJSTypeOf: | 595 case IrOpcode::kJSTypeOf: |
596 // Type is String. | 596 // Type is String. |
597 CheckUpperIs(node, Type::String()); | 597 CheckTypeIs(node, Type::String()); |
598 break; | 598 break; |
599 | 599 |
600 case IrOpcode::kJSLoadContext: | 600 case IrOpcode::kJSLoadContext: |
601 // Type can be anything. | 601 // Type can be anything. |
602 CheckUpperIs(node, Type::Any()); | 602 CheckTypeIs(node, Type::Any()); |
603 break; | 603 break; |
604 case IrOpcode::kJSStoreContext: | 604 case IrOpcode::kJSStoreContext: |
605 // Type is empty. | 605 // Type is empty. |
606 CheckNotTyped(node); | 606 CheckNotTyped(node); |
607 break; | 607 break; |
608 case IrOpcode::kJSCreateFunctionContext: | 608 case IrOpcode::kJSCreateFunctionContext: |
609 case IrOpcode::kJSCreateCatchContext: | 609 case IrOpcode::kJSCreateCatchContext: |
610 case IrOpcode::kJSCreateWithContext: | 610 case IrOpcode::kJSCreateWithContext: |
611 case IrOpcode::kJSCreateBlockContext: | 611 case IrOpcode::kJSCreateBlockContext: |
612 case IrOpcode::kJSCreateScriptContext: { | 612 case IrOpcode::kJSCreateScriptContext: { |
613 // Type is Context, and operand is Internal. | 613 // Type is Context, and operand is Internal. |
614 Node* context = NodeProperties::GetContextInput(node); | 614 Node* context = NodeProperties::GetContextInput(node); |
615 // TODO(rossberg): This should really be Is(Internal), but the typer | 615 // TODO(rossberg): This should really be Is(Internal), but the typer |
616 // currently can't do backwards propagation. | 616 // currently can't do backwards propagation. |
617 CheckUpperMaybe(context, Type::Internal()); | 617 CheckTypeMaybe(context, Type::Internal()); |
618 if (typing == TYPED) CHECK(NodeProperties::GetType(node)->IsContext()); | 618 if (typing == TYPED) CHECK(NodeProperties::GetType(node)->IsContext()); |
619 break; | 619 break; |
620 } | 620 } |
621 | 621 |
622 case IrOpcode::kJSCallConstruct: | 622 case IrOpcode::kJSCallConstruct: |
623 case IrOpcode::kJSConvertReceiver: | 623 case IrOpcode::kJSConvertReceiver: |
624 // Type is Receiver. | 624 // Type is Receiver. |
625 CheckUpperIs(node, Type::Receiver()); | 625 CheckTypeIs(node, Type::Receiver()); |
626 break; | 626 break; |
627 case IrOpcode::kJSCallFunction: | 627 case IrOpcode::kJSCallFunction: |
628 case IrOpcode::kJSCallRuntime: | 628 case IrOpcode::kJSCallRuntime: |
629 // Type can be anything. | 629 // Type can be anything. |
630 CheckUpperIs(node, Type::Any()); | 630 CheckTypeIs(node, Type::Any()); |
631 break; | 631 break; |
632 | 632 |
633 case IrOpcode::kJSForInPrepare: { | 633 case IrOpcode::kJSForInPrepare: { |
634 // TODO(bmeurer): What are the constraints on thse? | 634 // TODO(bmeurer): What are the constraints on thse? |
635 CheckUpperIs(node, Type::Any()); | 635 CheckTypeIs(node, Type::Any()); |
636 break; | 636 break; |
637 } | 637 } |
638 case IrOpcode::kJSForInNext: { | 638 case IrOpcode::kJSForInNext: { |
639 CheckUpperIs(node, Type::Union(Type::Name(), Type::Undefined(), zone)); | 639 CheckTypeIs(node, Type::Union(Type::Name(), Type::Undefined(), zone)); |
640 break; | 640 break; |
641 } | 641 } |
642 | 642 |
643 case IrOpcode::kJSLoadMessage: | 643 case IrOpcode::kJSLoadMessage: |
644 case IrOpcode::kJSStoreMessage: | 644 case IrOpcode::kJSStoreMessage: |
645 break; | 645 break; |
646 | 646 |
647 case IrOpcode::kJSGeneratorStore: | 647 case IrOpcode::kJSGeneratorStore: |
648 CheckNotTyped(node); | 648 CheckNotTyped(node); |
649 break; | 649 break; |
650 | 650 |
651 case IrOpcode::kJSGeneratorRestoreContinuation: | 651 case IrOpcode::kJSGeneratorRestoreContinuation: |
652 CheckUpperIs(node, Type::SignedSmall()); | 652 CheckTypeIs(node, Type::SignedSmall()); |
653 break; | 653 break; |
654 | 654 |
655 case IrOpcode::kJSGeneratorRestoreRegister: | 655 case IrOpcode::kJSGeneratorRestoreRegister: |
656 CheckUpperIs(node, Type::Any()); | 656 CheckTypeIs(node, Type::Any()); |
657 break; | 657 break; |
658 | 658 |
659 case IrOpcode::kJSStackCheck: | 659 case IrOpcode::kJSStackCheck: |
660 // Type is empty. | 660 // Type is empty. |
661 CheckNotTyped(node); | 661 CheckNotTyped(node); |
662 break; | 662 break; |
663 | 663 |
664 case IrOpcode::kComment: | 664 case IrOpcode::kComment: |
665 case IrOpcode::kDebugBreak: | 665 case IrOpcode::kDebugBreak: |
666 case IrOpcode::kRetain: | 666 case IrOpcode::kRetain: |
667 case IrOpcode::kUnsafePointerAdd: | 667 case IrOpcode::kUnsafePointerAdd: |
668 CheckNotTyped(node); | 668 CheckNotTyped(node); |
669 break; | 669 break; |
670 | 670 |
671 // Simplified operators | 671 // Simplified operators |
672 // ------------------------------- | 672 // ------------------------------- |
673 case IrOpcode::kBooleanNot: | 673 case IrOpcode::kBooleanNot: |
674 // Boolean -> Boolean | 674 // Boolean -> Boolean |
675 CheckValueInputIs(node, 0, Type::Boolean()); | 675 CheckValueInputIs(node, 0, Type::Boolean()); |
676 CheckUpperIs(node, Type::Boolean()); | 676 CheckTypeIs(node, Type::Boolean()); |
677 break; | 677 break; |
678 case IrOpcode::kNumberEqual: | 678 case IrOpcode::kNumberEqual: |
679 // (Number, Number) -> Boolean | 679 // (Number, Number) -> Boolean |
680 CheckValueInputIs(node, 0, Type::Number()); | 680 CheckValueInputIs(node, 0, Type::Number()); |
681 CheckValueInputIs(node, 1, Type::Number()); | 681 CheckValueInputIs(node, 1, Type::Number()); |
682 CheckUpperIs(node, Type::Boolean()); | 682 CheckTypeIs(node, Type::Boolean()); |
683 break; | 683 break; |
684 case IrOpcode::kNumberLessThan: | 684 case IrOpcode::kNumberLessThan: |
685 case IrOpcode::kNumberLessThanOrEqual: | 685 case IrOpcode::kNumberLessThanOrEqual: |
686 // (Number, Number) -> Boolean | 686 // (Number, Number) -> Boolean |
687 CheckValueInputIs(node, 0, Type::Number()); | 687 CheckValueInputIs(node, 0, Type::Number()); |
688 CheckValueInputIs(node, 1, Type::Number()); | 688 CheckValueInputIs(node, 1, Type::Number()); |
689 CheckUpperIs(node, Type::Boolean()); | 689 CheckTypeIs(node, Type::Boolean()); |
690 break; | 690 break; |
691 case IrOpcode::kSpeculativeNumberAdd: | 691 case IrOpcode::kSpeculativeNumberAdd: |
692 case IrOpcode::kSpeculativeNumberSubtract: | 692 case IrOpcode::kSpeculativeNumberSubtract: |
693 case IrOpcode::kSpeculativeNumberMultiply: | 693 case IrOpcode::kSpeculativeNumberMultiply: |
694 case IrOpcode::kSpeculativeNumberDivide: | 694 case IrOpcode::kSpeculativeNumberDivide: |
695 case IrOpcode::kSpeculativeNumberModulus: | 695 case IrOpcode::kSpeculativeNumberModulus: |
696 CheckUpperIs(node, Type::Number()); | 696 CheckTypeIs(node, Type::Number()); |
697 break; | 697 break; |
698 case IrOpcode::kSpeculativeNumberEqual: | 698 case IrOpcode::kSpeculativeNumberEqual: |
699 case IrOpcode::kSpeculativeNumberLessThan: | 699 case IrOpcode::kSpeculativeNumberLessThan: |
700 case IrOpcode::kSpeculativeNumberLessThanOrEqual: | 700 case IrOpcode::kSpeculativeNumberLessThanOrEqual: |
701 CheckUpperIs(node, Type::Boolean()); | 701 CheckTypeIs(node, Type::Boolean()); |
702 break; | 702 break; |
703 case IrOpcode::kNumberAdd: | 703 case IrOpcode::kNumberAdd: |
704 case IrOpcode::kNumberSubtract: | 704 case IrOpcode::kNumberSubtract: |
705 case IrOpcode::kNumberMultiply: | 705 case IrOpcode::kNumberMultiply: |
706 case IrOpcode::kNumberDivide: | 706 case IrOpcode::kNumberDivide: |
707 // (Number, Number) -> Number | 707 // (Number, Number) -> Number |
708 CheckValueInputIs(node, 0, Type::Number()); | 708 CheckValueInputIs(node, 0, Type::Number()); |
709 CheckValueInputIs(node, 1, Type::Number()); | 709 CheckValueInputIs(node, 1, Type::Number()); |
710 CheckUpperIs(node, Type::Number()); | 710 CheckTypeIs(node, Type::Number()); |
711 break; | 711 break; |
712 case IrOpcode::kNumberModulus: | 712 case IrOpcode::kNumberModulus: |
713 // (Number, Number) -> Number | 713 // (Number, Number) -> Number |
714 CheckValueInputIs(node, 0, Type::Number()); | 714 CheckValueInputIs(node, 0, Type::Number()); |
715 CheckValueInputIs(node, 1, Type::Number()); | 715 CheckValueInputIs(node, 1, Type::Number()); |
716 CheckUpperIs(node, Type::Number()); | 716 CheckTypeIs(node, Type::Number()); |
717 break; | 717 break; |
718 case IrOpcode::kNumberBitwiseOr: | 718 case IrOpcode::kNumberBitwiseOr: |
719 case IrOpcode::kNumberBitwiseXor: | 719 case IrOpcode::kNumberBitwiseXor: |
720 case IrOpcode::kNumberBitwiseAnd: | 720 case IrOpcode::kNumberBitwiseAnd: |
721 // (Signed32, Signed32) -> Signed32 | 721 // (Signed32, Signed32) -> Signed32 |
722 CheckValueInputIs(node, 0, Type::Signed32()); | 722 CheckValueInputIs(node, 0, Type::Signed32()); |
723 CheckValueInputIs(node, 1, Type::Signed32()); | 723 CheckValueInputIs(node, 1, Type::Signed32()); |
724 CheckUpperIs(node, Type::Signed32()); | 724 CheckTypeIs(node, Type::Signed32()); |
725 break; | 725 break; |
726 case IrOpcode::kSpeculativeNumberBitwiseOr: | 726 case IrOpcode::kSpeculativeNumberBitwiseOr: |
727 case IrOpcode::kSpeculativeNumberBitwiseXor: | 727 case IrOpcode::kSpeculativeNumberBitwiseXor: |
728 case IrOpcode::kSpeculativeNumberBitwiseAnd: | 728 case IrOpcode::kSpeculativeNumberBitwiseAnd: |
729 CheckUpperIs(node, Type::Signed32()); | 729 CheckTypeIs(node, Type::Signed32()); |
730 break; | 730 break; |
731 case IrOpcode::kNumberShiftLeft: | 731 case IrOpcode::kNumberShiftLeft: |
732 case IrOpcode::kNumberShiftRight: | 732 case IrOpcode::kNumberShiftRight: |
733 // (Signed32, Unsigned32) -> Signed32 | 733 // (Signed32, Unsigned32) -> Signed32 |
734 CheckValueInputIs(node, 0, Type::Signed32()); | 734 CheckValueInputIs(node, 0, Type::Signed32()); |
735 CheckValueInputIs(node, 1, Type::Unsigned32()); | 735 CheckValueInputIs(node, 1, Type::Unsigned32()); |
736 CheckUpperIs(node, Type::Signed32()); | 736 CheckTypeIs(node, Type::Signed32()); |
737 break; | 737 break; |
738 case IrOpcode::kSpeculativeNumberShiftLeft: | 738 case IrOpcode::kSpeculativeNumberShiftLeft: |
739 case IrOpcode::kSpeculativeNumberShiftRight: | 739 case IrOpcode::kSpeculativeNumberShiftRight: |
740 CheckUpperIs(node, Type::Signed32()); | 740 CheckTypeIs(node, Type::Signed32()); |
741 break; | 741 break; |
742 case IrOpcode::kNumberShiftRightLogical: | 742 case IrOpcode::kNumberShiftRightLogical: |
743 // (Unsigned32, Unsigned32) -> Unsigned32 | 743 // (Unsigned32, Unsigned32) -> Unsigned32 |
744 CheckValueInputIs(node, 0, Type::Unsigned32()); | 744 CheckValueInputIs(node, 0, Type::Unsigned32()); |
745 CheckValueInputIs(node, 1, Type::Unsigned32()); | 745 CheckValueInputIs(node, 1, Type::Unsigned32()); |
746 CheckUpperIs(node, Type::Unsigned32()); | 746 CheckTypeIs(node, Type::Unsigned32()); |
747 break; | 747 break; |
748 case IrOpcode::kSpeculativeNumberShiftRightLogical: | 748 case IrOpcode::kSpeculativeNumberShiftRightLogical: |
749 CheckUpperIs(node, Type::Unsigned32()); | 749 CheckTypeIs(node, Type::Unsigned32()); |
750 break; | 750 break; |
751 case IrOpcode::kNumberImul: | 751 case IrOpcode::kNumberImul: |
752 // (Unsigned32, Unsigned32) -> Signed32 | 752 // (Unsigned32, Unsigned32) -> Signed32 |
753 CheckValueInputIs(node, 0, Type::Unsigned32()); | 753 CheckValueInputIs(node, 0, Type::Unsigned32()); |
754 CheckValueInputIs(node, 1, Type::Unsigned32()); | 754 CheckValueInputIs(node, 1, Type::Unsigned32()); |
755 CheckUpperIs(node, Type::Signed32()); | 755 CheckTypeIs(node, Type::Signed32()); |
756 break; | 756 break; |
757 case IrOpcode::kNumberClz32: | 757 case IrOpcode::kNumberClz32: |
758 // Unsigned32 -> Unsigned32 | 758 // Unsigned32 -> Unsigned32 |
759 CheckValueInputIs(node, 0, Type::Unsigned32()); | 759 CheckValueInputIs(node, 0, Type::Unsigned32()); |
760 CheckUpperIs(node, Type::Unsigned32()); | 760 CheckTypeIs(node, Type::Unsigned32()); |
761 break; | 761 break; |
762 case IrOpcode::kNumberAtan2: | 762 case IrOpcode::kNumberAtan2: |
763 case IrOpcode::kNumberMax: | 763 case IrOpcode::kNumberMax: |
764 case IrOpcode::kNumberMin: | 764 case IrOpcode::kNumberMin: |
765 case IrOpcode::kNumberPow: | 765 case IrOpcode::kNumberPow: |
766 // (Number, Number) -> Number | 766 // (Number, Number) -> Number |
767 CheckValueInputIs(node, 0, Type::Number()); | 767 CheckValueInputIs(node, 0, Type::Number()); |
768 CheckValueInputIs(node, 1, Type::Number()); | 768 CheckValueInputIs(node, 1, Type::Number()); |
769 CheckUpperIs(node, Type::Number()); | 769 CheckTypeIs(node, Type::Number()); |
770 break; | 770 break; |
771 case IrOpcode::kNumberAbs: | 771 case IrOpcode::kNumberAbs: |
772 case IrOpcode::kNumberCeil: | 772 case IrOpcode::kNumberCeil: |
773 case IrOpcode::kNumberFloor: | 773 case IrOpcode::kNumberFloor: |
774 case IrOpcode::kNumberFround: | 774 case IrOpcode::kNumberFround: |
775 case IrOpcode::kNumberAcos: | 775 case IrOpcode::kNumberAcos: |
776 case IrOpcode::kNumberAcosh: | 776 case IrOpcode::kNumberAcosh: |
777 case IrOpcode::kNumberAsin: | 777 case IrOpcode::kNumberAsin: |
778 case IrOpcode::kNumberAsinh: | 778 case IrOpcode::kNumberAsinh: |
779 case IrOpcode::kNumberAtan: | 779 case IrOpcode::kNumberAtan: |
(...skipping 10 matching lines...) Expand all Loading... |
790 case IrOpcode::kNumberRound: | 790 case IrOpcode::kNumberRound: |
791 case IrOpcode::kNumberSign: | 791 case IrOpcode::kNumberSign: |
792 case IrOpcode::kNumberSin: | 792 case IrOpcode::kNumberSin: |
793 case IrOpcode::kNumberSinh: | 793 case IrOpcode::kNumberSinh: |
794 case IrOpcode::kNumberSqrt: | 794 case IrOpcode::kNumberSqrt: |
795 case IrOpcode::kNumberTan: | 795 case IrOpcode::kNumberTan: |
796 case IrOpcode::kNumberTanh: | 796 case IrOpcode::kNumberTanh: |
797 case IrOpcode::kNumberTrunc: | 797 case IrOpcode::kNumberTrunc: |
798 // Number -> Number | 798 // Number -> Number |
799 CheckValueInputIs(node, 0, Type::Number()); | 799 CheckValueInputIs(node, 0, Type::Number()); |
800 CheckUpperIs(node, Type::Number()); | 800 CheckTypeIs(node, Type::Number()); |
801 break; | 801 break; |
802 case IrOpcode::kNumberToInt32: | 802 case IrOpcode::kNumberToInt32: |
803 // Number -> Signed32 | 803 // Number -> Signed32 |
804 CheckValueInputIs(node, 0, Type::Number()); | 804 CheckValueInputIs(node, 0, Type::Number()); |
805 CheckUpperIs(node, Type::Signed32()); | 805 CheckTypeIs(node, Type::Signed32()); |
806 break; | 806 break; |
807 case IrOpcode::kNumberToUint32: | 807 case IrOpcode::kNumberToUint32: |
808 // Number -> Unsigned32 | 808 // Number -> Unsigned32 |
809 CheckValueInputIs(node, 0, Type::Number()); | 809 CheckValueInputIs(node, 0, Type::Number()); |
810 CheckUpperIs(node, Type::Unsigned32()); | 810 CheckTypeIs(node, Type::Unsigned32()); |
811 break; | 811 break; |
812 case IrOpcode::kPlainPrimitiveToNumber: | 812 case IrOpcode::kPlainPrimitiveToNumber: |
813 // PlainPrimitive -> Number | 813 // PlainPrimitive -> Number |
814 CheckValueInputIs(node, 0, Type::PlainPrimitive()); | 814 CheckValueInputIs(node, 0, Type::PlainPrimitive()); |
815 CheckUpperIs(node, Type::Number()); | 815 CheckTypeIs(node, Type::Number()); |
816 break; | 816 break; |
817 case IrOpcode::kPlainPrimitiveToWord32: | 817 case IrOpcode::kPlainPrimitiveToWord32: |
818 // PlainPrimitive -> Integral32 | 818 // PlainPrimitive -> Integral32 |
819 CheckValueInputIs(node, 0, Type::PlainPrimitive()); | 819 CheckValueInputIs(node, 0, Type::PlainPrimitive()); |
820 CheckUpperIs(node, Type::Integral32()); | 820 CheckTypeIs(node, Type::Integral32()); |
821 break; | 821 break; |
822 case IrOpcode::kPlainPrimitiveToFloat64: | 822 case IrOpcode::kPlainPrimitiveToFloat64: |
823 // PlainPrimitive -> Number | 823 // PlainPrimitive -> Number |
824 CheckValueInputIs(node, 0, Type::PlainPrimitive()); | 824 CheckValueInputIs(node, 0, Type::PlainPrimitive()); |
825 CheckUpperIs(node, Type::Number()); | 825 CheckTypeIs(node, Type::Number()); |
826 break; | 826 break; |
827 case IrOpcode::kStringEqual: | 827 case IrOpcode::kStringEqual: |
828 case IrOpcode::kStringLessThan: | 828 case IrOpcode::kStringLessThan: |
829 case IrOpcode::kStringLessThanOrEqual: | 829 case IrOpcode::kStringLessThanOrEqual: |
830 // (String, String) -> Boolean | 830 // (String, String) -> Boolean |
831 CheckValueInputIs(node, 0, Type::String()); | 831 CheckValueInputIs(node, 0, Type::String()); |
832 CheckValueInputIs(node, 1, Type::String()); | 832 CheckValueInputIs(node, 1, Type::String()); |
833 CheckUpperIs(node, Type::Boolean()); | 833 CheckTypeIs(node, Type::Boolean()); |
834 break; | 834 break; |
835 case IrOpcode::kStringCharCodeAt: | 835 case IrOpcode::kStringCharCodeAt: |
836 // (String, Unsigned32) -> UnsignedSmall | 836 // (String, Unsigned32) -> UnsignedSmall |
837 CheckValueInputIs(node, 0, Type::String()); | 837 CheckValueInputIs(node, 0, Type::String()); |
838 CheckValueInputIs(node, 1, Type::Unsigned32()); | 838 CheckValueInputIs(node, 1, Type::Unsigned32()); |
839 CheckUpperIs(node, Type::UnsignedSmall()); | 839 CheckTypeIs(node, Type::UnsignedSmall()); |
840 break; | 840 break; |
841 case IrOpcode::kStringFromCharCode: | 841 case IrOpcode::kStringFromCharCode: |
842 // Number -> String | 842 // Number -> String |
843 CheckValueInputIs(node, 0, Type::Number()); | 843 CheckValueInputIs(node, 0, Type::Number()); |
844 CheckUpperIs(node, Type::String()); | 844 CheckTypeIs(node, Type::String()); |
845 break; | 845 break; |
846 case IrOpcode::kReferenceEqual: { | 846 case IrOpcode::kReferenceEqual: { |
847 // (Unique, Any) -> Boolean and | 847 // (Unique, Any) -> Boolean and |
848 // (Any, Unique) -> Boolean | 848 // (Any, Unique) -> Boolean |
849 CheckUpperIs(node, Type::Boolean()); | 849 CheckTypeIs(node, Type::Boolean()); |
850 break; | 850 break; |
851 } | 851 } |
852 case IrOpcode::kObjectIsCallable: | 852 case IrOpcode::kObjectIsCallable: |
853 case IrOpcode::kObjectIsNumber: | 853 case IrOpcode::kObjectIsNumber: |
854 case IrOpcode::kObjectIsReceiver: | 854 case IrOpcode::kObjectIsReceiver: |
855 case IrOpcode::kObjectIsSmi: | 855 case IrOpcode::kObjectIsSmi: |
856 case IrOpcode::kObjectIsString: | 856 case IrOpcode::kObjectIsString: |
857 case IrOpcode::kObjectIsUndetectable: | 857 case IrOpcode::kObjectIsUndetectable: |
858 case IrOpcode::kArrayBufferWasNeutered: | 858 case IrOpcode::kArrayBufferWasNeutered: |
859 CheckValueInputIs(node, 0, Type::Any()); | 859 CheckValueInputIs(node, 0, Type::Any()); |
860 CheckUpperIs(node, Type::Boolean()); | 860 CheckTypeIs(node, Type::Boolean()); |
861 break; | 861 break; |
862 case IrOpcode::kAllocate: | 862 case IrOpcode::kAllocate: |
863 CheckValueInputIs(node, 0, Type::PlainNumber()); | 863 CheckValueInputIs(node, 0, Type::PlainNumber()); |
864 CheckUpperIs(node, Type::TaggedPointer()); | 864 CheckTypeIs(node, Type::TaggedPointer()); |
865 break; | 865 break; |
866 case IrOpcode::kEnsureWritableFastElements: | 866 case IrOpcode::kEnsureWritableFastElements: |
867 CheckValueInputIs(node, 0, Type::Any()); | 867 CheckValueInputIs(node, 0, Type::Any()); |
868 CheckValueInputIs(node, 1, Type::Internal()); | 868 CheckValueInputIs(node, 1, Type::Internal()); |
869 CheckUpperIs(node, Type::Internal()); | 869 CheckTypeIs(node, Type::Internal()); |
870 break; | 870 break; |
871 case IrOpcode::kMaybeGrowFastElements: | 871 case IrOpcode::kMaybeGrowFastElements: |
872 CheckValueInputIs(node, 0, Type::Any()); | 872 CheckValueInputIs(node, 0, Type::Any()); |
873 CheckValueInputIs(node, 1, Type::Internal()); | 873 CheckValueInputIs(node, 1, Type::Internal()); |
874 CheckValueInputIs(node, 2, Type::Unsigned31()); | 874 CheckValueInputIs(node, 2, Type::Unsigned31()); |
875 CheckValueInputIs(node, 3, Type::Unsigned31()); | 875 CheckValueInputIs(node, 3, Type::Unsigned31()); |
876 CheckUpperIs(node, Type::Internal()); | 876 CheckTypeIs(node, Type::Internal()); |
877 break; | 877 break; |
878 case IrOpcode::kTransitionElementsKind: | 878 case IrOpcode::kTransitionElementsKind: |
879 CheckValueInputIs(node, 0, Type::Any()); | 879 CheckValueInputIs(node, 0, Type::Any()); |
880 CheckValueInputIs(node, 1, Type::Internal()); | 880 CheckValueInputIs(node, 1, Type::Internal()); |
881 CheckValueInputIs(node, 2, Type::Internal()); | 881 CheckValueInputIs(node, 2, Type::Internal()); |
882 CheckNotTyped(node); | 882 CheckNotTyped(node); |
883 break; | 883 break; |
884 | 884 |
885 case IrOpcode::kChangeTaggedSignedToInt32: { | 885 case IrOpcode::kChangeTaggedSignedToInt32: { |
886 // Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32 | 886 // Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32 |
887 // TODO(neis): Activate once ChangeRepresentation works in typer. | 887 // TODO(neis): Activate once ChangeRepresentation works in typer. |
888 // Type* from = Type::Intersect(Type::Signed32(), Type::Tagged()); | 888 // Type* from = Type::Intersect(Type::Signed32(), Type::Tagged()); |
889 // Type* to = Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); | 889 // Type* to = Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); |
890 // CheckValueInputIs(node, 0, from)); | 890 // CheckValueInputIs(node, 0, from)); |
891 // CheckUpperIs(node, to)); | 891 // CheckTypeIs(node, to)); |
892 break; | 892 break; |
893 } | 893 } |
894 case IrOpcode::kChangeTaggedToInt32: { | 894 case IrOpcode::kChangeTaggedToInt32: { |
895 // Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32 | 895 // Signed32 /\ Tagged -> Signed32 /\ UntaggedInt32 |
896 // TODO(neis): Activate once ChangeRepresentation works in typer. | 896 // TODO(neis): Activate once ChangeRepresentation works in typer. |
897 // Type* from = Type::Intersect(Type::Signed32(), Type::Tagged()); | 897 // Type* from = Type::Intersect(Type::Signed32(), Type::Tagged()); |
898 // Type* to = Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); | 898 // Type* to = Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); |
899 // CheckValueInputIs(node, 0, from)); | 899 // CheckValueInputIs(node, 0, from)); |
900 // CheckUpperIs(node, to)); | 900 // CheckTypeIs(node, to)); |
901 break; | 901 break; |
902 } | 902 } |
903 case IrOpcode::kChangeTaggedToUint32: { | 903 case IrOpcode::kChangeTaggedToUint32: { |
904 // Unsigned32 /\ Tagged -> Unsigned32 /\ UntaggedInt32 | 904 // Unsigned32 /\ Tagged -> Unsigned32 /\ UntaggedInt32 |
905 // TODO(neis): Activate once ChangeRepresentation works in typer. | 905 // TODO(neis): Activate once ChangeRepresentation works in typer. |
906 // Type* from = Type::Intersect(Type::Unsigned32(), Type::Tagged()); | 906 // Type* from = Type::Intersect(Type::Unsigned32(), Type::Tagged()); |
907 // Type* to =Type::Intersect(Type::Unsigned32(), Type::UntaggedInt32()); | 907 // Type* to =Type::Intersect(Type::Unsigned32(), Type::UntaggedInt32()); |
908 // CheckValueInputIs(node, 0, from)); | 908 // CheckValueInputIs(node, 0, from)); |
909 // CheckUpperIs(node, to)); | 909 // CheckTypeIs(node, to)); |
910 break; | 910 break; |
911 } | 911 } |
912 case IrOpcode::kChangeTaggedToFloat64: { | 912 case IrOpcode::kChangeTaggedToFloat64: { |
913 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64 | 913 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64 |
914 // TODO(neis): Activate once ChangeRepresentation works in typer. | 914 // TODO(neis): Activate once ChangeRepresentation works in typer. |
915 // Type* from = Type::Intersect(Type::Number(), Type::Tagged()); | 915 // Type* from = Type::Intersect(Type::Number(), Type::Tagged()); |
916 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64()); | 916 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64()); |
917 // CheckValueInputIs(node, 0, from)); | 917 // CheckValueInputIs(node, 0, from)); |
918 // CheckUpperIs(node, to)); | 918 // CheckTypeIs(node, to)); |
919 break; | 919 break; |
920 } | 920 } |
921 case IrOpcode::kTruncateTaggedToFloat64: { | 921 case IrOpcode::kTruncateTaggedToFloat64: { |
922 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64 | 922 // NumberOrUndefined /\ Tagged -> Number /\ UntaggedFloat64 |
923 // TODO(neis): Activate once ChangeRepresentation works in typer. | 923 // TODO(neis): Activate once ChangeRepresentation works in typer. |
924 // Type* from = Type::Intersect(Type::NumberOrUndefined(), | 924 // Type* from = Type::Intersect(Type::NumberOrUndefined(), |
925 // Type::Tagged()); | 925 // Type::Tagged()); |
926 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64()); | 926 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedFloat64()); |
927 // CheckValueInputIs(node, 0, from)); | 927 // CheckValueInputIs(node, 0, from)); |
928 // CheckUpperIs(node, to)); | 928 // CheckTypeIs(node, to)); |
929 break; | 929 break; |
930 } | 930 } |
931 case IrOpcode::kChangeInt31ToTaggedSigned: { | 931 case IrOpcode::kChangeInt31ToTaggedSigned: { |
932 // Signed31 /\ UntaggedInt32 -> Signed31 /\ Tagged | 932 // Signed31 /\ UntaggedInt32 -> Signed31 /\ Tagged |
933 // TODO(neis): Activate once ChangeRepresentation works in typer. | 933 // TODO(neis): Activate once ChangeRepresentation works in typer. |
934 // Type* from =Type::Intersect(Type::Signed31(), Type::UntaggedInt32()); | 934 // Type* from =Type::Intersect(Type::Signed31(), Type::UntaggedInt32()); |
935 // Type* to = Type::Intersect(Type::Signed31(), Type::Tagged()); | 935 // Type* to = Type::Intersect(Type::Signed31(), Type::Tagged()); |
936 // CheckValueInputIs(node, 0, from)); | 936 // CheckValueInputIs(node, 0, from)); |
937 // CheckUpperIs(node, to)); | 937 // CheckTypeIs(node, to)); |
938 break; | 938 break; |
939 } | 939 } |
940 case IrOpcode::kChangeInt32ToTagged: { | 940 case IrOpcode::kChangeInt32ToTagged: { |
941 // Signed32 /\ UntaggedInt32 -> Signed32 /\ Tagged | 941 // Signed32 /\ UntaggedInt32 -> Signed32 /\ Tagged |
942 // TODO(neis): Activate once ChangeRepresentation works in typer. | 942 // TODO(neis): Activate once ChangeRepresentation works in typer. |
943 // Type* from =Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); | 943 // Type* from =Type::Intersect(Type::Signed32(), Type::UntaggedInt32()); |
944 // Type* to = Type::Intersect(Type::Signed32(), Type::Tagged()); | 944 // Type* to = Type::Intersect(Type::Signed32(), Type::Tagged()); |
945 // CheckValueInputIs(node, 0, from)); | 945 // CheckValueInputIs(node, 0, from)); |
946 // CheckUpperIs(node, to)); | 946 // CheckTypeIs(node, to)); |
947 break; | 947 break; |
948 } | 948 } |
949 case IrOpcode::kChangeUint32ToTagged: { | 949 case IrOpcode::kChangeUint32ToTagged: { |
950 // Unsigned32 /\ UntaggedInt32 -> Unsigned32 /\ Tagged | 950 // Unsigned32 /\ UntaggedInt32 -> Unsigned32 /\ Tagged |
951 // TODO(neis): Activate once ChangeRepresentation works in typer. | 951 // TODO(neis): Activate once ChangeRepresentation works in typer. |
952 // Type* from=Type::Intersect(Type::Unsigned32(),Type::UntaggedInt32()); | 952 // Type* from=Type::Intersect(Type::Unsigned32(),Type::UntaggedInt32()); |
953 // Type* to = Type::Intersect(Type::Unsigned32(), Type::Tagged()); | 953 // Type* to = Type::Intersect(Type::Unsigned32(), Type::Tagged()); |
954 // CheckValueInputIs(node, 0, from)); | 954 // CheckValueInputIs(node, 0, from)); |
955 // CheckUpperIs(node, to)); | 955 // CheckTypeIs(node, to)); |
956 break; | 956 break; |
957 } | 957 } |
958 case IrOpcode::kChangeFloat64ToTagged: { | 958 case IrOpcode::kChangeFloat64ToTagged: { |
959 // Number /\ UntaggedFloat64 -> Number /\ Tagged | 959 // Number /\ UntaggedFloat64 -> Number /\ Tagged |
960 // TODO(neis): Activate once ChangeRepresentation works in typer. | 960 // TODO(neis): Activate once ChangeRepresentation works in typer. |
961 // Type* from =Type::Intersect(Type::Number(), Type::UntaggedFloat64()); | 961 // Type* from =Type::Intersect(Type::Number(), Type::UntaggedFloat64()); |
962 // Type* to = Type::Intersect(Type::Number(), Type::Tagged()); | 962 // Type* to = Type::Intersect(Type::Number(), Type::Tagged()); |
963 // CheckValueInputIs(node, 0, from)); | 963 // CheckValueInputIs(node, 0, from)); |
964 // CheckUpperIs(node, to)); | 964 // CheckTypeIs(node, to)); |
965 break; | 965 break; |
966 } | 966 } |
967 case IrOpcode::kChangeTaggedToBit: { | 967 case IrOpcode::kChangeTaggedToBit: { |
968 // Boolean /\ TaggedPtr -> Boolean /\ UntaggedInt1 | 968 // Boolean /\ TaggedPtr -> Boolean /\ UntaggedInt1 |
969 // TODO(neis): Activate once ChangeRepresentation works in typer. | 969 // TODO(neis): Activate once ChangeRepresentation works in typer. |
970 // Type* from = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); | 970 // Type* from = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); |
971 // Type* to = Type::Intersect(Type::Boolean(), Type::UntaggedInt1()); | 971 // Type* to = Type::Intersect(Type::Boolean(), Type::UntaggedInt1()); |
972 // CheckValueInputIs(node, 0, from)); | 972 // CheckValueInputIs(node, 0, from)); |
973 // CheckUpperIs(node, to)); | 973 // CheckTypeIs(node, to)); |
974 break; | 974 break; |
975 } | 975 } |
976 case IrOpcode::kChangeBitToTagged: { | 976 case IrOpcode::kChangeBitToTagged: { |
977 // Boolean /\ UntaggedInt1 -> Boolean /\ TaggedPtr | 977 // Boolean /\ UntaggedInt1 -> Boolean /\ TaggedPtr |
978 // TODO(neis): Activate once ChangeRepresentation works in typer. | 978 // TODO(neis): Activate once ChangeRepresentation works in typer. |
979 // Type* from = Type::Intersect(Type::Boolean(), Type::UntaggedInt1()); | 979 // Type* from = Type::Intersect(Type::Boolean(), Type::UntaggedInt1()); |
980 // Type* to = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); | 980 // Type* to = Type::Intersect(Type::Boolean(), Type::TaggedPtr()); |
981 // CheckValueInputIs(node, 0, from)); | 981 // CheckValueInputIs(node, 0, from)); |
982 // CheckUpperIs(node, to)); | 982 // CheckTypeIs(node, to)); |
983 break; | 983 break; |
984 } | 984 } |
985 case IrOpcode::kTruncateTaggedToWord32: { | 985 case IrOpcode::kTruncateTaggedToWord32: { |
986 // Number /\ Tagged -> Signed32 /\ UntaggedInt32 | 986 // Number /\ Tagged -> Signed32 /\ UntaggedInt32 |
987 // TODO(neis): Activate once ChangeRepresentation works in typer. | 987 // TODO(neis): Activate once ChangeRepresentation works in typer. |
988 // Type* from = Type::Intersect(Type::Number(), Type::Tagged()); | 988 // Type* from = Type::Intersect(Type::Number(), Type::Tagged()); |
989 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedInt32()); | 989 // Type* to = Type::Intersect(Type::Number(), Type::UntaggedInt32()); |
990 // CheckValueInputIs(node, 0, from)); | 990 // CheckValueInputIs(node, 0, from)); |
991 // CheckUpperIs(node, to)); | 991 // CheckTypeIs(node, to)); |
992 break; | 992 break; |
993 } | 993 } |
994 case IrOpcode::kCheckBounds: | 994 case IrOpcode::kCheckBounds: |
995 CheckValueInputIs(node, 0, Type::Any()); | 995 CheckValueInputIs(node, 0, Type::Any()); |
996 CheckValueInputIs(node, 1, Type::Unsigned31()); | 996 CheckValueInputIs(node, 1, Type::Unsigned31()); |
997 CheckUpperIs(node, Type::Unsigned31()); | 997 CheckTypeIs(node, Type::Unsigned31()); |
998 break; | 998 break; |
999 case IrOpcode::kCheckMaps: | 999 case IrOpcode::kCheckMaps: |
1000 // (Any, Internal, ..., Internal) -> Any | 1000 // (Any, Internal, ..., Internal) -> Any |
1001 CheckValueInputIs(node, 0, Type::Any()); | 1001 CheckValueInputIs(node, 0, Type::Any()); |
1002 for (int i = 1; i < node->op()->ValueInputCount(); ++i) { | 1002 for (int i = 1; i < node->op()->ValueInputCount(); ++i) { |
1003 CheckValueInputIs(node, i, Type::Internal()); | 1003 CheckValueInputIs(node, i, Type::Internal()); |
1004 } | 1004 } |
1005 CheckNotTyped(node); | 1005 CheckNotTyped(node); |
1006 break; | 1006 break; |
1007 case IrOpcode::kCheckNumber: | 1007 case IrOpcode::kCheckNumber: |
1008 CheckValueInputIs(node, 0, Type::Any()); | 1008 CheckValueInputIs(node, 0, Type::Any()); |
1009 CheckUpperIs(node, Type::Number()); | 1009 CheckTypeIs(node, Type::Number()); |
1010 break; | 1010 break; |
1011 case IrOpcode::kCheckString: | 1011 case IrOpcode::kCheckString: |
1012 CheckValueInputIs(node, 0, Type::Any()); | 1012 CheckValueInputIs(node, 0, Type::Any()); |
1013 CheckUpperIs(node, Type::String()); | 1013 CheckTypeIs(node, Type::String()); |
1014 break; | 1014 break; |
1015 case IrOpcode::kCheckIf: | 1015 case IrOpcode::kCheckIf: |
1016 CheckValueInputIs(node, 0, Type::Boolean()); | 1016 CheckValueInputIs(node, 0, Type::Boolean()); |
1017 CheckNotTyped(node); | 1017 CheckNotTyped(node); |
1018 break; | 1018 break; |
1019 case IrOpcode::kCheckTaggedSigned: | 1019 case IrOpcode::kCheckTaggedSigned: |
1020 CheckValueInputIs(node, 0, Type::Any()); | 1020 CheckValueInputIs(node, 0, Type::Any()); |
1021 CheckUpperIs(node, Type::TaggedSigned()); | 1021 CheckTypeIs(node, Type::TaggedSigned()); |
1022 break; | 1022 break; |
1023 case IrOpcode::kCheckTaggedPointer: | 1023 case IrOpcode::kCheckTaggedPointer: |
1024 CheckValueInputIs(node, 0, Type::Any()); | 1024 CheckValueInputIs(node, 0, Type::Any()); |
1025 CheckUpperIs(node, Type::TaggedPointer()); | 1025 CheckTypeIs(node, Type::TaggedPointer()); |
1026 break; | 1026 break; |
1027 | 1027 |
1028 case IrOpcode::kCheckedInt32Add: | 1028 case IrOpcode::kCheckedInt32Add: |
1029 case IrOpcode::kCheckedInt32Sub: | 1029 case IrOpcode::kCheckedInt32Sub: |
1030 case IrOpcode::kCheckedInt32Div: | 1030 case IrOpcode::kCheckedInt32Div: |
1031 case IrOpcode::kCheckedInt32Mod: | 1031 case IrOpcode::kCheckedInt32Mod: |
1032 case IrOpcode::kCheckedUint32Div: | 1032 case IrOpcode::kCheckedUint32Div: |
1033 case IrOpcode::kCheckedUint32Mod: | 1033 case IrOpcode::kCheckedUint32Mod: |
1034 case IrOpcode::kCheckedInt32Mul: | 1034 case IrOpcode::kCheckedInt32Mul: |
1035 case IrOpcode::kCheckedUint32ToInt32: | 1035 case IrOpcode::kCheckedUint32ToInt32: |
1036 case IrOpcode::kCheckedFloat64ToInt32: | 1036 case IrOpcode::kCheckedFloat64ToInt32: |
1037 case IrOpcode::kCheckedTaggedSignedToInt32: | 1037 case IrOpcode::kCheckedTaggedSignedToInt32: |
1038 case IrOpcode::kCheckedTaggedToInt32: | 1038 case IrOpcode::kCheckedTaggedToInt32: |
1039 case IrOpcode::kCheckedTaggedToFloat64: | 1039 case IrOpcode::kCheckedTaggedToFloat64: |
1040 case IrOpcode::kCheckedTruncateTaggedToWord32: | 1040 case IrOpcode::kCheckedTruncateTaggedToWord32: |
1041 break; | 1041 break; |
1042 | 1042 |
1043 case IrOpcode::kCheckFloat64Hole: | 1043 case IrOpcode::kCheckFloat64Hole: |
1044 CheckValueInputIs(node, 0, Type::Number()); | 1044 CheckValueInputIs(node, 0, Type::Number()); |
1045 CheckUpperIs(node, Type::Number()); | 1045 CheckTypeIs(node, Type::Number()); |
1046 break; | 1046 break; |
1047 case IrOpcode::kCheckTaggedHole: | 1047 case IrOpcode::kCheckTaggedHole: |
1048 CheckValueInputIs(node, 0, Type::Any()); | 1048 CheckValueInputIs(node, 0, Type::Any()); |
1049 CheckUpperIs(node, Type::NonInternal()); | 1049 CheckTypeIs(node, Type::NonInternal()); |
1050 break; | 1050 break; |
1051 case IrOpcode::kConvertTaggedHoleToUndefined: | 1051 case IrOpcode::kConvertTaggedHoleToUndefined: |
1052 CheckValueInputIs(node, 0, Type::Any()); | 1052 CheckValueInputIs(node, 0, Type::Any()); |
1053 CheckUpperIs(node, Type::NonInternal()); | 1053 CheckTypeIs(node, Type::NonInternal()); |
1054 break; | 1054 break; |
1055 | 1055 |
1056 case IrOpcode::kLoadField: | 1056 case IrOpcode::kLoadField: |
1057 // Object -> fieldtype | 1057 // Object -> fieldtype |
1058 // TODO(rossberg): activate once machine ops are typed. | 1058 // TODO(rossberg): activate once machine ops are typed. |
1059 // CheckValueInputIs(node, 0, Type::Object()); | 1059 // CheckValueInputIs(node, 0, Type::Object()); |
1060 // CheckUpperIs(node, FieldAccessOf(node->op()).type)); | 1060 // CheckTypeIs(node, FieldAccessOf(node->op()).type)); |
1061 break; | 1061 break; |
1062 case IrOpcode::kLoadBuffer: | 1062 case IrOpcode::kLoadBuffer: |
1063 break; | 1063 break; |
1064 case IrOpcode::kLoadElement: | 1064 case IrOpcode::kLoadElement: |
1065 // Object -> elementtype | 1065 // Object -> elementtype |
1066 // TODO(rossberg): activate once machine ops are typed. | 1066 // TODO(rossberg): activate once machine ops are typed. |
1067 // CheckValueInputIs(node, 0, Type::Object()); | 1067 // CheckValueInputIs(node, 0, Type::Object()); |
1068 // CheckUpperIs(node, ElementAccessOf(node->op()).type)); | 1068 // CheckTypeIs(node, ElementAccessOf(node->op()).type)); |
1069 break; | 1069 break; |
1070 case IrOpcode::kLoadTypedElement: | 1070 case IrOpcode::kLoadTypedElement: |
1071 break; | 1071 break; |
1072 case IrOpcode::kStoreField: | 1072 case IrOpcode::kStoreField: |
1073 // (Object, fieldtype) -> _|_ | 1073 // (Object, fieldtype) -> _|_ |
1074 // TODO(rossberg): activate once machine ops are typed. | 1074 // TODO(rossberg): activate once machine ops are typed. |
1075 // CheckValueInputIs(node, 0, Type::Object()); | 1075 // CheckValueInputIs(node, 0, Type::Object()); |
1076 // CheckValueInputIs(node, 1, FieldAccessOf(node->op()).type)); | 1076 // CheckValueInputIs(node, 1, FieldAccessOf(node->op()).type)); |
1077 CheckNotTyped(node); | 1077 CheckNotTyped(node); |
1078 break; | 1078 break; |
1079 case IrOpcode::kStoreBuffer: | 1079 case IrOpcode::kStoreBuffer: |
1080 break; | 1080 break; |
1081 case IrOpcode::kStoreElement: | 1081 case IrOpcode::kStoreElement: |
1082 // (Object, elementtype) -> _|_ | 1082 // (Object, elementtype) -> _|_ |
1083 // TODO(rossberg): activate once machine ops are typed. | 1083 // TODO(rossberg): activate once machine ops are typed. |
1084 // CheckValueInputIs(node, 0, Type::Object()); | 1084 // CheckValueInputIs(node, 0, Type::Object()); |
1085 // CheckValueInputIs(node, 1, ElementAccessOf(node->op()).type)); | 1085 // CheckValueInputIs(node, 1, ElementAccessOf(node->op()).type)); |
1086 CheckNotTyped(node); | 1086 CheckNotTyped(node); |
1087 break; | 1087 break; |
1088 case IrOpcode::kStoreTypedElement: | 1088 case IrOpcode::kStoreTypedElement: |
1089 CheckNotTyped(node); | 1089 CheckNotTyped(node); |
1090 break; | 1090 break; |
1091 case IrOpcode::kNumberSilenceNaN: | 1091 case IrOpcode::kNumberSilenceNaN: |
1092 CheckValueInputIs(node, 0, Type::Number()); | 1092 CheckValueInputIs(node, 0, Type::Number()); |
1093 CheckUpperIs(node, Type::Number()); | 1093 CheckTypeIs(node, Type::Number()); |
1094 break; | 1094 break; |
1095 case IrOpcode::kTypeGuard: | 1095 case IrOpcode::kTypeGuard: |
1096 CheckUpperIs(node, TypeGuardTypeOf(node->op())); | 1096 CheckTypeIs(node, TypeGuardTypeOf(node->op())); |
1097 break; | 1097 break; |
1098 | 1098 |
1099 // Machine operators | 1099 // Machine operators |
1100 // ----------------------- | 1100 // ----------------------- |
1101 case IrOpcode::kLoad: | 1101 case IrOpcode::kLoad: |
1102 case IrOpcode::kStore: | 1102 case IrOpcode::kStore: |
1103 case IrOpcode::kStackSlot: | 1103 case IrOpcode::kStackSlot: |
1104 case IrOpcode::kWord32And: | 1104 case IrOpcode::kWord32And: |
1105 case IrOpcode::kWord32Or: | 1105 case IrOpcode::kWord32Or: |
1106 case IrOpcode::kWord32Xor: | 1106 case IrOpcode::kWord32Xor: |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 replacement->op()->EffectOutputCount() > 0); | 1586 replacement->op()->EffectOutputCount() > 0); |
1587 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || | 1587 DCHECK(!NodeProperties::IsFrameStateEdge(edge) || |
1588 replacement->opcode() == IrOpcode::kFrameState); | 1588 replacement->opcode() == IrOpcode::kFrameState); |
1589 } | 1589 } |
1590 | 1590 |
1591 #endif // DEBUG | 1591 #endif // DEBUG |
1592 | 1592 |
1593 } // namespace compiler | 1593 } // namespace compiler |
1594 } // namespace internal | 1594 } // namespace internal |
1595 } // namespace v8 | 1595 } // namespace v8 |
OLD | NEW |