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" |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 619 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); |
620 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 620 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); |
621 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 621 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); |
622 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 622 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); |
623 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 623 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); |
624 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 624 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); |
625 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); | 625 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 6); |
626 | 626 |
627 __ Push(receiver()); | 627 __ Push(receiver()); |
628 | 628 |
629 if (heap()->InNewSpace(callback->data())) { | 629 Handle<Object> data(callback->data(), isolate()); |
630 __ Mov(scratch3(), Operand(callback)); | 630 if (data->IsUndefined() || data->IsSmi()) { |
631 __ Ldr(scratch3(), | 631 __ Mov(scratch3(), Operand(data)); |
632 FieldMemOperand(scratch3(), ExecutableAccessorInfo::kDataOffset)); | |
633 } else { | 632 } else { |
634 __ Mov(scratch3(), Operand(Handle<Object>(callback->data(), isolate()))); | 633 Handle<WeakCell> cell = |
| 634 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
| 635 // The callback is alive if this instruction is executed, |
| 636 // so the weak cell is not cleared and points to data. |
| 637 __ GetWeakValue(scratch3(), cell); |
635 } | 638 } |
636 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); | 639 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); |
637 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); | 640 __ Mov(scratch2(), Operand(ExternalReference::isolate_address(isolate()))); |
638 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg, name()); | 641 __ Push(scratch3(), scratch4(), scratch4(), scratch2(), reg, name()); |
639 | 642 |
640 Register args_addr = scratch2(); | 643 Register args_addr = scratch2(); |
641 __ Add(args_addr, __ StackPointer(), kPointerSize); | 644 __ Add(args_addr, __ StackPointer(), kPointerSize); |
642 | 645 |
643 // Stack at this point: | 646 // Stack at this point: |
644 // sp[40] callback data | 647 // sp[40] callback data |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 // Return the generated code. | 765 // Return the generated code. |
763 return GetCode(kind(), Code::FAST, name); | 766 return GetCode(kind(), Code::FAST, name); |
764 } | 767 } |
765 | 768 |
766 | 769 |
767 #undef __ | 770 #undef __ |
768 } | 771 } |
769 } // namespace v8::internal | 772 } // namespace v8::internal |
770 | 773 |
771 #endif // V8_TARGET_ARCH_IA32 | 774 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |