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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 290 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
291 __ push(name); | 291 __ push(name); |
292 __ push(receiver); | 292 __ push(receiver); |
293 __ push(holder); | 293 __ push(holder); |
294 } | 294 } |
295 | 295 |
296 | 296 |
297 static void CompileCallLoadPropertyWithInterceptor( | 297 static void CompileCallLoadPropertyWithInterceptor( |
298 MacroAssembler* masm, Register receiver, Register holder, Register name, | 298 MacroAssembler* masm, Register receiver, Register holder, Register name, |
299 Handle<JSObject> holder_obj, Runtime::FunctionId id) { | 299 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
300 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == | |
Igor Sheludko
2015/12/30 14:48:17
Ditto.
| |
301 Runtime::FunctionForId(id)->nargs); | |
300 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 302 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
301 __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength); | 303 __ CallRuntime(id); |
302 } | 304 } |
303 | 305 |
304 | 306 |
305 static void StoreIC_PushArgs(MacroAssembler* masm) { | 307 static void StoreIC_PushArgs(MacroAssembler* masm) { |
306 Register receiver = StoreDescriptor::ReceiverRegister(); | 308 Register receiver = StoreDescriptor::ReceiverRegister(); |
307 Register name = StoreDescriptor::NameRegister(); | 309 Register name = StoreDescriptor::NameRegister(); |
308 Register value = StoreDescriptor::ValueRegister(); | 310 Register value = StoreDescriptor::ValueRegister(); |
309 Register slot = VectorStoreICDescriptor::SlotRegister(); | 311 Register slot = VectorStoreICDescriptor::SlotRegister(); |
310 Register vector = VectorStoreICDescriptor::VectorRegister(); | 312 Register vector = VectorStoreICDescriptor::VectorRegister(); |
311 | 313 |
312 __ xchg(receiver, Operand(esp, 0)); | 314 __ xchg(receiver, Operand(esp, 0)); |
313 __ push(name); | 315 __ push(name); |
314 __ push(value); | 316 __ push(value); |
315 __ push(slot); | 317 __ push(slot); |
316 __ push(vector); | 318 __ push(vector); |
317 __ push(receiver); // which contains the return address. | 319 __ push(receiver); // which contains the return address. |
318 } | 320 } |
319 | 321 |
320 | 322 |
321 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { | 323 void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { |
322 // Return address is on the stack. | 324 // Return address is on the stack. |
323 StoreIC_PushArgs(masm); | 325 StoreIC_PushArgs(masm); |
324 | 326 |
325 // Do tail-call to runtime routine. | 327 // Do tail-call to runtime routine. |
326 __ TailCallRuntime(Runtime::kStoreIC_Slow, 5); | 328 __ TailCallRuntime(Runtime::kStoreIC_Slow); |
327 } | 329 } |
328 | 330 |
329 | 331 |
330 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { | 332 void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { |
331 // Return address is on the stack. | 333 // Return address is on the stack. |
332 StoreIC_PushArgs(masm); | 334 StoreIC_PushArgs(masm); |
333 | 335 |
334 // Do tail-call to runtime routine. | 336 // Do tail-call to runtime routine. |
335 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 5); | 337 __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow); |
336 } | 338 } |
337 | 339 |
338 | 340 |
339 #undef __ | 341 #undef __ |
340 #define __ ACCESS_MASM(masm()) | 342 #define __ ACCESS_MASM(masm()) |
341 | 343 |
342 | 344 |
343 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 345 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
344 Handle<Name> name) { | 346 Handle<Name> name) { |
345 if (!label->is_unused()) { | 347 if (!label->is_unused()) { |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
717 | 719 |
718 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 720 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
719 DCHECK(holder()->HasNamedInterceptor()); | 721 DCHECK(holder()->HasNamedInterceptor()); |
720 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); | 722 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); |
721 // Call the runtime system to load the interceptor. | 723 // Call the runtime system to load the interceptor. |
722 __ pop(scratch2()); // save old return address | 724 __ pop(scratch2()); // save old return address |
723 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 725 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), |
724 holder()); | 726 holder()); |
725 __ push(scratch2()); // restore old return address | 727 __ push(scratch2()); // restore old return address |
726 | 728 |
727 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor, | 729 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
728 NamedLoadHandlerCompiler::kInterceptorArgsLength); | |
729 } | 730 } |
730 | 731 |
731 | 732 |
732 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 733 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
733 Handle<JSObject> object, Handle<Name> name, | 734 Handle<JSObject> object, Handle<Name> name, |
734 Handle<ExecutableAccessorInfo> callback) { | 735 Handle<ExecutableAccessorInfo> callback) { |
735 Register holder_reg = Frontend(name); | 736 Register holder_reg = Frontend(name); |
736 | 737 |
737 __ pop(scratch1()); // remove the return address | 738 __ pop(scratch1()); // remove the return address |
738 __ push(receiver()); | 739 __ push(receiver()); |
739 __ push(holder_reg); | 740 __ push(holder_reg); |
740 // If the callback cannot leak, then push the callback directly, | 741 // If the callback cannot leak, then push the callback directly, |
741 // otherwise wrap it in a weak cell. | 742 // otherwise wrap it in a weak cell. |
742 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { | 743 if (callback->data()->IsUndefined() || callback->data()->IsSmi()) { |
743 __ Push(callback); | 744 __ Push(callback); |
744 } else { | 745 } else { |
745 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); | 746 Handle<WeakCell> cell = isolate()->factory()->NewWeakCell(callback); |
746 __ Push(cell); | 747 __ Push(cell); |
747 } | 748 } |
748 __ Push(name); | 749 __ Push(name); |
749 __ push(value()); | 750 __ push(value()); |
750 __ push(scratch1()); // restore return address | 751 __ push(scratch1()); // restore return address |
751 | 752 |
752 // Do tail-call to the runtime system. | 753 // Do tail-call to the runtime system. |
753 __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5); | 754 __ TailCallRuntime(Runtime::kStoreCallbackProperty); |
754 | 755 |
755 // Return the generated code. | 756 // Return the generated code. |
756 return GetCode(kind(), Code::FAST, name); | 757 return GetCode(kind(), Code::FAST, name); |
757 } | 758 } |
758 | 759 |
759 | 760 |
760 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( | 761 Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor( |
761 Handle<Name> name) { | 762 Handle<Name> name) { |
762 __ pop(scratch1()); // remove the return address | 763 __ pop(scratch1()); // remove the return address |
763 __ push(receiver()); | 764 __ push(receiver()); |
764 __ push(this->name()); | 765 __ push(this->name()); |
765 __ push(value()); | 766 __ push(value()); |
766 __ push(scratch1()); // restore return address | 767 __ push(scratch1()); // restore return address |
767 | 768 |
768 // Do tail-call to the runtime system. | 769 // Do tail-call to the runtime system. |
769 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3); | 770 __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor); |
770 | 771 |
771 // Return the generated code. | 772 // Return the generated code. |
772 return GetCode(kind(), Code::FAST, name); | 773 return GetCode(kind(), Code::FAST, name); |
773 } | 774 } |
774 | 775 |
775 | 776 |
776 Register NamedStoreHandlerCompiler::value() { | 777 Register NamedStoreHandlerCompiler::value() { |
777 return StoreDescriptor::ValueRegister(); | 778 return StoreDescriptor::ValueRegister(); |
778 } | 779 } |
779 | 780 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 // Return the generated code. | 814 // Return the generated code. |
814 return GetCode(kind(), Code::NORMAL, name); | 815 return GetCode(kind(), Code::NORMAL, name); |
815 } | 816 } |
816 | 817 |
817 | 818 |
818 #undef __ | 819 #undef __ |
819 } // namespace internal | 820 } // namespace internal |
820 } // namespace v8 | 821 } // namespace v8 |
821 | 822 |
822 #endif // V8_TARGET_ARCH_IA32 | 823 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |