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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 GenerateRestoreName(miss, name); | 587 GenerateRestoreName(miss, name); |
588 if (IC::ICUseVector(kind())) PopVectorAndSlot(); | 588 if (IC::ICUseVector(kind())) PopVectorAndSlot(); |
589 TailCallBuiltin(masm(), MissBuiltin(kind())); | 589 TailCallBuiltin(masm(), MissBuiltin(kind())); |
590 __ bind(&success); | 590 __ bind(&success); |
591 } | 591 } |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 void NamedLoadHandlerCompiler::GenerateLoadCallback( | 595 void NamedLoadHandlerCompiler::GenerateLoadCallback( |
596 Register reg, Handle<AccessorInfo> callback) { | 596 Register reg, Handle<AccessorInfo> callback) { |
| 597 DCHECK(!AreAliased(scratch2(), scratch3(), receiver())); |
| 598 DCHECK(!AreAliased(scratch2(), scratch3(), reg)); |
| 599 |
597 // Insert additional parameters into the stack frame above return address. | 600 // Insert additional parameters into the stack frame above return address. |
598 DCHECK(!scratch3().is(reg)); | |
599 __ pop(scratch3()); // Get return address to place it below. | 601 __ pop(scratch3()); // Get return address to place it below. |
600 | 602 |
601 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 0); | 603 // Build v8::PropertyCallbackInfo::args_ array on the stack and push property |
602 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 1); | 604 // name below the exit frame to make GC aware of them. |
603 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 2); | 605 STATIC_ASSERT(PropertyCallbackArguments::kShouldThrowOnErrorIndex == 0); |
604 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 3); | 606 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == 1); |
605 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 4); | 607 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == 2); |
606 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 5); | 608 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == 3); |
| 609 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == 4); |
| 610 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == 5); |
| 611 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 6); |
| 612 STATIC_ASSERT(PropertyCallbackArguments::kArgsLength == 7); |
| 613 |
607 __ push(receiver()); // receiver | 614 __ push(receiver()); // receiver |
608 // Push data from AccessorInfo. | 615 // Push data from AccessorInfo. |
609 Handle<Object> data(callback->data(), isolate()); | 616 Handle<Object> data(callback->data(), isolate()); |
610 if (data->IsUndefined() || data->IsSmi()) { | 617 if (data->IsUndefined() || data->IsSmi()) { |
611 __ push(Immediate(data)); | 618 __ push(Immediate(data)); |
612 } else { | 619 } else { |
613 DCHECK(!scratch2().is(reg)); | |
614 Handle<WeakCell> cell = | 620 Handle<WeakCell> cell = |
615 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); | 621 isolate()->factory()->NewWeakCell(Handle<HeapObject>::cast(data)); |
616 // The callback is alive if this instruction is executed, | 622 // The callback is alive if this instruction is executed, |
617 // so the weak cell is not cleared and points to data. | 623 // so the weak cell is not cleared and points to data. |
618 __ GetWeakValue(scratch2(), cell); | 624 __ GetWeakValue(scratch2(), cell); |
619 __ push(scratch2()); | 625 __ push(scratch2()); |
620 } | 626 } |
621 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue | 627 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
622 // ReturnValue default value | 628 // ReturnValue default value |
623 __ push(Immediate(isolate()->factory()->undefined_value())); | 629 __ push(Immediate(isolate()->factory()->undefined_value())); |
624 __ push(Immediate(reinterpret_cast<int>(isolate()))); | 630 __ push(Immediate(reinterpret_cast<int>(isolate()))); |
625 __ push(reg); // holder | 631 __ push(reg); // holder |
626 | 632 __ push(Immediate(Smi::FromInt(0))); // should_throw_on_error -> false |
627 // Save a pointer to where we pushed the arguments. This will be | |
628 // passed as the const PropertyAccessorInfo& to the C++ callback. | |
629 __ push(esp); | |
630 | 633 |
631 __ push(name()); // name | 634 __ push(name()); // name |
632 | |
633 __ push(scratch3()); // Restore return address. | 635 __ push(scratch3()); // Restore return address. |
634 | 636 |
635 // Abi for CallApiGetter | 637 // Abi for CallApiGetter |
636 Register getter_address = ApiGetterDescriptor::function_address(); | 638 Register getter_address = ApiGetterDescriptor::function_address(); |
637 Address function_address = v8::ToCData<Address>(callback->getter()); | 639 Address function_address = v8::ToCData<Address>(callback->getter()); |
638 __ mov(getter_address, Immediate(function_address)); | 640 __ mov(getter_address, Immediate(function_address)); |
639 | 641 |
640 CallApiGetterStub stub(isolate()); | 642 CallApiGetterStub stub(isolate()); |
641 __ TailCallStub(&stub); | 643 __ TailCallStub(&stub); |
642 } | 644 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 __ pop(scratch2()); // save old return address | 726 __ pop(scratch2()); // save old return address |
725 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 727 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
726 holder()); | 728 holder()); |
727 __ push(scratch2()); // restore old return address | 729 __ push(scratch2()); // restore old return address |
728 | 730 |
729 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 731 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
730 } | 732 } |
731 | 733 |
732 | 734 |
733 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 735 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
734 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback) { | 736 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
| 737 LanguageMode language_mode) { |
735 Register holder_reg = Frontend(name); | 738 Register holder_reg = Frontend(name); |
736 | 739 |
737 __ pop(scratch1()); // remove the return address | 740 __ pop(scratch1()); // remove the return address |
738 __ push(receiver()); | 741 __ push(receiver()); |
739 __ push(holder_reg); | 742 __ push(holder_reg); |
740 // If the callback cannot leak, then push the callback directly, | 743 // If the callback cannot leak, then push the callback directly, |
741 // otherwise wrap it in a weak cell. | 744 // otherwise wrap it in a weak cell. |
742 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 745 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
743 __ Push(callback); | 746 __ Push(callback); |
744 } else { | 747 } else { |
745 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 748 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
746 __ Push(cell); | 749 __ Push(cell); |
747 } | 750 } |
748 __ Push(name); | 751 __ Push(name); |
749 __ push(value()); | 752 __ push(value()); |
| 753 __ push(Immediate(Smi::FromInt(language_mode))); |
750 __ push(scratch1()); // restore return address | 754 __ push(scratch1()); // restore return address |
751 | 755 |
752 // Do tail-call to the runtime system. | 756 // Do tail-call to the runtime system. |
753 __ TailCallRuntime(Runtime::kStoreCallbackProperty); | 757 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
754 | 758 |
755 // Return the generated code. | 759 // Return the generated code. |
756 return GetCode(kind(), Code::FAST, name); | 760 return GetCode(kind(), Code::FAST, name); |
757 } | 761 } |
758 | 762 |
759 | 763 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // Return the generated code. | 817 // Return the generated code. |
814 return GetCode(kind(), Code::NORMAL, name); | 818 return GetCode(kind(), Code::NORMAL, name); |
815 } | 819 } |
816 | 820 |
817 | 821 |
818 #undef __ | 822 #undef __ |
819 } // namespace internal | 823 } // namespace internal |
820 } // namespace v8 | 824 } // namespace v8 |
821 | 825 |
822 #endif // V8_TARGET_ARCH_IA32 | 826 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |