OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 __ push(vector); | 316 __ push(vector); |
317 __ push(receiver); // which contains the return address. | 317 __ push(receiver); // which contains the return address. |
318 } | 318 } |
319 | 319 |
320 | 320 |
321 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 321 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
322 // Return address is on the stack. | 322 // Return address is on the stack. |
323 StoreIC_PushArgs(masm); | 323 StoreIC_PushArgs(masm); |
324 | 324 |
325 // Do tail-call to runtime routine. | 325 // Do tail-call to runtime routine. |
326 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5, 1); | 326 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5); |
327 } | 327 } |
328 | 328 |
329 | 329 |
330 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 330 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
331 // Return address is on the stack. | 331 // Return address is on the stack. |
332 StoreIC_PushArgs(masm); | 332 StoreIC_PushArgs(masm); |
333 | 333 |
334 // Do tail-call to runtime routine. | 334 // Do tail-call to runtime routine. |
335 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5, 1); | 335 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5); |
336 } | 336 } |
337 | 337 |
338 | 338 |
339 #undef __ | 339 #undef __ |
340 #define __ ACCESS_MASM(masm()) | 340 #define __ ACCESS_MASM(masm()) |
341 | 341 |
342 | 342 |
343 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 343 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
344 Handle<Name> name) { | 344 Handle<Name> name) { |
345 if (!label->is_unused()) { | 345 if (!label->is_unused()) { |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 718 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
719 DCHECK(holder()->HasNamedInterceptor()); | 719 DCHECK(holder()->HasNamedInterceptor()); |
720 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 720 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
721 // Call the runtime system to load the interceptor. | 721 // Call the runtime system to load the interceptor. |
722 __ pop(scratch2()); // save old return address | 722 __ pop(scratch2()); // save old return address |
723 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 723 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
724 holder()); | 724 holder()); |
725 __ push(scratch2()); // restore old return address | 725 __ push(scratch2()); // restore old return address |
726 | 726 |
727 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, | 727 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, |
728 NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); | 728 NamedLoadHandlerCompiler::kInterceptorArgsLength); |
729 } | 729 } |
730 | 730 |
731 | 731 |
732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
733 Handle<JSObject> object, Handle<Name> name, | 733 Handle<JSObject> object, Handle<Name> name, |
734 Handle<ExecutableAccessorInfo> callback) { | 734 Handle<ExecutableAccessorInfo> callback) { |
735 Register holder_reg = Frontend(name); | 735 Register holder_reg = Frontend(name); |
736 | 736 |
737 __ pop(scratch1()); // remove the return address | 737 __ pop(scratch1()); // remove the return address |
738 __ push(receiver()); | 738 __ push(receiver()); |
739 __ push(holder_reg); | 739 __ push(holder_reg); |
740 // If the callback cannot leak, then push the callback directly, | 740 // If the callback cannot leak, then push the callback directly, |
741 // otherwise wrap it in a weak cell. | 741 // otherwise wrap it in a weak cell. |
742 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 742 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
743 __ Push(callback); | 743 __ Push(callback); |
744 } else { | 744 } else { |
745 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 745 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
746 __ Push(cell); | 746 __ Push(cell); |
747 } | 747 } |
748 __ Push(name); | 748 __ Push(name); |
749 __ push(value()); | 749 __ push(value()); |
750 __ push(scratch1()); // restore return address | 750 __ push(scratch1()); // restore return address |
751 | 751 |
752 // Do tail-call to the runtime system. | 752 // Do tail-call to the runtime system. |
753 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1); | 753 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5); |
754 | 754 |
755 // Return the generated code. | 755 // Return the generated code. |
756 return GetCode(kind(), Code::FAST, name); | 756 return GetCode(kind(), Code::FAST, name); |
757 } | 757 } |
758 | 758 |
759 | 759 |
760 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 760 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
761 Handle<Name> name) { | 761 Handle<Name> name) { |
762 __ pop(scratch1()); // remove the return address | 762 __ pop(scratch1()); // remove the return address |
763 __ push(receiver()); | 763 __ push(receiver()); |
764 __ push(this->name()); | 764 __ push(this->name()); |
765 __ push(value()); | 765 __ push(value()); |
766 __ push(scratch1()); // restore return address | 766 __ push(scratch1()); // restore return address |
767 | 767 |
768 // Do tail-call to the runtime system. | 768 // Do tail-call to the runtime system. |
769 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1); | 769 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3); |
770 | 770 |
771 // Return the generated code. | 771 // Return the generated code. |
772 return GetCode(kind(), Code::FAST, name); | 772 return GetCode(kind(), Code::FAST, name); |
773 } | 773 } |
774 | 774 |
775 | 775 |
776 Register NamedStoreHandlerCompiler::value() { | 776 Register NamedStoreHandlerCompiler::value() { |
777 return StoreDescriptor::ValueRegister(); | 777 return StoreDescriptor::ValueRegister(); |
778 } | 778 } |
779 | 779 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // Return the generated code. | 813 // Return the generated code. |
814 return GetCode(kind(), Code::NORMAL, name); | 814 return GetCode(kind(), Code::NORMAL, name); |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 #undef __ | 818 #undef __ |
819 } // namespace internal | 819 } // namespace internal |
820 } // namespace v8 | 820 } // namespace v8 |
821 | 821 |
822 #endif // V8_TARGET_ARCH_X87 | 822 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |