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