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

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

Issue 23549019: store ics for js api accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: no snprintf Created 7 years, 3 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 | « no previous file | src/ia32/stub-cache-ia32.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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 AllowExternalCallThatCantCauseGC scope(masm); 917 AllowExternalCallThatCantCauseGC scope(masm);
918 __ CallApiFunctionAndReturn(ref, 918 __ CallApiFunctionAndReturn(ref,
919 function_address, 919 function_address,
920 thunk_ref, 920 thunk_ref,
921 r1, 921 r1,
922 kStackUnwindSpace, 922 kStackUnwindSpace,
923 kFastApiCallArguments + 1); 923 kFastApiCallArguments + 1);
924 } 924 }
925 925
926 926
927 // Generate call to api function.
928 static void GenerateFastApiCall(MacroAssembler* masm,
929 const CallOptimization& optimization,
930 Register receiver,
931 Register scratch,
932 int argc,
933 Register* values) {
934 ASSERT(optimization.is_simple_api_call());
935 ASSERT(!receiver.is(scratch));
936
937 const int stack_space = kFastApiCallArguments + argc + 1;
938 // Assign stack space for the call arguments.
939 __ sub(sp, sp, Operand(stack_space * kPointerSize));
940 // Write holder to stack frame.
941 __ str(receiver, MemOperand(sp, 0));
942 // Write receiver to stack frame.
943 int index = stack_space - 1;
944 __ str(receiver, MemOperand(sp, index * kPointerSize));
945 // Write the arguments to stack frame.
946 for (int i = 0; i < argc; i++) {
947 ASSERT(!receiver.is(values[i]));
948 ASSERT(!scratch.is(values[i]));
949 __ str(receiver, MemOperand(sp, index-- * kPointerSize));
950 }
951
952 GenerateFastApiDirectCall(masm, optimization, argc);
953 }
954
955
927 class CallInterceptorCompiler BASE_EMBEDDED { 956 class CallInterceptorCompiler BASE_EMBEDDED {
928 public: 957 public:
929 CallInterceptorCompiler(StubCompiler* stub_compiler, 958 CallInterceptorCompiler(StubCompiler* stub_compiler,
930 const ParameterCount& arguments, 959 const ParameterCount& arguments,
931 Register name, 960 Register name,
932 Code::ExtraICState extra_ic_state) 961 Code::ExtraICState extra_ic_state)
933 : stub_compiler_(stub_compiler), 962 : stub_compiler_(stub_compiler),
934 arguments_(arguments), 963 arguments_(arguments),
935 name_(name), 964 name_(name),
936 extra_ic_state_(extra_ic_state) {} 965 extra_ic_state_(extra_ic_state) {}
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 1403
1375 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1404 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1376 // Return the constant value. 1405 // Return the constant value.
1377 __ LoadObject(r0, value); 1406 __ LoadObject(r0, value);
1378 __ Ret(); 1407 __ Ret();
1379 } 1408 }
1380 1409
1381 1410
1382 void BaseLoadStubCompiler::GenerateLoadCallback( 1411 void BaseLoadStubCompiler::GenerateLoadCallback(
1383 const CallOptimization& call_optimization) { 1412 const CallOptimization& call_optimization) {
1384 ASSERT(call_optimization.is_simple_api_call()); 1413 GenerateFastApiCall(
1385 1414 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1386 // Assign stack space for the call arguments.
1387 __ sub(sp, sp, Operand((kFastApiCallArguments + 1) * kPointerSize));
1388
1389 int argc = 0;
1390 int api_call_argc = argc + kFastApiCallArguments;
1391 // Write holder to stack frame.
1392 __ str(receiver(), MemOperand(sp, 0));
1393 // Write receiver to stack frame.
1394 __ str(receiver(), MemOperand(sp, api_call_argc * kPointerSize));
1395
1396 GenerateFastApiDirectCall(masm(), call_optimization, argc);
1397 } 1415 }
1398 1416
1399 1417
1400 void BaseLoadStubCompiler::GenerateLoadCallback( 1418 void BaseLoadStubCompiler::GenerateLoadCallback(
1401 Register reg, 1419 Register reg,
1402 Handle<ExecutableAccessorInfo> callback) { 1420 Handle<ExecutableAccessorInfo> callback) {
1403 // Build AccessorInfo::args_ list on the stack and push property name below 1421 // Build AccessorInfo::args_ list on the stack and push property name below
1404 // the exit frame to make GC aware of them and store pointers to them. 1422 // the exit frame to make GC aware of them and store pointers to them.
1405 __ push(receiver()); 1423 __ push(receiver());
1406 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ 1424 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 // Do tail-call to the runtime system. 2804 // Do tail-call to the runtime system.
2787 ExternalReference store_callback_property = 2805 ExternalReference store_callback_property =
2788 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate()); 2806 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
2789 __ TailCallExternalReference(store_callback_property, 4, 1); 2807 __ TailCallExternalReference(store_callback_property, 4, 1);
2790 2808
2791 // Return the generated code. 2809 // Return the generated code.
2792 return GetCode(kind(), Code::CALLBACKS, name); 2810 return GetCode(kind(), Code::CALLBACKS, name);
2793 } 2811 }
2794 2812
2795 2813
2814 Handle<Code> StoreStubCompiler::CompileStoreCallback(
2815 Handle<JSObject> object,
2816 Handle<JSObject> holder,
2817 Handle<Name> name,
2818 const CallOptimization& call_optimization) {
2819 Label success;
2820 HandlerFrontend(object, receiver(), holder, name, &success);
2821 __ bind(&success);
2822
2823 Register values[] = { value() };
2824 GenerateFastApiCall(
2825 masm(), call_optimization, receiver(), scratch3(), 1, values);
2826
2827 // Return the generated code.
2828 return GetCode(kind(), Code::CALLBACKS, name);
2829 }
2830
2831
2796 #undef __ 2832 #undef __
2797 #define __ ACCESS_MASM(masm) 2833 #define __ ACCESS_MASM(masm)
2798 2834
2799 2835
2800 void StoreStubCompiler::GenerateStoreViaSetter( 2836 void StoreStubCompiler::GenerateStoreViaSetter(
2801 MacroAssembler* masm, 2837 MacroAssembler* masm,
2802 Handle<JSFunction> setter) { 2838 Handle<JSFunction> setter) {
2803 // ----------- S t a t e ------------- 2839 // ----------- S t a t e -------------
2804 // -- r0 : value 2840 // -- r0 : value
2805 // -- r1 : receiver 2841 // -- r1 : receiver
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
3170 // ----------------------------------- 3206 // -----------------------------------
3171 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3207 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3172 } 3208 }
3173 3209
3174 3210
3175 #undef __ 3211 #undef __
3176 3212
3177 } } // namespace v8::internal 3213 } } // namespace v8::internal
3178 3214
3179 #endif // V8_TARGET_ARCH_ARM 3215 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698