Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 12494012: new style of property/function callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: make arm look like other architectures Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/builtins.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 845 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
846 masm->isolate()); 846 masm->isolate());
847 __ mov(r0, Operand(6)); 847 __ mov(r0, Operand(6));
848 __ mov(r1, Operand(ref)); 848 __ mov(r1, Operand(ref));
849 849
850 CEntryStub stub(1); 850 CEntryStub stub(1);
851 __ CallStub(&stub); 851 __ CallStub(&stub);
852 } 852 }
853 853
854 854
855 static const int kFastApiCallArguments = 4; 855 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
856 856
857 // Reserves space for the extra arguments to API function in the 857 // Reserves space for the extra arguments to API function in the
858 // caller's frame. 858 // caller's frame.
859 // 859 //
860 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall. 860 // These arguments are set by CheckPrototypes and GenerateFastApiDirectCall.
861 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, 861 static void ReserveSpaceForFastApiCall(MacroAssembler* masm,
862 Register scratch) { 862 Register scratch) {
863 __ mov(scratch, Operand(Smi::FromInt(0))); 863 __ mov(scratch, Operand(Smi::FromInt(0)));
864 for (int i = 0; i < kFastApiCallArguments; i++) { 864 for (int i = 0; i < kFastApiCallArguments; i++) {
865 __ push(scratch); 865 __ push(scratch);
866 } 866 }
867 } 867 }
868 868
869 869
870 // Undoes the effects of ReserveSpaceForFastApiCall. 870 // Undoes the effects of ReserveSpaceForFastApiCall.
871 static void FreeSpaceForFastApiCall(MacroAssembler* masm) { 871 static void FreeSpaceForFastApiCall(MacroAssembler* masm) {
872 __ Drop(kFastApiCallArguments); 872 __ Drop(kFastApiCallArguments);
873 } 873 }
874 874
875 875
876 static void GenerateFastApiDirectCall(MacroAssembler* masm, 876 static void GenerateFastApiDirectCall(MacroAssembler* masm,
877 const CallOptimization& optimization, 877 const CallOptimization& optimization,
878 int argc) { 878 int argc) {
879 // ----------- S t a t e ------------- 879 // ----------- S t a t e -------------
880 // -- sp[0] : holder (set by CheckPrototypes) 880 // -- sp[0] : holder (set by CheckPrototypes)
881 // -- sp[4] : callee JS function 881 // -- sp[4] : callee JS function
882 // -- sp[8] : call data 882 // -- sp[8] : call data
883 // -- sp[12] : isolate 883 // -- sp[12] : isolate
884 // -- sp[16] : last JS argument 884 // -- sp[16] : ReturnValue
885 // -- sp[20] : last JS argument
885 // -- ... 886 // -- ...
886 // -- sp[(argc + 3) * 4] : first JS argument 887 // -- sp[(argc + 4) * 4] : first JS argument
887 // -- sp[(argc + 4) * 4] : receiver 888 // -- sp[(argc + 5) * 4] : receiver
888 // ----------------------------------- 889 // -----------------------------------
889 // Get the function and setup the context. 890 // Get the function and setup the context.
890 Handle<JSFunction> function = optimization.constant_function(); 891 Handle<JSFunction> function = optimization.constant_function();
891 __ LoadHeapObject(r5, function); 892 __ LoadHeapObject(r5, function);
892 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); 893 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
893 894
894 // Pass the additional arguments. 895 // Pass the additional arguments.
895 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 896 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
896 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 897 Handle<Object> call_data(api_call_info->data(), masm->isolate());
897 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 898 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
898 __ Move(r0, api_call_info); 899 __ Move(r0, api_call_info);
899 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); 900 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
900 } else { 901 } else {
901 __ Move(r6, call_data); 902 __ Move(r6, call_data);
902 } 903 }
903 __ mov(r7, Operand(ExternalReference::isolate_address(masm->isolate()))); 904 __ mov(r7, Operand(ExternalReference::isolate_address(masm->isolate())));
904 // Store JS function, call data and isolate. 905 // Store JS function, call data, isolate and ReturnValue.
905 __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit()); 906 __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit());
907 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
908 __ str(r5, MemOperand(sp, 4 * kPointerSize));
906 909
907 // Prepare arguments. 910 // Prepare arguments.
908 __ add(r2, sp, Operand(3 * kPointerSize)); 911 __ add(r2, sp, Operand(4 * kPointerSize));
909 912
910 // Allocate the v8::Arguments structure in the arguments' space since 913 // Allocate the v8::Arguments structure in the arguments' space since
911 // it's not controlled by GC. 914 // it's not controlled by GC.
912 const int kApiStackSpace = 4; 915 const int kApiStackSpace = 4;
913 916
914 FrameScope frame_scope(masm, StackFrame::MANUAL); 917 FrameScope frame_scope(masm, StackFrame::MANUAL);
915 __ EnterExitFrame(false, kApiStackSpace); 918 __ EnterExitFrame(false, kApiStackSpace);
916 919
917 // r0 = v8::Arguments& 920 // r0 = v8::Arguments&
918 // Arguments is after the return address. 921 // Arguments is after the return address.
919 __ add(r0, sp, Operand(1 * kPointerSize)); 922 __ add(r0, sp, Operand(1 * kPointerSize));
920 // v8::Arguments::implicit_args_ 923 // v8::Arguments::implicit_args_
921 __ str(r2, MemOperand(r0, 0 * kPointerSize)); 924 __ str(r2, MemOperand(r0, 0 * kPointerSize));
922 // v8::Arguments::values_ 925 // v8::Arguments::values_
923 __ add(ip, r2, Operand(argc * kPointerSize)); 926 __ add(ip, r2, Operand(argc * kPointerSize));
924 __ str(ip, MemOperand(r0, 1 * kPointerSize)); 927 __ str(ip, MemOperand(r0, 1 * kPointerSize));
925 // v8::Arguments::length_ = argc 928 // v8::Arguments::length_ = argc
926 __ mov(ip, Operand(argc)); 929 __ mov(ip, Operand(argc));
927 __ str(ip, MemOperand(r0, 2 * kPointerSize)); 930 __ str(ip, MemOperand(r0, 2 * kPointerSize));
928 // v8::Arguments::is_construct_call = 0 931 // v8::Arguments::is_construct_call = 0
929 __ mov(ip, Operand::Zero()); 932 __ mov(ip, Operand::Zero());
930 __ str(ip, MemOperand(r0, 3 * kPointerSize)); 933 __ str(ip, MemOperand(r0, 3 * kPointerSize));
931 934
932 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 935 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
933 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 936 Address function_address = v8::ToCData<Address>(api_call_info->callback());
937 bool returns_handle =
938 !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
934 ApiFunction fun(function_address); 939 ApiFunction fun(function_address);
935 ExternalReference ref = ExternalReference(&fun, 940 ExternalReference ref = ExternalReference(&fun,
936 ExternalReference::DIRECT_API_CALL, 941 ExternalReference::DIRECT_API_CALL,
937 masm->isolate()); 942 masm->isolate());
938 AllowExternalCallThatCantCauseGC scope(masm); 943 AllowExternalCallThatCantCauseGC scope(masm);
939 944 __ CallApiFunctionAndReturn(ref,
940 __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); 945 kStackUnwindSpace,
946 returns_handle,
947 kFastApiCallArguments + 1);
941 } 948 }
942 949
943 950
944 class CallInterceptorCompiler BASE_EMBEDDED { 951 class CallInterceptorCompiler BASE_EMBEDDED {
945 public: 952 public:
946 CallInterceptorCompiler(StubCompiler* stub_compiler, 953 CallInterceptorCompiler(StubCompiler* stub_compiler,
947 const ParameterCount& arguments, 954 const ParameterCount& arguments,
948 Register name, 955 Register name,
949 Code::ExtraICState extra_ic_state) 956 Code::ExtraICState extra_ic_state)
950 : stub_compiler_(stub_compiler), 957 : stub_compiler_(stub_compiler),
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 if (heap()->InNewSpace(callback->data())) { 1413 if (heap()->InNewSpace(callback->data())) {
1407 __ Move(scratch3(), callback); 1414 __ Move(scratch3(), callback);
1408 __ ldr(scratch3(), FieldMemOperand(scratch3(), 1415 __ ldr(scratch3(), FieldMemOperand(scratch3(),
1409 ExecutableAccessorInfo::kDataOffset)); 1416 ExecutableAccessorInfo::kDataOffset));
1410 } else { 1417 } else {
1411 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); 1418 __ Move(scratch3(), Handle<Object>(callback->data(), isolate()));
1412 } 1419 }
1413 __ Push(reg, scratch3()); 1420 __ Push(reg, scratch3());
1414 __ mov(scratch3(), 1421 __ mov(scratch3(),
1415 Operand(ExternalReference::isolate_address(isolate()))); 1422 Operand(ExternalReference::isolate_address(isolate())));
1416 __ Push(scratch3(), name()); 1423 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex);
1424 __ Push(scratch3(), scratch4(), name());
1417 __ mov(r0, sp); // r0 = Handle<Name> 1425 __ mov(r0, sp); // r0 = Handle<Name>
1418 1426
1419 const int kApiStackSpace = 1; 1427 const int kApiStackSpace = 1;
1420 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1428 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1421 __ EnterExitFrame(false, kApiStackSpace); 1429 __ EnterExitFrame(false, kApiStackSpace);
1422 1430
1423 // Create AccessorInfo instance on the stack above the exit frame with 1431 // Create AccessorInfo instance on the stack above the exit frame with
1424 // scratch2 (internal::Object** args_) as the data. 1432 // scratch2 (internal::Object** args_) as the data.
1425 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); 1433 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize));
1426 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 1434 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
1427 1435
1428 const int kStackUnwindSpace = 5; 1436 const int kStackUnwindSpace = kFastApiCallArguments + 1;
1429 Address getter_address = v8::ToCData<Address>(callback->getter()); 1437 Address getter_address = v8::ToCData<Address>(callback->getter());
1438 bool returns_handle =
1439 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1430 ApiFunction fun(getter_address); 1440 ApiFunction fun(getter_address);
1431 ExternalReference ref = ExternalReference( 1441 ExternalReference ref = ExternalReference(
1432 &fun, ExternalReference::DIRECT_GETTER_CALL, isolate()); 1442 &fun, ExternalReference::DIRECT_GETTER_CALL, isolate());
1433 __ CallApiFunctionAndReturn(ref, kStackUnwindSpace); 1443 __ CallApiFunctionAndReturn(ref,
1444 kStackUnwindSpace,
1445 returns_handle,
1446 3);
1434 } 1447 }
1435 1448
1436 1449
1437 void BaseLoadStubCompiler::GenerateLoadInterceptor( 1450 void BaseLoadStubCompiler::GenerateLoadInterceptor(
1438 Register holder_reg, 1451 Register holder_reg,
1439 Handle<JSObject> object, 1452 Handle<JSObject> object,
1440 Handle<JSObject> interceptor_holder, 1453 Handle<JSObject> interceptor_holder,
1441 LookupResult* lookup, 1454 LookupResult* lookup,
1442 Handle<Name> name) { 1455 Handle<Name> name) {
1443 ASSERT(interceptor_holder->HasNamedInterceptor()); 1456 ASSERT(interceptor_holder->HasNamedInterceptor());
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after
3777 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3790 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3778 } 3791 }
3779 } 3792 }
3780 3793
3781 3794
3782 #undef __ 3795 #undef __
3783 3796
3784 } } // namespace v8::internal 3797 } } // namespace v8::internal
3785 3798
3786 #endif // V8_TARGET_ARCH_ARM 3799 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698