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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 return reg; | 543 return reg; |
517 } | 544 } |
518 | 545 |
519 | 546 |
520 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 547 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
521 if (!miss->is_unused()) { | 548 if (!miss->is_unused()) { |
522 Label success; | 549 Label success; |
523 __ B(&success); | 550 __ B(&success); |
524 | 551 |
525 __ Bind(miss); | 552 __ Bind(miss); |
| 553 if (IC::ICUseVector(kind())) { |
| 554 DCHECK(kind() == Code::LOAD_IC); |
| 555 PopVectorAndSlot(); |
| 556 } |
526 TailCallBuiltin(masm(), MissBuiltin(kind())); | 557 TailCallBuiltin(masm(), MissBuiltin(kind())); |
527 | 558 |
528 __ Bind(&success); | 559 __ Bind(&success); |
529 } | 560 } |
530 } | 561 } |
531 | 562 |
532 | 563 |
533 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 564 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
534 if (!miss->is_unused()) { | 565 if (!miss->is_unused()) { |
535 Label success; | 566 Label success; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 659 |
629 // Save necessary data before invoking an interceptor. | 660 // Save necessary data before invoking an interceptor. |
630 // Requires a frame to make GC aware of pushed pointers. | 661 // Requires a frame to make GC aware of pushed pointers. |
631 { | 662 { |
632 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 663 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
633 if (must_preserve_receiver_reg) { | 664 if (must_preserve_receiver_reg) { |
634 __ Push(receiver(), holder_reg, this->name()); | 665 __ Push(receiver(), holder_reg, this->name()); |
635 } else { | 666 } else { |
636 __ Push(holder_reg, this->name()); | 667 __ Push(holder_reg, this->name()); |
637 } | 668 } |
| 669 InterceptorVectorSlotPush(holder_reg); |
638 // Invoke an interceptor. Note: map checks from receiver to | 670 // Invoke an interceptor. Note: map checks from receiver to |
639 // interceptor's holder has been compiled before (see a caller | 671 // interceptor's holder has been compiled before (see a caller |
640 // of this method.) | 672 // of this method.) |
641 CompileCallLoadPropertyWithInterceptor( | 673 CompileCallLoadPropertyWithInterceptor( |
642 masm(), receiver(), holder_reg, this->name(), holder(), | 674 masm(), receiver(), holder_reg, this->name(), holder(), |
643 IC::kLoadPropertyWithInterceptorOnly); | 675 IC::kLoadPropertyWithInterceptorOnly); |
644 | 676 |
645 // Check if interceptor provided a value for property. If it's | 677 // Check if interceptor provided a value for property. If it's |
646 // the case, return immediately. | 678 // the case, return immediately. |
647 Label interceptor_failed; | 679 Label interceptor_failed; |
648 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, | 680 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, |
649 &interceptor_failed); | 681 &interceptor_failed); |
650 frame_scope.GenerateLeaveFrame(); | 682 frame_scope.GenerateLeaveFrame(); |
651 __ Ret(); | 683 __ Ret(); |
652 | 684 |
653 __ Bind(&interceptor_failed); | 685 __ Bind(&interceptor_failed); |
| 686 InterceptorVectorSlotPop(holder_reg); |
654 if (must_preserve_receiver_reg) { | 687 if (must_preserve_receiver_reg) { |
655 __ Pop(this->name(), holder_reg, receiver()); | 688 __ Pop(this->name(), holder_reg, receiver()); |
656 } else { | 689 } else { |
657 __ Pop(this->name(), holder_reg); | 690 __ Pop(this->name(), holder_reg); |
658 } | 691 } |
659 // Leave the internal frame. | 692 // Leave the internal frame. |
660 } | 693 } |
661 | 694 |
662 GenerateLoadPostInterceptor(it, holder_reg); | 695 GenerateLoadPostInterceptor(it, holder_reg); |
663 } | 696 } |
(...skipping 10 matching lines...) Expand all Loading... |
674 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 707 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
675 __ TailCallExternalReference( | 708 __ TailCallExternalReference( |
676 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 709 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
677 } | 710 } |
678 | 711 |
679 | 712 |
680 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 713 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
681 Handle<JSObject> object, Handle<Name> name, | 714 Handle<JSObject> object, Handle<Name> name, |
682 Handle<ExecutableAccessorInfo> callback) { | 715 Handle<ExecutableAccessorInfo> callback) { |
683 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 716 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
684 Register holder_reg = Frontend(receiver(), name); | 717 Register holder_reg = Frontend(name); |
685 | 718 |
686 // Stub never generated for non-global objects that require access checks. | 719 // Stub never generated for non-global objects that require access checks. |
687 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 720 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
688 | 721 |
689 // receiver() and holder_reg can alias. | 722 // receiver() and holder_reg can alias. |
690 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 723 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
691 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 724 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
692 __ Mov(scratch1(), Operand(callback)); | 725 __ Mov(scratch1(), Operand(callback)); |
693 __ Mov(scratch2(), Operand(name)); | 726 __ Mov(scratch2(), Operand(name)); |
694 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 727 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
695 | 728 |
696 // Do tail-call to the runtime system. | 729 // Do tail-call to the runtime system. |
697 ExternalReference store_callback_property = | 730 ExternalReference store_callback_property = |
698 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 731 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
699 __ TailCallExternalReference(store_callback_property, 5, 1); | 732 __ TailCallExternalReference(store_callback_property, 5, 1); |
700 | 733 |
701 // Return the generated code. | 734 // Return the generated code. |
702 return GetCode(kind(), Code::FAST, name); | 735 return GetCode(kind(), Code::FAST, name); |
703 } | 736 } |
704 | 737 |
705 | 738 |
706 #undef __ | 739 #undef __ |
707 } | 740 } |
708 } // namespace v8::internal | 741 } // namespace v8::internal |
709 | 742 |
710 #endif // V8_TARGET_ARCH_IA32 | 743 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |