| 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 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" |
| 11 #include "src/ic/ic.h" | 11 #include "src/ic/ic.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 #define __ ACCESS_MASM(masm) | 16 #define __ ACCESS_MASM(masm) |
| 17 | 17 |
| 18 void PropertyHandlerCompiler::PushVectorAndSlot(Register vector, |
| 19 Register slot) { |
| 20 MacroAssembler* masm = this->masm(); |
| 21 __ Push(vector); |
| 22 __ Push(slot); |
| 23 } |
| 24 |
| 25 |
| 26 void PropertyHandlerCompiler::PopVectorAndSlot(Register vector, Register slot) { |
| 27 MacroAssembler* masm = this->masm(); |
| 28 __ Pop(slot); |
| 29 __ Pop(vector); |
| 30 } |
| 31 |
| 32 |
| 33 void PropertyHandlerCompiler::DiscardVectorAndSlot() { |
| 34 MacroAssembler* masm = this->masm(); |
| 35 // Remove vector and slot. |
| 36 __ Drop(2); |
| 37 } |
| 38 |
| 18 | 39 |
| 19 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( | 40 void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup( |
| 20 MacroAssembler* masm, Label* miss_label, Register receiver, | 41 MacroAssembler* masm, Label* miss_label, Register receiver, |
| 21 Handle<Name> name, Register scratch0, Register scratch1) { | 42 Handle<Name> name, Register scratch0, Register scratch1) { |
| 22 DCHECK(!AreAliased(receiver, scratch0, scratch1)); | 43 DCHECK(!AreAliased(receiver, scratch0, scratch1)); |
| 23 DCHECK(name->IsUniqueName()); | 44 DCHECK(name->IsUniqueName()); |
| 24 Counters* counters = masm->isolate()->counters(); | 45 Counters* counters = masm->isolate()->counters(); |
| 25 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); | 46 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); |
| 26 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); | 47 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); |
| 27 | 48 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 320 } |
| 300 | 321 |
| 301 | 322 |
| 302 #undef __ | 323 #undef __ |
| 303 #define __ ACCESS_MASM(masm()) | 324 #define __ ACCESS_MASM(masm()) |
| 304 | 325 |
| 305 | 326 |
| 306 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 327 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
| 307 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 328 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
| 308 Label miss; | 329 Label miss; |
| 330 if (IC::ICUseVector(kind())) { |
| 331 PushVectorAndSlot(); |
| 332 } |
| 309 FrontendHeader(receiver(), name, &miss); | 333 FrontendHeader(receiver(), name, &miss); |
| 310 | 334 |
| 311 // Get the value from the cell. | 335 // Get the value from the cell. |
| 312 Register result = StoreDescriptor::ValueRegister(); | 336 Register result = StoreDescriptor::ValueRegister(); |
| 313 __ Mov(result, Operand(cell)); | 337 __ Mov(result, Operand(cell)); |
| 314 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); | 338 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); |
| 315 | 339 |
| 316 // Check for deleted property if property can actually be deleted. | 340 // Check for deleted property if property can actually be deleted. |
| 317 if (is_configurable) { | 341 if (is_configurable) { |
| 318 __ JumpIfRoot(result, Heap::kTheHoleValueRootIndex, &miss); | 342 __ JumpIfRoot(result, Heap::kTheHoleValueRootIndex, &miss); |
| 319 } | 343 } |
| 320 | 344 |
| 321 Counters* counters = isolate()->counters(); | 345 Counters* counters = isolate()->counters(); |
| 322 __ IncrementCounter(counters->named_load_global_stub(), 1, x1, x3); | 346 __ IncrementCounter(counters->named_load_global_stub(), 1, x1, x3); |
| 347 if (IC::ICUseVector(kind())) { |
| 348 DiscardVectorAndSlot(); |
| 349 } |
| 323 __ Ret(); | 350 __ Ret(); |
| 324 | 351 |
| 325 FrontendFooter(name, &miss); | 352 FrontendFooter(name, &miss); |
| 326 | 353 |
| 327 // Return the generated code. | 354 // Return the generated code. |
| 328 return GetCode(kind(), Code::NORMAL, name); | 355 return GetCode(kind(), Code::NORMAL, name); |
| 329 } | 356 } |
| 330 | 357 |
| 331 | 358 |
| 332 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 359 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return reg; | 550 return reg; |
| 524 } | 551 } |
| 525 | 552 |
| 526 | 553 |
| 527 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 554 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
| 528 if (!miss->is_unused()) { | 555 if (!miss->is_unused()) { |
| 529 Label success; | 556 Label success; |
| 530 __ B(&success); | 557 __ B(&success); |
| 531 | 558 |
| 532 __ Bind(miss); | 559 __ Bind(miss); |
| 560 if (IC::ICUseVector(kind())) { |
| 561 DCHECK(kind() == Code::LOAD_IC); |
| 562 PopVectorAndSlot(); |
| 563 } |
| 533 TailCallBuiltin(masm(), MissBuiltin(kind())); | 564 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 534 | 565 |
| 535 __ Bind(&success); | 566 __ Bind(&success); |
| 536 } | 567 } |
| 537 } | 568 } |
| 538 | 569 |
| 539 | 570 |
| 540 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 571 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
| 541 if (!miss->is_unused()) { | 572 if (!miss->is_unused()) { |
| 542 Label success; | 573 Label success; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 666 |
| 636 // Save necessary data before invoking an interceptor. | 667 // Save necessary data before invoking an interceptor. |
| 637 // Requires a frame to make GC aware of pushed pointers. | 668 // Requires a frame to make GC aware of pushed pointers. |
| 638 { | 669 { |
| 639 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 670 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
| 640 if (must_preserve_receiver_reg) { | 671 if (must_preserve_receiver_reg) { |
| 641 __ Push(receiver(), holder_reg, this->name()); | 672 __ Push(receiver(), holder_reg, this->name()); |
| 642 } else { | 673 } else { |
| 643 __ Push(holder_reg, this->name()); | 674 __ Push(holder_reg, this->name()); |
| 644 } | 675 } |
| 676 InterceptorVectorSlotPush(holder_reg); |
| 645 // Invoke an interceptor. Note: map checks from receiver to | 677 // Invoke an interceptor. Note: map checks from receiver to |
| 646 // interceptor's holder has been compiled before (see a caller | 678 // interceptor's holder has been compiled before (see a caller |
| 647 // of this method.) | 679 // of this method.) |
| 648 CompileCallLoadPropertyWithInterceptor( | 680 CompileCallLoadPropertyWithInterceptor( |
| 649 masm(), receiver(), holder_reg, this->name(), holder(), | 681 masm(), receiver(), holder_reg, this->name(), holder(), |
| 650 IC::kLoadPropertyWithInterceptorOnly); | 682 IC::kLoadPropertyWithInterceptorOnly); |
| 651 | 683 |
| 652 // Check if interceptor provided a value for property. If it's | 684 // Check if interceptor provided a value for property. If it's |
| 653 // the case, return immediately. | 685 // the case, return immediately. |
| 654 Label interceptor_failed; | 686 Label interceptor_failed; |
| 655 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, | 687 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, |
| 656 &interceptor_failed); | 688 &interceptor_failed); |
| 657 frame_scope.GenerateLeaveFrame(); | 689 frame_scope.GenerateLeaveFrame(); |
| 658 __ Ret(); | 690 __ Ret(); |
| 659 | 691 |
| 660 __ Bind(&interceptor_failed); | 692 __ Bind(&interceptor_failed); |
| 693 InterceptorVectorSlotPop(holder_reg); |
| 661 if (must_preserve_receiver_reg) { | 694 if (must_preserve_receiver_reg) { |
| 662 __ Pop(this->name(), holder_reg, receiver()); | 695 __ Pop(this->name(), holder_reg, receiver()); |
| 663 } else { | 696 } else { |
| 664 __ Pop(this->name(), holder_reg); | 697 __ Pop(this->name(), holder_reg); |
| 665 } | 698 } |
| 666 // Leave the internal frame. | 699 // Leave the internal frame. |
| 667 } | 700 } |
| 668 | 701 |
| 669 GenerateLoadPostInterceptor(it, holder_reg); | 702 GenerateLoadPostInterceptor(it, holder_reg); |
| 670 } | 703 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 681 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 714 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
| 682 __ TailCallExternalReference( | 715 __ TailCallExternalReference( |
| 683 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 716 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
| 684 } | 717 } |
| 685 | 718 |
| 686 | 719 |
| 687 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 720 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 688 Handle<JSObject> object, Handle<Name> name, | 721 Handle<JSObject> object, Handle<Name> name, |
| 689 Handle<ExecutableAccessorInfo> callback) { | 722 Handle<ExecutableAccessorInfo> callback) { |
| 690 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 723 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
| 691 Register holder_reg = Frontend(receiver(), name); | 724 Register holder_reg = Frontend(name); |
| 692 | 725 |
| 693 // Stub never generated for non-global objects that require access checks. | 726 // Stub never generated for non-global objects that require access checks. |
| 694 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 727 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
| 695 | 728 |
| 696 // receiver() and holder_reg can alias. | 729 // receiver() and holder_reg can alias. |
| 697 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 730 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
| 698 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 731 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
| 699 __ Mov(scratch1(), Operand(callback)); | 732 __ Mov(scratch1(), Operand(callback)); |
| 700 __ Mov(scratch2(), Operand(name)); | 733 __ Mov(scratch2(), Operand(name)); |
| 701 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 734 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
| 702 | 735 |
| 703 // Do tail-call to the runtime system. | 736 // Do tail-call to the runtime system. |
| 704 ExternalReference store_callback_property = | 737 ExternalReference store_callback_property = |
| 705 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 738 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
| 706 __ TailCallExternalReference(store_callback_property, 5, 1); | 739 __ TailCallExternalReference(store_callback_property, 5, 1); |
| 707 | 740 |
| 708 // Return the generated code. | 741 // Return the generated code. |
| 709 return GetCode(kind(), Code::FAST, name); | 742 return GetCode(kind(), Code::FAST, name); |
| 710 } | 743 } |
| 711 | 744 |
| 712 | 745 |
| 713 #undef __ | 746 #undef __ |
| 714 } | 747 } |
| 715 } // namespace v8::internal | 748 } // namespace v8::internal |
| 716 | 749 |
| 717 #endif // V8_TARGET_ARCH_IA32 | 750 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |