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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // | 375 // |
376 // Stores the value of register <src> to register <dst>. | 376 // Stores the value of register <src> to register <dst>. |
377 void Interpreter::DoMov(InterpreterAssembler* assembler) { | 377 void Interpreter::DoMov(InterpreterAssembler* assembler) { |
378 Node* src_index = __ BytecodeOperandReg(0); | 378 Node* src_index = __ BytecodeOperandReg(0); |
379 Node* src_value = __ LoadRegister(src_index); | 379 Node* src_value = __ LoadRegister(src_index); |
380 Node* dst_index = __ BytecodeOperandReg(1); | 380 Node* dst_index = __ BytecodeOperandReg(1); |
381 __ StoreRegister(src_value, dst_index); | 381 __ StoreRegister(src_value, dst_index); |
382 __ Dispatch(); | 382 __ Dispatch(); |
383 } | 383 } |
384 | 384 |
| 385 template <typename Descriptor> |
385 Node* Interpreter::BuildLoadGlobal(Callable ic, | 386 Node* Interpreter::BuildLoadGlobal(Callable ic, |
386 InterpreterAssembler* assembler) { | 387 InterpreterAssembler* assembler) { |
387 typedef LoadGlobalWithVectorDescriptor Descriptor; | |
388 // Get the global object. | 388 // Get the global object. |
389 Node* context = __ GetContext(); | 389 Node* context = __ GetContext(); |
390 | 390 |
391 // Load the global via the LoadGlobalIC. | 391 // Load the global via the LoadGlobalIC. |
392 Node* code_target = __ HeapConstant(ic.code()); | 392 Node* code_target = __ HeapConstant(ic.code()); |
393 Node* raw_slot = __ BytecodeOperandIdx(0); | 393 Node* raw_slot = __ BytecodeOperandIdx(0); |
394 Node* smi_slot = __ SmiTag(raw_slot); | 394 Node* smi_slot = __ SmiTag(raw_slot); |
395 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 395 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
396 return __ CallStub(ic.descriptor(), code_target, context, | 396 return __ CallStub(ic.descriptor(), code_target, context, |
397 Arg(Descriptor::kSlot, smi_slot), | 397 Arg(Descriptor::kSlot, smi_slot), |
398 Arg(Descriptor::kVector, type_feedback_vector)); | 398 Arg(Descriptor::kVector, type_feedback_vector)); |
399 } | 399 } |
400 | 400 |
401 // LdaGlobal <slot> | 401 // LdaGlobal <slot> |
402 // | 402 // |
403 // Load the global with name in constant pool entry <name_index> into the | 403 // Load the global with name in constant pool entry <name_index> into the |
404 // accumulator using FeedBackVector slot <slot> outside of a typeof. | 404 // accumulator using FeedBackVector slot <slot> outside of a typeof. |
405 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { | 405 void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
406 Callable ic = | 406 auto ic = |
407 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 407 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
408 Node* result = BuildLoadGlobal(ic, assembler); | 408 typedef decltype(ic)::Descriptor Descriptor; |
| 409 Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
409 __ SetAccumulator(result); | 410 __ SetAccumulator(result); |
410 __ Dispatch(); | 411 __ Dispatch(); |
411 } | 412 } |
412 | 413 |
413 // LdrGlobal <slot> <reg> | 414 // LdrGlobal <slot> <reg> |
414 // | 415 // |
415 // Load the global with name in constant pool entry <name_index> into | 416 // Load the global with name in constant pool entry <name_index> into |
416 // register <reg> using FeedBackVector slot <slot> outside of a typeof. | 417 // register <reg> using FeedBackVector slot <slot> outside of a typeof. |
417 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { | 418 void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { |
418 Callable ic = | 419 auto ic = |
419 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); | 420 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
420 Node* result = BuildLoadGlobal(ic, assembler); | 421 typedef decltype(ic)::Descriptor Descriptor; |
| 422 Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
421 Node* destination = __ BytecodeOperandReg(1); | 423 Node* destination = __ BytecodeOperandReg(1); |
422 __ StoreRegister(result, destination); | 424 __ StoreRegister(result, destination); |
423 __ Dispatch(); | 425 __ Dispatch(); |
424 } | 426 } |
425 | 427 |
426 // LdaGlobalInsideTypeof <slot> | 428 // LdaGlobalInsideTypeof <slot> |
427 // | 429 // |
428 // Load the global with name in constant pool entry <name_index> into the | 430 // Load the global with name in constant pool entry <name_index> into the |
429 // accumulator using FeedBackVector slot <slot> inside of a typeof. | 431 // accumulator using FeedBackVector slot <slot> inside of a typeof. |
430 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { | 432 void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
431 Callable ic = | 433 auto ic = CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
432 CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); | 434 typedef decltype(ic)::Descriptor Descriptor; |
433 Node* result = BuildLoadGlobal(ic, assembler); | 435 Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
434 __ SetAccumulator(result); | 436 __ SetAccumulator(result); |
435 __ Dispatch(); | 437 __ Dispatch(); |
436 } | 438 } |
437 | 439 |
| 440 template <typename Descriptor> |
438 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { | 441 void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
439 typedef StoreWithVectorDescriptor Descriptor; | |
440 // Get the global object. | 442 // Get the global object. |
441 Node* context = __ GetContext(); | 443 Node* context = __ GetContext(); |
442 Node* native_context = | 444 Node* native_context = |
443 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); | 445 __ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX); |
444 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); | 446 Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX); |
445 | 447 |
446 // Store the global via the StoreIC. | 448 // Store the global via the StoreIC. |
447 Node* code_target = __ HeapConstant(ic.code()); | 449 Node* code_target = __ HeapConstant(ic.code()); |
448 Node* constant_index = __ BytecodeOperandIdx(0); | 450 Node* constant_index = __ BytecodeOperandIdx(0); |
449 Node* name = __ LoadConstantPoolEntry(constant_index); | 451 Node* name = __ LoadConstantPoolEntry(constant_index); |
450 Node* value = __ GetAccumulator(); | 452 Node* value = __ GetAccumulator(); |
451 Node* raw_slot = __ BytecodeOperandIdx(1); | 453 Node* raw_slot = __ BytecodeOperandIdx(1); |
452 Node* smi_slot = __ SmiTag(raw_slot); | 454 Node* smi_slot = __ SmiTag(raw_slot); |
453 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 455 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
454 __ CallStub(ic.descriptor(), code_target, context, | 456 __ CallStub(ic.descriptor(), code_target, context, |
455 Arg(Descriptor::kReceiver, global), Arg(Descriptor::kName, name), | 457 Arg(Descriptor::kReceiver, global), Arg(Descriptor::kName, name), |
456 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), | 458 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), |
457 Arg(Descriptor::kVector, type_feedback_vector)); | 459 Arg(Descriptor::kVector, type_feedback_vector)); |
458 __ Dispatch(); | 460 __ Dispatch(); |
459 } | 461 } |
460 | 462 |
461 // StaGlobalSloppy <name_index> <slot> | 463 // StaGlobalSloppy <name_index> <slot> |
462 // | 464 // |
463 // Store the value in the accumulator into the global with name in constant pool | 465 // Store the value in the accumulator into the global with name in constant pool |
464 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. | 466 // entry <name_index> using FeedBackVector slot <slot> in sloppy mode. |
465 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { | 467 void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
466 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); | 468 auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
467 DoStaGlobal(ic, assembler); | 469 typedef decltype(ic)::Descriptor Descriptor; |
| 470 DoStaGlobal<Descriptor>(ic, assembler); |
468 } | 471 } |
469 | 472 |
470 // StaGlobalStrict <name_index> <slot> | 473 // StaGlobalStrict <name_index> <slot> |
471 // | 474 // |
472 // Store the value in the accumulator into the global with name in constant pool | 475 // Store the value in the accumulator into the global with name in constant pool |
473 // entry <name_index> using FeedBackVector slot <slot> in strict mode. | 476 // entry <name_index> using FeedBackVector slot <slot> in strict mode. |
474 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { | 477 void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { |
475 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); | 478 auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
476 DoStaGlobal(ic, assembler); | 479 typedef decltype(ic)::Descriptor Descriptor; |
| 480 DoStaGlobal<Descriptor>(ic, assembler); |
477 } | 481 } |
478 | 482 |
479 compiler::Node* Interpreter::BuildLoadContextSlot( | 483 compiler::Node* Interpreter::BuildLoadContextSlot( |
480 InterpreterAssembler* assembler) { | 484 InterpreterAssembler* assembler) { |
481 Node* reg_index = __ BytecodeOperandReg(0); | 485 Node* reg_index = __ BytecodeOperandReg(0); |
482 Node* context = __ LoadRegister(reg_index); | 486 Node* context = __ LoadRegister(reg_index); |
483 Node* slot_index = __ BytecodeOperandIdx(1); | 487 Node* slot_index = __ BytecodeOperandIdx(1); |
484 return __ LoadContextSlot(context, slot_index); | 488 return __ LoadContextSlot(context, slot_index); |
485 } | 489 } |
486 | 490 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 } | 568 } |
565 | 569 |
566 // StaLookupSlotStrict <name_index> | 570 // StaLookupSlotStrict <name_index> |
567 // | 571 // |
568 // Store the object in accumulator to the object with the name in constant | 572 // Store the object in accumulator to the object with the name in constant |
569 // pool entry |name_index| in strict mode. | 573 // pool entry |name_index| in strict mode. |
570 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { | 574 void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { |
571 DoStaLookupSlot(LanguageMode::STRICT, assembler); | 575 DoStaLookupSlot(LanguageMode::STRICT, assembler); |
572 } | 576 } |
573 | 577 |
| 578 template <typename Descriptor> |
574 Node* Interpreter::BuildLoadNamedProperty(Callable ic, | 579 Node* Interpreter::BuildLoadNamedProperty(Callable ic, |
575 InterpreterAssembler* assembler) { | 580 InterpreterAssembler* assembler) { |
576 typedef LoadWithVectorDescriptor Descriptor; | |
577 Node* code_target = __ HeapConstant(ic.code()); | 581 Node* code_target = __ HeapConstant(ic.code()); |
578 Node* register_index = __ BytecodeOperandReg(0); | 582 Node* register_index = __ BytecodeOperandReg(0); |
579 Node* object = __ LoadRegister(register_index); | 583 Node* object = __ LoadRegister(register_index); |
580 Node* constant_index = __ BytecodeOperandIdx(1); | 584 Node* constant_index = __ BytecodeOperandIdx(1); |
581 Node* name = __ LoadConstantPoolEntry(constant_index); | 585 Node* name = __ LoadConstantPoolEntry(constant_index); |
582 Node* raw_slot = __ BytecodeOperandIdx(2); | 586 Node* raw_slot = __ BytecodeOperandIdx(2); |
583 Node* smi_slot = __ SmiTag(raw_slot); | 587 Node* smi_slot = __ SmiTag(raw_slot); |
584 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 588 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
585 Node* context = __ GetContext(); | 589 Node* context = __ GetContext(); |
586 return __ CallStub( | 590 return __ CallStub( |
587 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), | 591 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), |
588 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), | 592 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), |
589 Arg(Descriptor::kVector, type_feedback_vector)); | 593 Arg(Descriptor::kVector, type_feedback_vector)); |
590 } | 594 } |
591 | 595 |
592 // LdaNamedProperty <object> <name_index> <slot> | 596 // LdaNamedProperty <object> <name_index> <slot> |
593 // | 597 // |
594 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | 598 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
595 // constant pool entry <name_index>. | 599 // constant pool entry <name_index>. |
596 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { | 600 void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { |
597 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); | 601 auto ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
598 Node* result = BuildLoadNamedProperty(ic, assembler); | 602 typedef decltype(ic)::Descriptor Descriptor; |
| 603 Node* result = BuildLoadNamedProperty<Descriptor>(ic, assembler); |
599 __ SetAccumulator(result); | 604 __ SetAccumulator(result); |
600 __ Dispatch(); | 605 __ Dispatch(); |
601 } | 606 } |
602 | 607 |
603 // LdrNamedProperty <object> <name_index> <slot> <reg> | 608 // LdrNamedProperty <object> <name_index> <slot> <reg> |
604 // | 609 // |
605 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at | 610 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
606 // constant pool entry <name_index> and puts the result into register <reg>. | 611 // constant pool entry <name_index> and puts the result into register <reg>. |
607 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { | 612 void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { |
608 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); | 613 auto ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
609 Node* result = BuildLoadNamedProperty(ic, assembler); | 614 typedef decltype(ic)::Descriptor Descriptor; |
| 615 Node* result = BuildLoadNamedProperty<Descriptor>(ic, assembler); |
610 Node* destination = __ BytecodeOperandReg(3); | 616 Node* destination = __ BytecodeOperandReg(3); |
611 __ StoreRegister(result, destination); | 617 __ StoreRegister(result, destination); |
612 __ Dispatch(); | 618 __ Dispatch(); |
613 } | 619 } |
614 | 620 |
| 621 template <typename Descriptor> |
615 Node* Interpreter::BuildLoadKeyedProperty(Callable ic, | 622 Node* Interpreter::BuildLoadKeyedProperty(Callable ic, |
616 InterpreterAssembler* assembler) { | 623 InterpreterAssembler* assembler) { |
617 typedef LoadWithVectorDescriptor Descriptor; | |
618 Node* code_target = __ HeapConstant(ic.code()); | 624 Node* code_target = __ HeapConstant(ic.code()); |
619 Node* reg_index = __ BytecodeOperandReg(0); | 625 Node* reg_index = __ BytecodeOperandReg(0); |
620 Node* object = __ LoadRegister(reg_index); | 626 Node* object = __ LoadRegister(reg_index); |
621 Node* name = __ GetAccumulator(); | 627 Node* name = __ GetAccumulator(); |
622 Node* raw_slot = __ BytecodeOperandIdx(1); | 628 Node* raw_slot = __ BytecodeOperandIdx(1); |
623 Node* smi_slot = __ SmiTag(raw_slot); | 629 Node* smi_slot = __ SmiTag(raw_slot); |
624 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 630 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
625 Node* context = __ GetContext(); | 631 Node* context = __ GetContext(); |
626 return __ CallStub( | 632 return __ CallStub( |
627 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), | 633 ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object), |
628 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), | 634 Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot), |
629 Arg(Descriptor::kVector, type_feedback_vector)); | 635 Arg(Descriptor::kVector, type_feedback_vector)); |
630 } | 636 } |
631 | 637 |
632 // KeyedLoadIC <object> <slot> | 638 // KeyedLoadIC <object> <slot> |
633 // | 639 // |
634 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | 640 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
635 // in the accumulator. | 641 // in the accumulator. |
636 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { | 642 void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { |
637 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); | 643 auto ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
638 Node* result = BuildLoadKeyedProperty(ic, assembler); | 644 typedef decltype(ic)::Descriptor Descriptor; |
| 645 Node* result = BuildLoadKeyedProperty<Descriptor>(ic, assembler); |
639 __ SetAccumulator(result); | 646 __ SetAccumulator(result); |
640 __ Dispatch(); | 647 __ Dispatch(); |
641 } | 648 } |
642 | 649 |
643 // LdrKeyedProperty <object> <slot> <reg> | 650 // LdrKeyedProperty <object> <slot> <reg> |
644 // | 651 // |
645 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | 652 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
646 // in the accumulator and puts the result in register <reg>. | 653 // in the accumulator and puts the result in register <reg>. |
647 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { | 654 void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { |
648 Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); | 655 auto ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
649 Node* result = BuildLoadKeyedProperty(ic, assembler); | 656 typedef decltype(ic)::Descriptor Descriptor; |
| 657 Node* result = BuildLoadKeyedProperty<Descriptor>(ic, assembler); |
650 Node* destination = __ BytecodeOperandReg(2); | 658 Node* destination = __ BytecodeOperandReg(2); |
651 __ StoreRegister(result, destination); | 659 __ StoreRegister(result, destination); |
652 __ Dispatch(); | 660 __ Dispatch(); |
653 } | 661 } |
654 | 662 |
| 663 template <typename Descriptor> |
655 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { | 664 void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
656 typedef StoreWithVectorDescriptor Descriptor; | |
657 Node* code_target = __ HeapConstant(ic.code()); | 665 Node* code_target = __ HeapConstant(ic.code()); |
658 Node* object_reg_index = __ BytecodeOperandReg(0); | 666 Node* object_reg_index = __ BytecodeOperandReg(0); |
659 Node* object = __ LoadRegister(object_reg_index); | 667 Node* object = __ LoadRegister(object_reg_index); |
660 Node* constant_index = __ BytecodeOperandIdx(1); | 668 Node* constant_index = __ BytecodeOperandIdx(1); |
661 Node* name = __ LoadConstantPoolEntry(constant_index); | 669 Node* name = __ LoadConstantPoolEntry(constant_index); |
662 Node* value = __ GetAccumulator(); | 670 Node* value = __ GetAccumulator(); |
663 Node* raw_slot = __ BytecodeOperandIdx(2); | 671 Node* raw_slot = __ BytecodeOperandIdx(2); |
664 Node* smi_slot = __ SmiTag(raw_slot); | 672 Node* smi_slot = __ SmiTag(raw_slot); |
665 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 673 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
666 Node* context = __ GetContext(); | 674 Node* context = __ GetContext(); |
667 __ CallStub(ic.descriptor(), code_target, context, | 675 __ CallStub(ic.descriptor(), code_target, context, |
668 Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name), | 676 Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name), |
669 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), | 677 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), |
670 Arg(Descriptor::kVector, type_feedback_vector)); | 678 Arg(Descriptor::kVector, type_feedback_vector)); |
671 __ Dispatch(); | 679 __ Dispatch(); |
672 } | 680 } |
673 | 681 |
674 // StaNamedPropertySloppy <object> <name_index> <slot> | 682 // StaNamedPropertySloppy <object> <name_index> <slot> |
675 // | 683 // |
676 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and | 684 // Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and |
677 // the name in constant pool entry <name_index> with the value in the | 685 // the name in constant pool entry <name_index> with the value in the |
678 // accumulator. | 686 // accumulator. |
679 void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) { | 687 void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) { |
680 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); | 688 auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
681 DoStoreIC(ic, assembler); | 689 typedef decltype(ic)::Descriptor Descriptor; |
| 690 DoStoreIC<Descriptor>(ic, assembler); |
682 } | 691 } |
683 | 692 |
684 // StaNamedPropertyStrict <object> <name_index> <slot> | 693 // StaNamedPropertyStrict <object> <name_index> <slot> |
685 // | 694 // |
686 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and | 695 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and |
687 // the name in constant pool entry <name_index> with the value in the | 696 // the name in constant pool entry <name_index> with the value in the |
688 // accumulator. | 697 // accumulator. |
689 void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) { | 698 void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) { |
690 Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); | 699 auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
691 DoStoreIC(ic, assembler); | 700 typedef decltype(ic)::Descriptor Descriptor; |
| 701 DoStoreIC<Descriptor>(ic, assembler); |
692 } | 702 } |
693 | 703 |
| 704 template <typename Descriptor> |
694 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { | 705 void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { |
695 typedef StoreWithVectorDescriptor Descriptor; | |
696 Node* code_target = __ HeapConstant(ic.code()); | 706 Node* code_target = __ HeapConstant(ic.code()); |
697 Node* object_reg_index = __ BytecodeOperandReg(0); | 707 Node* object_reg_index = __ BytecodeOperandReg(0); |
698 Node* object = __ LoadRegister(object_reg_index); | 708 Node* object = __ LoadRegister(object_reg_index); |
699 Node* name_reg_index = __ BytecodeOperandReg(1); | 709 Node* name_reg_index = __ BytecodeOperandReg(1); |
700 Node* name = __ LoadRegister(name_reg_index); | 710 Node* name = __ LoadRegister(name_reg_index); |
701 Node* value = __ GetAccumulator(); | 711 Node* value = __ GetAccumulator(); |
702 Node* raw_slot = __ BytecodeOperandIdx(2); | 712 Node* raw_slot = __ BytecodeOperandIdx(2); |
703 Node* smi_slot = __ SmiTag(raw_slot); | 713 Node* smi_slot = __ SmiTag(raw_slot); |
704 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 714 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
705 Node* context = __ GetContext(); | 715 Node* context = __ GetContext(); |
706 __ CallStub(ic.descriptor(), code_target, context, | 716 __ CallStub(ic.descriptor(), code_target, context, |
707 Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name), | 717 Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name), |
708 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), | 718 Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot), |
709 Arg(Descriptor::kVector, type_feedback_vector)); | 719 Arg(Descriptor::kVector, type_feedback_vector)); |
710 __ Dispatch(); | 720 __ Dispatch(); |
711 } | 721 } |
712 | 722 |
713 // StaKeyedPropertySloppy <object> <key> <slot> | 723 // StaKeyedPropertySloppy <object> <key> <slot> |
714 // | 724 // |
715 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 725 // Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
716 // and the key <key> with the value in the accumulator. | 726 // and the key <key> with the value in the accumulator. |
717 void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) { | 727 void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) { |
718 Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY); | 728 auto ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY); |
719 DoKeyedStoreIC(ic, assembler); | 729 typedef decltype(ic)::Descriptor Descriptor; |
| 730 DoKeyedStoreIC<Descriptor>(ic, assembler); |
720 } | 731 } |
721 | 732 |
722 // StaKeyedPropertyStrict <object> <key> <slot> | 733 // StaKeyedPropertyStrict <object> <key> <slot> |
723 // | 734 // |
724 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> | 735 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
725 // and the key <key> with the value in the accumulator. | 736 // and the key <key> with the value in the accumulator. |
726 void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) { | 737 void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) { |
727 Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT); | 738 auto ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT); |
728 DoKeyedStoreIC(ic, assembler); | 739 typedef decltype(ic)::Descriptor Descriptor; |
| 740 DoKeyedStoreIC<Descriptor>(ic, assembler); |
729 } | 741 } |
730 | 742 |
731 // PushContext <context> | 743 // PushContext <context> |
732 // | 744 // |
733 // Saves the current context in <context>, and pushes the accumulator as the | 745 // Saves the current context in <context>, and pushes the accumulator as the |
734 // new current context. | 746 // new current context. |
735 void Interpreter::DoPushContext(InterpreterAssembler* assembler) { | 747 void Interpreter::DoPushContext(InterpreterAssembler* assembler) { |
736 Node* reg_index = __ BytecodeOperandReg(0); | 748 Node* reg_index = __ BytecodeOperandReg(0); |
737 Node* new_context = __ GetAccumulator(); | 749 Node* new_context = __ GetAccumulator(); |
738 Node* old_context = __ GetContext(); | 750 Node* old_context = __ GetContext(); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 Node* context = __ GetContext(); | 1021 Node* context = __ GetContext(); |
1010 Node* lhs_value = __ TruncateTaggedToWord32(context, left); | 1022 Node* lhs_value = __ TruncateTaggedToWord32(context, left); |
1011 Node* rhs_value = __ SmiToWord32(right); | 1023 Node* rhs_value = __ SmiToWord32(right); |
1012 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f)); | 1024 Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f)); |
1013 Node* value = __ Word32Sar(lhs_value, shift_count); | 1025 Node* value = __ Word32Sar(lhs_value, shift_count); |
1014 Node* result = __ ChangeInt32ToTagged(value); | 1026 Node* result = __ ChangeInt32ToTagged(value); |
1015 __ SetAccumulator(result); | 1027 __ SetAccumulator(result); |
1016 __ Dispatch(); | 1028 __ Dispatch(); |
1017 } | 1029 } |
1018 | 1030 |
1019 Node* Interpreter::BuildUnaryOp(Callable callable, | 1031 Node* Interpreter::BuildUnaryOp(const Callable& callable, |
1020 InterpreterAssembler* assembler) { | 1032 InterpreterAssembler* assembler) { |
1021 Node* target = __ HeapConstant(callable.code()); | 1033 Node* target = __ HeapConstant(callable.code()); |
1022 Node* accumulator = __ GetAccumulator(); | 1034 Node* accumulator = __ GetAccumulator(); |
1023 Node* context = __ GetContext(); | 1035 Node* context = __ GetContext(); |
1024 return __ CallStub(callable.descriptor(), target, context, accumulator); | 1036 return __ CallStub(callable.descriptor(), target, context, accumulator); |
1025 } | 1037 } |
1026 | 1038 |
1027 void Interpreter::DoUnaryOp(Callable callable, | 1039 void Interpreter::DoUnaryOp(const Callable& callable, |
1028 InterpreterAssembler* assembler) { | 1040 InterpreterAssembler* assembler) { |
1029 Node* result = BuildUnaryOp(callable, assembler); | 1041 Node* result = BuildUnaryOp(callable, assembler); |
1030 __ SetAccumulator(result); | 1042 __ SetAccumulator(result); |
1031 __ Dispatch(); | 1043 __ Dispatch(); |
1032 } | 1044 } |
1033 | 1045 |
1034 template <class Generator> | 1046 template <class Generator> |
1035 void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) { | 1047 void Interpreter::DoUnaryOp(InterpreterAssembler* assembler) { |
1036 Node* value = __ GetAccumulator(); | 1048 Node* value = __ GetAccumulator(); |
1037 Node* context = __ GetContext(); | 1049 Node* context = __ GetContext(); |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2186 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2175 __ SmiTag(new_state)); | 2187 __ SmiTag(new_state)); |
2176 __ SetAccumulator(old_state); | 2188 __ SetAccumulator(old_state); |
2177 | 2189 |
2178 __ Dispatch(); | 2190 __ Dispatch(); |
2179 } | 2191 } |
2180 | 2192 |
2181 } // namespace interpreter | 2193 } // namespace interpreter |
2182 } // namespace internal | 2194 } // namespace internal |
2183 } // namespace v8 | 2195 } // namespace v8 |
OLD | NEW |