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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/ic/call-optimization.h" | 9 #include "src/ic/call-optimization.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // We have to return the passed value, not the return value of the setter. | 85 // We have to return the passed value, not the return value of the setter. |
86 __ pop(v0); | 86 __ pop(v0); |
87 | 87 |
88 // Restore context register. | 88 // Restore context register. |
89 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 89 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
90 } | 90 } |
91 __ Ret(); | 91 __ Ret(); |
92 } | 92 } |
93 | 93 |
94 | 94 |
| 95 void PropertyHandlerCompiler::PushVectorAndSlot(Register vector, |
| 96 Register slot) { |
| 97 MacroAssembler* masm = this->masm(); |
| 98 __ Push(vector, slot); |
| 99 } |
| 100 |
| 101 |
| 102 void PropertyHandlerCompiler::PopVectorAndSlot(Register vector, Register slot) { |
| 103 MacroAssembler* masm = this->masm(); |
| 104 __ Pop(vector, slot); |
| 105 } |
| 106 |
| 107 |
| 108 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
| 109 MacroAssembler* masm = this->masm(); |
| 110 // Remove vector and slot. |
| 111 __ Daddu(sp, sp, Operand(2 * kPointerSize)); |
| 112 } |
| 113 |
| 114 |
95 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 115 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
96 MacroAssembler* masm, Label* miss_label, Register receiver, | 116 MacroAssembler* masm, Label* miss_label, Register receiver, |
97 Handle<Name> name, Register scratch0, Register scratch1) { | 117 Handle<Name> name, Register scratch0, Register scratch1) { |
98 DCHECK(name->IsUniqueName()); | 118 DCHECK(name->IsUniqueName()); |
99 DCHECK(!receiver.is(scratch0)); | 119 DCHECK(!receiver.is(scratch0)); |
100 Counters* counters = masm->isolate()->counters(); | 120 Counters* counters = masm->isolate()->counters(); |
101 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 121 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
102 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 122 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
103 | 123 |
104 Label done; | 124 Label done; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // Return the register containing the holder. | 495 // Return the register containing the holder. |
476 return reg; | 496 return reg; |
477 } | 497 } |
478 | 498 |
479 | 499 |
480 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 500 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
481 if (!miss->is_unused()) { | 501 if (!miss->is_unused()) { |
482 Label success; | 502 Label success; |
483 __ Branch(&success); | 503 __ Branch(&success); |
484 __ bind(miss); | 504 __ bind(miss); |
| 505 if (IC::ICUseVector(kind())) { |
| 506 DCHECK(kind() == Code::LOAD_IC); |
| 507 PopVectorAndSlot(); |
| 508 } |
485 TailCallBuiltin(masm(), MissBuiltin(kind())); | 509 TailCallBuiltin(masm(), MissBuiltin(kind())); |
486 __ bind(&success); | 510 __ bind(&success); |
487 } | 511 } |
488 } | 512 } |
489 | 513 |
490 | 514 |
491 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 515 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
492 if (!miss->is_unused()) { | 516 if (!miss->is_unused()) { |
493 Label success; | 517 Label success; |
494 __ Branch(&success); | 518 __ Branch(&success); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 600 |
577 // Save necessary data before invoking an interceptor. | 601 // Save necessary data before invoking an interceptor. |
578 // Requires a frame to make GC aware of pushed pointers. | 602 // Requires a frame to make GC aware of pushed pointers. |
579 { | 603 { |
580 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 604 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
581 if (must_preserve_receiver_reg) { | 605 if (must_preserve_receiver_reg) { |
582 __ Push(receiver(), holder_reg, this->name()); | 606 __ Push(receiver(), holder_reg, this->name()); |
583 } else { | 607 } else { |
584 __ Push(holder_reg, this->name()); | 608 __ Push(holder_reg, this->name()); |
585 } | 609 } |
| 610 InterceptorVectorSlotPush(holder_reg); |
586 // Invoke an interceptor. Note: map checks from receiver to | 611 // Invoke an interceptor. Note: map checks from receiver to |
587 // interceptor's holder has been compiled before (see a caller | 612 // interceptor's holder has been compiled before (see a caller |
588 // of this method). | 613 // of this method). |
589 CompileCallLoadPropertyWithInterceptor( | 614 CompileCallLoadPropertyWithInterceptor( |
590 masm(), receiver(), holder_reg, this->name(), holder(), | 615 masm(), receiver(), holder_reg, this->name(), holder(), |
591 IC::kLoadPropertyWithInterceptorOnly); | 616 IC::kLoadPropertyWithInterceptorOnly); |
592 | 617 |
593 // Check if interceptor provided a value for property. If it's | 618 // Check if interceptor provided a value for property. If it's |
594 // the case, return immediately. | 619 // the case, return immediately. |
595 Label interceptor_failed; | 620 Label interceptor_failed; |
596 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); | 621 __ LoadRoot(scratch1(), Heap::kNoInterceptorResultSentinelRootIndex); |
597 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); | 622 __ Branch(&interceptor_failed, eq, v0, Operand(scratch1())); |
598 frame_scope.GenerateLeaveFrame(); | 623 frame_scope.GenerateLeaveFrame(); |
599 __ Ret(); | 624 __ Ret(); |
600 | 625 |
601 __ bind(&interceptor_failed); | 626 __ bind(&interceptor_failed); |
| 627 InterceptorVectorSlotPop(holder_reg); |
602 if (must_preserve_receiver_reg) { | 628 if (must_preserve_receiver_reg) { |
603 __ Pop(receiver(), holder_reg, this->name()); | 629 __ Pop(receiver(), holder_reg, this->name()); |
604 } else { | 630 } else { |
605 __ Pop(holder_reg, this->name()); | 631 __ Pop(holder_reg, this->name()); |
606 } | 632 } |
607 // Leave the internal frame. | 633 // Leave the internal frame. |
608 } | 634 } |
609 | 635 |
610 GenerateLoadPostInterceptor(it, holder_reg); | 636 GenerateLoadPostInterceptor(it, holder_reg); |
611 } | 637 } |
612 | 638 |
613 | 639 |
614 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 640 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
615 // Call the runtime system to load the interceptor. | 641 // Call the runtime system to load the interceptor. |
616 DCHECK(holder()->HasNamedInterceptor()); | 642 DCHECK(holder()->HasNamedInterceptor()); |
617 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 643 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
618 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 644 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
619 holder()); | 645 holder()); |
620 | 646 |
621 ExternalReference ref = ExternalReference( | 647 ExternalReference ref = ExternalReference( |
622 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 648 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
623 __ TailCallExternalReference( | 649 __ TailCallExternalReference( |
624 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 650 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
625 } | 651 } |
626 | 652 |
627 | 653 |
628 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 654 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
629 Handle<JSObject> object, Handle<Name> name, | 655 Handle<JSObject> object, Handle<Name> name, |
630 Handle<ExecutableAccessorInfo> callback) { | 656 Handle<ExecutableAccessorInfo> callback) { |
631 Register holder_reg = Frontend(receiver(), name); | 657 Register holder_reg = Frontend(name); |
632 | 658 |
633 __ Push(receiver(), holder_reg); // Receiver. | 659 __ Push(receiver(), holder_reg); // Receiver. |
634 __ li(at, Operand(callback)); // Callback info. | 660 __ li(at, Operand(callback)); // Callback info. |
635 __ push(at); | 661 __ push(at); |
636 __ li(at, Operand(name)); | 662 __ li(at, Operand(name)); |
637 __ Push(at, value()); | 663 __ Push(at, value()); |
638 | 664 |
639 // Do tail-call to the runtime system. | 665 // Do tail-call to the runtime system. |
640 ExternalReference store_callback_property = | 666 ExternalReference store_callback_property = |
641 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 667 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
(...skipping 19 matching lines...) Expand all Loading... |
661 | 687 |
662 | 688 |
663 Register NamedStoreHandlerCompiler::value() { | 689 Register NamedStoreHandlerCompiler::value() { |
664 return StoreDescriptor::ValueRegister(); | 690 return StoreDescriptor::ValueRegister(); |
665 } | 691 } |
666 | 692 |
667 | 693 |
668 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 694 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
669 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 695 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
670 Label miss; | 696 Label miss; |
| 697 if (IC::ICUseVector(kind())) { |
| 698 PushVectorAndSlot(); |
| 699 } |
671 | 700 |
672 FrontendHeader(receiver(), name, &miss); | 701 FrontendHeader(receiver(), name, &miss); |
673 | 702 |
674 // Get the value from the cell. | 703 // Get the value from the cell. |
675 Register result = StoreDescriptor::ValueRegister(); | 704 Register result = StoreDescriptor::ValueRegister(); |
676 __ li(result, Operand(cell)); | 705 __ li(result, Operand(cell)); |
677 __ ld(result, FieldMemOperand(result, Cell::kValueOffset)); | 706 __ ld(result, FieldMemOperand(result, Cell::kValueOffset)); |
678 | 707 |
679 // Check for deleted property if property can actually be deleted. | 708 // Check for deleted property if property can actually be deleted. |
680 if (is_configurable) { | 709 if (is_configurable) { |
681 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 710 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
682 __ Branch(&miss, eq, result, Operand(at)); | 711 __ Branch(&miss, eq, result, Operand(at)); |
683 } | 712 } |
684 | 713 |
685 Counters* counters = isolate()->counters(); | 714 Counters* counters = isolate()->counters(); |
686 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); | 715 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); |
| 716 if (IC::ICUseVector(kind())) { |
| 717 DiscardVectorAndSlot(); |
| 718 } |
687 __ Ret(USE_DELAY_SLOT); | 719 __ Ret(USE_DELAY_SLOT); |
688 __ mov(v0, result); | 720 __ mov(v0, result); |
689 | 721 |
690 FrontendFooter(name, &miss); | 722 FrontendFooter(name, &miss); |
691 | 723 |
692 // Return the generated code. | 724 // Return the generated code. |
693 return GetCode(kind(), Code::NORMAL, name); | 725 return GetCode(kind(), Code::NORMAL, name); |
694 } | 726 } |
695 | 727 |
696 | 728 |
697 #undef __ | 729 #undef __ |
698 } | 730 } |
699 } // namespace v8::internal | 731 } // namespace v8::internal |
700 | 732 |
701 #endif // V8_TARGET_ARCH_MIPS64 | 733 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |