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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 329 } |
309 | 330 |
310 | 331 |
311 #undef __ | 332 #undef __ |
312 #define __ ACCESS_MASM(masm()) | 333 #define __ ACCESS_MASM(masm()) |
313 | 334 |
314 | 335 |
315 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( | 336 Handle<Code> NamedLoadHandlerCompiler::CompileLoadGlobal( |
316 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { | 337 Handle<PropertyCell> cell, Handle<Name> name, bool is_configurable) { |
317 Label miss; | 338 Label miss; |
| 339 if (IC::ICUseVector(kind())) { |
| 340 PushVectorAndSlot(); |
| 341 } |
318 FrontendHeader(receiver(), name, &miss); | 342 FrontendHeader(receiver(), name, &miss); |
319 | 343 |
320 // Get the value from the cell. | 344 // Get the value from the cell. |
321 Register result = StoreDescriptor::ValueRegister(); | 345 Register result = StoreDescriptor::ValueRegister(); |
322 __ Mov(result, Operand(cell)); | 346 __ Mov(result, Operand(cell)); |
323 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); | 347 __ Ldr(result, FieldMemOperand(result, Cell::kValueOffset)); |
324 | 348 |
325 // Check for deleted property if property can actually be deleted. | 349 // Check for deleted property if property can actually be deleted. |
326 if (is_configurable) { | 350 if (is_configurable) { |
327 __ JumpIfRoot(result, Heap::kTheHoleValueRootIndex, &miss); | 351 __ JumpIfRoot(result, Heap::kTheHoleValueRootIndex, &miss); |
328 } | 352 } |
329 | 353 |
330 Counters* counters = isolate()->counters(); | 354 Counters* counters = isolate()->counters(); |
331 __ IncrementCounter(counters->named_load_global_stub(), 1, x1, x3); | 355 __ IncrementCounter(counters->named_load_global_stub(), 1, x1, x3); |
| 356 if (IC::ICUseVector(kind())) { |
| 357 DiscardVectorAndSlot(); |
| 358 } |
332 __ Ret(); | 359 __ Ret(); |
333 | 360 |
334 FrontendFooter(name, &miss); | 361 FrontendFooter(name, &miss); |
335 | 362 |
336 // Return the generated code. | 363 // Return the generated code. |
337 return GetCode(kind(), Code::NORMAL, name); | 364 return GetCode(kind(), Code::NORMAL, name); |
338 } | 365 } |
339 | 366 |
340 | 367 |
341 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 368 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 return reg; | 535 return reg; |
509 } | 536 } |
510 | 537 |
511 | 538 |
512 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 539 void NamedLoadHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
513 if (!miss->is_unused()) { | 540 if (!miss->is_unused()) { |
514 Label success; | 541 Label success; |
515 __ B(&success); | 542 __ B(&success); |
516 | 543 |
517 __ Bind(miss); | 544 __ Bind(miss); |
| 545 if (IC::ICUseVector(kind())) { |
| 546 DCHECK(kind() == Code::LOAD_IC); |
| 547 PopVectorAndSlot(); |
| 548 } |
518 TailCallBuiltin(masm(), MissBuiltin(kind())); | 549 TailCallBuiltin(masm(), MissBuiltin(kind())); |
519 | 550 |
520 __ Bind(&success); | 551 __ Bind(&success); |
521 } | 552 } |
522 } | 553 } |
523 | 554 |
524 | 555 |
525 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { | 556 void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) { |
526 if (!miss->is_unused()) { | 557 if (!miss->is_unused()) { |
527 Label success; | 558 Label success; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 651 |
621 // Save necessary data before invoking an interceptor. | 652 // Save necessary data before invoking an interceptor. |
622 // Requires a frame to make GC aware of pushed pointers. | 653 // Requires a frame to make GC aware of pushed pointers. |
623 { | 654 { |
624 FrameScope frame_scope(masm(), StackFrame::INTERNAL); | 655 FrameScope frame_scope(masm(), StackFrame::INTERNAL); |
625 if (must_preserve_receiver_reg) { | 656 if (must_preserve_receiver_reg) { |
626 __ Push(receiver(), holder_reg, this->name()); | 657 __ Push(receiver(), holder_reg, this->name()); |
627 } else { | 658 } else { |
628 __ Push(holder_reg, this->name()); | 659 __ Push(holder_reg, this->name()); |
629 } | 660 } |
| 661 InterceptorVectorSlotPush(holder_reg); |
630 // Invoke an interceptor. Note: map checks from receiver to | 662 // Invoke an interceptor. Note: map checks from receiver to |
631 // interceptor's holder has been compiled before (see a caller | 663 // interceptor's holder has been compiled before (see a caller |
632 // of this method.) | 664 // of this method.) |
633 CompileCallLoadPropertyWithInterceptor( | 665 CompileCallLoadPropertyWithInterceptor( |
634 masm(), receiver(), holder_reg, this->name(), holder(), | 666 masm(), receiver(), holder_reg, this->name(), holder(), |
635 IC::kLoadPropertyWithInterceptorOnly); | 667 IC::kLoadPropertyWithInterceptorOnly); |
636 | 668 |
637 // Check if interceptor provided a value for property. If it's | 669 // Check if interceptor provided a value for property. If it's |
638 // the case, return immediately. | 670 // the case, return immediately. |
639 Label interceptor_failed; | 671 Label interceptor_failed; |
640 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, | 672 __ JumpIfRoot(x0, Heap::kNoInterceptorResultSentinelRootIndex, |
641 &interceptor_failed); | 673 &interceptor_failed); |
642 frame_scope.GenerateLeaveFrame(); | 674 frame_scope.GenerateLeaveFrame(); |
643 __ Ret(); | 675 __ Ret(); |
644 | 676 |
645 __ Bind(&interceptor_failed); | 677 __ Bind(&interceptor_failed); |
| 678 InterceptorVectorSlotPop(holder_reg); |
646 if (must_preserve_receiver_reg) { | 679 if (must_preserve_receiver_reg) { |
647 __ Pop(this->name(), holder_reg, receiver()); | 680 __ Pop(this->name(), holder_reg, receiver()); |
648 } else { | 681 } else { |
649 __ Pop(this->name(), holder_reg); | 682 __ Pop(this->name(), holder_reg); |
650 } | 683 } |
651 // Leave the internal frame. | 684 // Leave the internal frame. |
652 } | 685 } |
653 | 686 |
654 GenerateLoadPostInterceptor(it, holder_reg); | 687 GenerateLoadPostInterceptor(it, holder_reg); |
655 } | 688 } |
(...skipping 10 matching lines...) Expand all Loading... |
666 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); | 699 IC_Utility(IC::kLoadPropertyWithInterceptor), isolate()); |
667 __ TailCallExternalReference( | 700 __ TailCallExternalReference( |
668 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 701 ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); |
669 } | 702 } |
670 | 703 |
671 | 704 |
672 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 705 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
673 Handle<JSObject> object, Handle<Name> name, | 706 Handle<JSObject> object, Handle<Name> name, |
674 Handle<ExecutableAccessorInfo> callback) { | 707 Handle<ExecutableAccessorInfo> callback) { |
675 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); | 708 ASM_LOCATION("NamedStoreHandlerCompiler::CompileStoreCallback"); |
676 Register holder_reg = Frontend(receiver(), name); | 709 Register holder_reg = Frontend(name); |
677 | 710 |
678 // Stub never generated for non-global objects that require access checks. | 711 // Stub never generated for non-global objects that require access checks. |
679 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); | 712 DCHECK(holder()->IsJSGlobalProxy() || !holder()->IsAccessCheckNeeded()); |
680 | 713 |
681 // receiver() and holder_reg can alias. | 714 // receiver() and holder_reg can alias. |
682 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); | 715 DCHECK(!AreAliased(receiver(), scratch1(), scratch2(), value())); |
683 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); | 716 DCHECK(!AreAliased(holder_reg, scratch1(), scratch2(), value())); |
684 __ Mov(scratch1(), Operand(callback)); | 717 __ Mov(scratch1(), Operand(callback)); |
685 __ Mov(scratch2(), Operand(name)); | 718 __ Mov(scratch2(), Operand(name)); |
686 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); | 719 __ Push(receiver(), holder_reg, scratch1(), scratch2(), value()); |
687 | 720 |
688 // Do tail-call to the runtime system. | 721 // Do tail-call to the runtime system. |
689 ExternalReference store_callback_property = | 722 ExternalReference store_callback_property = |
690 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); | 723 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); |
691 __ TailCallExternalReference(store_callback_property, 5, 1); | 724 __ TailCallExternalReference(store_callback_property, 5, 1); |
692 | 725 |
693 // Return the generated code. | 726 // Return the generated code. |
694 return GetCode(kind(), Code::FAST, name); | 727 return GetCode(kind(), Code::FAST, name); |
695 } | 728 } |
696 | 729 |
697 | 730 |
698 #undef __ | 731 #undef __ |
699 } | 732 } |
700 } // namespace v8::internal | 733 } // namespace v8::internal |
701 | 734 |
702 #endif // V8_TARGET_ARCH_IA32 | 735 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |