OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
10 | 10 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 void BytecodeGraphBuilder::VisitLoadICStrict( | 456 void BytecodeGraphBuilder::VisitLoadICStrict( |
457 const interpreter::BytecodeArrayIterator& iterator) { | 457 const interpreter::BytecodeArrayIterator& iterator) { |
458 DCHECK(is_strict(language_mode())); | 458 DCHECK(is_strict(language_mode())); |
459 BuildNamedLoad(iterator); | 459 BuildNamedLoad(iterator); |
460 } | 460 } |
461 | 461 |
462 | 462 |
463 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy( | |
464 const interpreter::BytecodeArrayIterator& iterator) { | |
465 UNIMPLEMENTED(); | |
466 } | |
467 | |
468 | |
469 void BytecodeGraphBuilder::VisitKeyedLoadICStrict( | |
470 const interpreter::BytecodeArrayIterator& iterator) { | |
471 UNIMPLEMENTED(); | |
472 } | |
473 | |
474 | |
475 void BytecodeGraphBuilder::VisitLoadICSloppyWide( | 463 void BytecodeGraphBuilder::VisitLoadICSloppyWide( |
476 const interpreter::BytecodeArrayIterator& iterator) { | 464 const interpreter::BytecodeArrayIterator& iterator) { |
477 DCHECK(is_sloppy(language_mode())); | 465 DCHECK(is_sloppy(language_mode())); |
478 BuildNamedLoad(iterator); | 466 BuildNamedLoad(iterator); |
479 } | 467 } |
480 | 468 |
481 | 469 |
482 void BytecodeGraphBuilder::VisitLoadICStrictWide( | 470 void BytecodeGraphBuilder::VisitLoadICStrictWide( |
483 const interpreter::BytecodeArrayIterator& iterator) { | 471 const interpreter::BytecodeArrayIterator& iterator) { |
484 DCHECK(is_strict(language_mode())); | 472 DCHECK(is_strict(language_mode())); |
485 BuildNamedLoad(iterator); | 473 BuildNamedLoad(iterator); |
486 } | 474 } |
487 | 475 |
488 | 476 |
| 477 void BytecodeGraphBuilder::BuildKeyedLoad( |
| 478 const interpreter::BytecodeArrayIterator& iterator) { |
| 479 Node* key = environment()->LookupAccumulator(); |
| 480 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 481 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(1)); |
| 482 |
| 483 const Operator* op = javascript()->LoadProperty(language_mode(), feedback); |
| 484 Node* node = NewNode(op, object, key, BuildLoadFeedbackVector()); |
| 485 AddEmptyFrameStateInputs(node); |
| 486 environment()->BindAccumulator(node); |
| 487 } |
| 488 |
| 489 |
| 490 void BytecodeGraphBuilder::VisitKeyedLoadICSloppy( |
| 491 const interpreter::BytecodeArrayIterator& iterator) { |
| 492 DCHECK(is_sloppy(language_mode())); |
| 493 BuildKeyedLoad(iterator); |
| 494 } |
| 495 |
| 496 |
| 497 void BytecodeGraphBuilder::VisitKeyedLoadICStrict( |
| 498 const interpreter::BytecodeArrayIterator& iterator) { |
| 499 DCHECK(is_strict(language_mode())); |
| 500 BuildKeyedLoad(iterator); |
| 501 } |
| 502 |
| 503 |
489 void BytecodeGraphBuilder::VisitKeyedLoadICSloppyWide( | 504 void BytecodeGraphBuilder::VisitKeyedLoadICSloppyWide( |
490 const interpreter::BytecodeArrayIterator& iterator) { | 505 const interpreter::BytecodeArrayIterator& iterator) { |
491 UNIMPLEMENTED(); | 506 DCHECK(is_sloppy(language_mode())); |
| 507 BuildKeyedLoad(iterator); |
492 } | 508 } |
493 | 509 |
494 | 510 |
495 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide( | 511 void BytecodeGraphBuilder::VisitKeyedLoadICStrictWide( |
496 const interpreter::BytecodeArrayIterator& iterator) { | 512 const interpreter::BytecodeArrayIterator& iterator) { |
497 UNIMPLEMENTED(); | 513 DCHECK(is_strict(language_mode())); |
| 514 BuildKeyedLoad(iterator); |
| 515 } |
| 516 |
| 517 |
| 518 void BytecodeGraphBuilder::BuildNamedStore( |
| 519 const interpreter::BytecodeArrayIterator& iterator) { |
| 520 Node* value = environment()->LookupAccumulator(); |
| 521 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 522 Handle<Name> name = |
| 523 Handle<Name>::cast(iterator.GetConstantForIndexOperand(1)); |
| 524 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); |
| 525 |
| 526 const Operator* op = |
| 527 javascript()->StoreNamed(language_mode(), name, feedback); |
| 528 Node* node = NewNode(op, object, value, BuildLoadFeedbackVector()); |
| 529 AddEmptyFrameStateInputs(node); |
| 530 environment()->BindAccumulator(value); |
498 } | 531 } |
499 | 532 |
500 | 533 |
501 void BytecodeGraphBuilder::VisitStoreICSloppy( | 534 void BytecodeGraphBuilder::VisitStoreICSloppy( |
502 const interpreter::BytecodeArrayIterator& iterator) { | 535 const interpreter::BytecodeArrayIterator& iterator) { |
503 UNIMPLEMENTED(); | 536 DCHECK(is_sloppy(language_mode())); |
| 537 BuildNamedStore(iterator); |
504 } | 538 } |
505 | 539 |
506 | 540 |
507 void BytecodeGraphBuilder::VisitStoreICStrict( | 541 void BytecodeGraphBuilder::VisitStoreICStrict( |
508 const interpreter::BytecodeArrayIterator& iterator) { | 542 const interpreter::BytecodeArrayIterator& iterator) { |
509 UNIMPLEMENTED(); | 543 DCHECK(is_strict(language_mode())); |
| 544 BuildNamedStore(iterator); |
| 545 } |
| 546 |
| 547 |
| 548 void BytecodeGraphBuilder::VisitStoreICSloppyWide( |
| 549 const interpreter::BytecodeArrayIterator& iterator) { |
| 550 DCHECK(is_sloppy(language_mode())); |
| 551 BuildNamedStore(iterator); |
| 552 } |
| 553 |
| 554 |
| 555 void BytecodeGraphBuilder::VisitStoreICStrictWide( |
| 556 const interpreter::BytecodeArrayIterator& iterator) { |
| 557 DCHECK(is_strict(language_mode())); |
| 558 BuildNamedStore(iterator); |
| 559 } |
| 560 |
| 561 |
| 562 void BytecodeGraphBuilder::BuildKeyedStore( |
| 563 const interpreter::BytecodeArrayIterator& iterator) { |
| 564 Node* value = environment()->LookupAccumulator(); |
| 565 Node* object = environment()->LookupRegister(iterator.GetRegisterOperand(0)); |
| 566 Node* key = environment()->LookupRegister(iterator.GetRegisterOperand(1)); |
| 567 VectorSlotPair feedback = CreateVectorSlotPair(iterator.GetIndexOperand(2)); |
| 568 |
| 569 const Operator* op = javascript()->StoreProperty(language_mode(), feedback); |
| 570 Node* node = NewNode(op, object, key, value, BuildLoadFeedbackVector()); |
| 571 AddEmptyFrameStateInputs(node); |
| 572 environment()->BindAccumulator(value); |
510 } | 573 } |
511 | 574 |
512 | 575 |
513 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy( | 576 void BytecodeGraphBuilder::VisitKeyedStoreICSloppy( |
514 const interpreter::BytecodeArrayIterator& iterator) { | 577 const interpreter::BytecodeArrayIterator& iterator) { |
515 UNIMPLEMENTED(); | 578 DCHECK(is_sloppy(language_mode())); |
| 579 BuildKeyedStore(iterator); |
516 } | 580 } |
517 | 581 |
518 | 582 |
519 void BytecodeGraphBuilder::VisitKeyedStoreICStrict( | 583 void BytecodeGraphBuilder::VisitKeyedStoreICStrict( |
520 const interpreter::BytecodeArrayIterator& iterator) { | 584 const interpreter::BytecodeArrayIterator& iterator) { |
521 UNIMPLEMENTED(); | 585 DCHECK(is_strict(language_mode())); |
522 } | 586 BuildKeyedStore(iterator); |
523 | |
524 | |
525 void BytecodeGraphBuilder::VisitStoreICSloppyWide( | |
526 const interpreter::BytecodeArrayIterator& iterator) { | |
527 UNIMPLEMENTED(); | |
528 } | |
529 | |
530 | |
531 void BytecodeGraphBuilder::VisitStoreICStrictWide( | |
532 const interpreter::BytecodeArrayIterator& iterator) { | |
533 UNIMPLEMENTED(); | |
534 } | 587 } |
535 | 588 |
536 | 589 |
537 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide( | 590 void BytecodeGraphBuilder::VisitKeyedStoreICSloppyWide( |
538 const interpreter::BytecodeArrayIterator& iterator) { | 591 const interpreter::BytecodeArrayIterator& iterator) { |
539 UNIMPLEMENTED(); | 592 DCHECK(is_sloppy(language_mode())); |
| 593 BuildKeyedStore(iterator); |
540 } | 594 } |
541 | 595 |
542 | 596 |
543 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide( | 597 void BytecodeGraphBuilder::VisitKeyedStoreICStrictWide( |
544 const interpreter::BytecodeArrayIterator& iterator) { | 598 const interpreter::BytecodeArrayIterator& iterator) { |
545 UNIMPLEMENTED(); | 599 DCHECK(is_strict(language_mode())); |
| 600 BuildKeyedStore(iterator); |
546 } | 601 } |
547 | 602 |
548 | 603 |
549 void BytecodeGraphBuilder::VisitPushContext( | 604 void BytecodeGraphBuilder::VisitPushContext( |
550 const interpreter::BytecodeArrayIterator& iterator) { | 605 const interpreter::BytecodeArrayIterator& iterator) { |
551 UNIMPLEMENTED(); | 606 UNIMPLEMENTED(); |
552 } | 607 } |
553 | 608 |
554 | 609 |
555 void BytecodeGraphBuilder::VisitPopContext( | 610 void BytecodeGraphBuilder::VisitPopContext( |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 | 1142 |
1088 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { | 1143 void BytecodeGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) { |
1089 if (environment()->IsMarkedAsUnreachable()) return; | 1144 if (environment()->IsMarkedAsUnreachable()) return; |
1090 environment()->MarkAsUnreachable(); | 1145 environment()->MarkAsUnreachable(); |
1091 exit_controls_.push_back(exit); | 1146 exit_controls_.push_back(exit); |
1092 } | 1147 } |
1093 | 1148 |
1094 } // namespace compiler | 1149 } // namespace compiler |
1095 } // namespace internal | 1150 } // namespace internal |
1096 } // namespace v8 | 1151 } // namespace v8 |
OLD | NEW |