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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ic/call-optimization.h" | 7 #include "src/ic/call-optimization.h" |
8 #include "src/ic/handler-compiler.h" | 8 #include "src/ic/handler-compiler.h" |
9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 __ Push(vector); | 319 __ Push(vector); |
320 __ PushReturnAddressFrom(r11); | 320 __ PushReturnAddressFrom(r11); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 324 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
325 // Return address is on the stack. | 325 // Return address is on the stack. |
326 StoreIC_PushArgs(masm); | 326 StoreIC_PushArgs(masm); |
327 | 327 |
328 // Do tail-call to runtime routine. | 328 // Do tail-call to runtime routine. |
329 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5, 1); | 329 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5); |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 333 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
334 // Return address is on the stack. | 334 // Return address is on the stack. |
335 StoreIC_PushArgs(masm); | 335 StoreIC_PushArgs(masm); |
336 | 336 |
337 // Do tail-call to runtime routine. | 337 // Do tail-call to runtime routine. |
338 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5, 1); | 338 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5); |
339 } | 339 } |
340 | 340 |
341 | 341 |
342 #undef __ | 342 #undef __ |
343 #define __ ACCESS_MASM((masm())) | 343 #define __ ACCESS_MASM((masm())) |
344 | 344 |
345 | 345 |
346 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 346 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
347 Handle<Name> name) { | 347 Handle<Name> name) { |
348 if (!label->is_unused()) { | 348 if (!label->is_unused()) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 709 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
710 // Call the runtime system to load the interceptor. | 710 // Call the runtime system to load the interceptor. |
711 DCHECK(holder()->HasNamedInterceptor()); | 711 DCHECK(holder()->HasNamedInterceptor()); |
712 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 712 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
713 __ PopReturnAddressTo(scratch2()); | 713 __ PopReturnAddressTo(scratch2()); |
714 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 714 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
715 holder()); | 715 holder()); |
716 __ PushReturnAddressFrom(scratch2()); | 716 __ PushReturnAddressFrom(scratch2()); |
717 | 717 |
718 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, | 718 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, |
719 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 719 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
720 } | 720 } |
721 | 721 |
722 | 722 |
723 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 723 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
724 Handle<JSObject> object, Handle<Name> name, | 724 Handle<JSObject> object, Handle<Name> name, |
725 Handle<ExecutableAccessorInfo> callback) { | 725 Handle<ExecutableAccessorInfo> callback) { |
726 Register holder_reg = Frontend(name); | 726 Register holder_reg = Frontend(name); |
727 | 727 |
728 __ PopReturnAddressTo(scratch1()); | 728 __ PopReturnAddressTo(scratch1()); |
729 __ Push(receiver()); | 729 __ Push(receiver()); |
730 __ Push(holder_reg); | 730 __ Push(holder_reg); |
731 // If the callback cannot leak, then push the callback directly, | 731 // If the callback cannot leak, then push the callback directly, |
732 // otherwise wrap it in a weak cell. | 732 // otherwise wrap it in a weak cell. |
733 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 733 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
734 __ Push(callback); | 734 __ Push(callback); |
735 } else { | 735 } else { |
736 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 736 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
737 __ Push(cell); | 737 __ Push(cell); |
738 } | 738 } |
739 __ Push(name); | 739 __ Push(name); |
740 __ Push(value()); | 740 __ Push(value()); |
741 __ PushReturnAddressFrom(scratch1()); | 741 __ PushReturnAddressFrom(scratch1()); |
742 | 742 |
743 // Do tail-call to the runtime system. | 743 // Do tail-call to the runtime system. |
744 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1); | 744 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5); |
745 | 745 |
746 // Return the generated code. | 746 // Return the generated code. |
747 return GetCode(kind(), Code::FAST, name); | 747 return GetCode(kind(), Code::FAST, name); |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 751 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
752 Handle<Name> name) { | 752 Handle<Name> name) { |
753 __ PopReturnAddressTo(scratch1()); | 753 __ PopReturnAddressTo(scratch1()); |
754 __ Push(receiver()); | 754 __ Push(receiver()); |
755 __ Push(this->name()); | 755 __ Push(this->name()); |
756 __ Push(value()); | 756 __ Push(value()); |
757 __ PushReturnAddressFrom(scratch1()); | 757 __ PushReturnAddressFrom(scratch1()); |
758 | 758 |
759 // Do tail-call to the runtime system. | 759 // Do tail-call to the runtime system. |
760 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1); | 760 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3); |
761 | 761 |
762 // Return the generated code. | 762 // Return the generated code. |
763 return GetCode(kind(), Code::FAST, name); | 763 return GetCode(kind(), Code::FAST, name); |
764 } | 764 } |
765 | 765 |
766 | 766 |
767 Register NamedStoreHandlerCompiler::value() { | 767 Register NamedStoreHandlerCompiler::value() { |
768 return StoreDescriptor::ValueRegister(); | 768 return StoreDescriptor::ValueRegister(); |
769 } | 769 } |
770 | 770 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 // Return the generated code. | 804 // Return the generated code. |
805 return GetCode(kind(), Code::NORMAL, name); | 805 return GetCode(kind(), Code::NORMAL, name); |
806 } | 806 } |
807 | 807 |
808 | 808 |
809 #undef __ | 809 #undef __ |
810 } // namespace internal | 810 } // namespace internal |
811 } // namespace v8 | 811 } // namespace v8 |
812 | 812 |
813 #endif // V8_TARGET_ARCH_X64 | 813 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |