Chromium Code Reviews| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 105 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
| 106 __ Push(name); | 106 __ Push(name); |
| 107 __ Push(receiver); | 107 __ Push(receiver); |
| 108 __ Push(holder); | 108 __ Push(holder); |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 static void CompileCallLoadPropertyWithInterceptor( | 112 static void CompileCallLoadPropertyWithInterceptor( |
| 113 MacroAssembler* masm, Register receiver, Register holder, Register name, | 113 MacroAssembler* masm, Register receiver, Register holder, Register name, |
| 114 Handle<JSObject> holder_obj, Runtime::FunctionId id) { | 114 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
| 115 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == | |
|
Igor Sheludko
2015/12/30 14:48:17
Ditto.
| |
| 116 Runtime::FunctionForId(id)->nargs); | |
| 115 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 117 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 116 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); | 118 __ CallRuntime(id); |
| 117 } | 119 } |
| 118 | 120 |
| 119 | 121 |
| 120 // Generate call to api function. | 122 // Generate call to api function. |
| 121 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 123 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
| 122 MacroAssembler* masm, const CallOptimization& optimization, | 124 MacroAssembler* masm, const CallOptimization& optimization, |
| 123 Handle<Map> receiver_map, Register receiver, Register scratch, | 125 Handle<Map> receiver_map, Register receiver, Register scratch, |
| 124 bool is_store, Register store_parameter, Register accessor_holder, | 126 bool is_store, Register store_parameter, Register accessor_holder, |
| 125 int accessor_index) { | 127 int accessor_index) { |
| 126 DCHECK(!accessor_holder.is(scratch)); | 128 DCHECK(!accessor_holder.is(scratch)); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 __ Push(vector); | 321 __ Push(vector); |
| 320 __ PushReturnAddressFrom(r11); | 322 __ PushReturnAddressFrom(r11); |
| 321 } | 323 } |
| 322 | 324 |
| 323 | 325 |
| 324 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 326 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
| 325 // Return address is on the stack. | 327 // Return address is on the stack. |
| 326 StoreIC_PushArgs(masm); | 328 StoreIC_PushArgs(masm); |
| 327 | 329 |
| 328 // Do tail-call to runtime routine. | 330 // Do tail-call to runtime routine. |
| 329 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5); | 331 __ TailCallRuntime(Runtime::kStoreIC_Slow); |
| 330 } | 332 } |
| 331 | 333 |
| 332 | 334 |
| 333 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 335 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
| 334 // Return address is on the stack. | 336 // Return address is on the stack. |
| 335 StoreIC_PushArgs(masm); | 337 StoreIC_PushArgs(masm); |
| 336 | 338 |
| 337 // Do tail-call to runtime routine. | 339 // Do tail-call to runtime routine. |
| 338 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5); | 340 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow); |
| 339 } | 341 } |
| 340 | 342 |
| 341 | 343 |
| 342 #undef __ | 344 #undef __ |
| 343 #define __ ACCESS_MASM((masm())) | 345 #define __ ACCESS_MASM((masm())) |
| 344 | 346 |
| 345 | 347 |
| 346 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 348 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
| 347 Handle<Name> name) { | 349 Handle<Name> name) { |
| 348 if (!label->is_unused()) { | 350 if (!label->is_unused()) { |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 | 710 |
| 709 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 711 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
| 710 // Call the runtime system to load the interceptor. | 712 // Call the runtime system to load the interceptor. |
| 711 DCHECK(holder()->HasNamedInterceptor()); | 713 DCHECK(holder()->HasNamedInterceptor()); |
| 712 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 714 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
| 713 __ PopReturnAddressTo(scratch2()); | 715 __ PopReturnAddressTo(scratch2()); |
| 714 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 716 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
| 715 holder()); | 717 holder()); |
| 716 __ PushReturnAddressFrom(scratch2()); | 718 __ PushReturnAddressFrom(scratch2()); |
| 717 | 719 |
| 718 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, | 720 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
| 719 NamedLoadHandlerCompiler::kInterceptorArgsLength); | |
| 720 } | 721 } |
| 721 | 722 |
| 722 | 723 |
| 723 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 724 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
| 724 Handle<JSObject> object, Handle<Name> name, | 725 Handle<JSObject> object, Handle<Name> name, |
| 725 Handle<ExecutableAccessorInfo> callback) { | 726 Handle<ExecutableAccessorInfo> callback) { |
| 726 Register holder_reg = Frontend(name); | 727 Register holder_reg = Frontend(name); |
| 727 | 728 |
| 728 __ PopReturnAddressTo(scratch1()); | 729 __ PopReturnAddressTo(scratch1()); |
| 729 __ Push(receiver()); | 730 __ Push(receiver()); |
| 730 __ Push(holder_reg); | 731 __ Push(holder_reg); |
| 731 // If the callback cannot leak, then push the callback directly, | 732 // If the callback cannot leak, then push the callback directly, |
| 732 // otherwise wrap it in a weak cell. | 733 // otherwise wrap it in a weak cell. |
| 733 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 734 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
| 734 __ Push(callback); | 735 __ Push(callback); |
| 735 } else { | 736 } else { |
| 736 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 737 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
| 737 __ Push(cell); | 738 __ Push(cell); |
| 738 } | 739 } |
| 739 __ Push(name); | 740 __ Push(name); |
| 740 __ Push(value()); | 741 __ Push(value()); |
| 741 __ PushReturnAddressFrom(scratch1()); | 742 __ PushReturnAddressFrom(scratch1()); |
| 742 | 743 |
| 743 // Do tail-call to the runtime system. | 744 // Do tail-call to the runtime system. |
| 744 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5); | 745 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
| 745 | 746 |
| 746 // Return the generated code. | 747 // Return the generated code. |
| 747 return GetCode(kind(), Code::FAST, name); | 748 return GetCode(kind(), Code::FAST, name); |
| 748 } | 749 } |
| 749 | 750 |
| 750 | 751 |
| 751 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 752 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
| 752 Handle<Name> name) { | 753 Handle<Name> name) { |
| 753 __ PopReturnAddressTo(scratch1()); | 754 __ PopReturnAddressTo(scratch1()); |
| 754 __ Push(receiver()); | 755 __ Push(receiver()); |
| 755 __ Push(this->name()); | 756 __ Push(this->name()); |
| 756 __ Push(value()); | 757 __ Push(value()); |
| 757 __ PushReturnAddressFrom(scratch1()); | 758 __ PushReturnAddressFrom(scratch1()); |
| 758 | 759 |
| 759 // Do tail-call to the runtime system. | 760 // Do tail-call to the runtime system. |
| 760 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3); | 761 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor); |
| 761 | 762 |
| 762 // Return the generated code. | 763 // Return the generated code. |
| 763 return GetCode(kind(), Code::FAST, name); | 764 return GetCode(kind(), Code::FAST, name); |
| 764 } | 765 } |
| 765 | 766 |
| 766 | 767 |
| 767 Register NamedStoreHandlerCompiler::value() { | 768 Register NamedStoreHandlerCompiler::value() { |
| 768 return StoreDescriptor::ValueRegister(); | 769 return StoreDescriptor::ValueRegister(); |
| 769 } | 770 } |
| 770 | 771 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 804 // Return the generated code. | 805 // Return the generated code. |
| 805 return GetCode(kind(), Code::NORMAL, name); | 806 return GetCode(kind(), Code::NORMAL, name); |
| 806 } | 807 } |
| 807 | 808 |
| 808 | 809 |
| 809 #undef __ | 810 #undef __ |
| 810 } // namespace internal | 811 } // namespace internal |
| 811 } // namespace v8 | 812 } // namespace v8 |
| 812 | 813 |
| 813 #endif // V8_TARGET_ARCH_X64 | 814 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |