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

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

Issue 16858013: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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/mips/simulator-mips.cc ('k') | src/sampler.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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 933 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a
934 // struct from the function (which is currently the case). This means we pass 934 // struct from the function (which is currently the case). This means we pass
935 // the first argument in a1 instead of a0, if returns_handle is true. 935 // the first argument in a1 instead of a0, if returns_handle is true.
936 // CallApiFunctionAndReturn will set up a0. 936 // CallApiFunctionAndReturn will set up a0.
937 937
938 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 938 Address function_address = v8::ToCData<Address>(api_call_info->callback());
939 bool returns_handle = 939 bool returns_handle =
940 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); 940 !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
941 941
942 Register first_arg = returns_handle ? a1 : a0; 942 Register first_arg = returns_handle ? a1 : a0;
943 Register second_arg = returns_handle ? a2 : a1;
943 944
944 // first_arg = v8::Arguments& 945 // first_arg = v8::Arguments&
945 // Arguments is built at sp + 1 (sp is a reserved spot for ra). 946 // Arguments is built at sp + 1 (sp is a reserved spot for ra).
946 __ Addu(first_arg, sp, kPointerSize); 947 __ Addu(first_arg, sp, kPointerSize);
947 948
948 // v8::Arguments::implicit_args_ 949 // v8::Arguments::implicit_args_
949 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize)); 950 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize));
950 // v8::Arguments::values_ 951 // v8::Arguments::values_
951 __ Addu(t0, a2, Operand(argc * kPointerSize)); 952 __ Addu(t0, a2, Operand(argc * kPointerSize));
952 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize)); 953 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize));
953 // v8::Arguments::length_ = argc 954 // v8::Arguments::length_ = argc
954 __ li(t0, Operand(argc)); 955 __ li(t0, Operand(argc));
955 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize)); 956 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize));
956 // v8::Arguments::is_construct_call = 0 957 // v8::Arguments::is_construct_call = 0
957 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize)); 958 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize));
958 959
959 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 960 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
960 ApiFunction fun(function_address); 961 ApiFunction fun(function_address);
961 ExternalReference::Type type = 962 ExternalReference::Type type =
962 returns_handle ? 963 returns_handle ?
963 ExternalReference::DIRECT_API_CALL : 964 ExternalReference::DIRECT_API_CALL :
964 ExternalReference::DIRECT_API_CALL_NEW; 965 ExternalReference::DIRECT_API_CALL_NEW;
965 ExternalReference ref = 966 ExternalReference ref =
966 ExternalReference(&fun, 967 ExternalReference(&fun,
967 type, 968 type,
968 masm->isolate()); 969 masm->isolate());
970
971 Address thunk_address = returns_handle
972 ? FUNCTION_ADDR(&InvokeInvocationCallback)
973 : FUNCTION_ADDR(&InvokeFunctionCallback);
974 ExternalReference::Type thunk_type =
975 returns_handle ?
976 ExternalReference::PROFILING_API_CALL :
977 ExternalReference::PROFILING_API_CALL_NEW;
978 ApiFunction thunk_fun(thunk_address);
979 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
980 masm->isolate());
981
969 AllowExternalCallThatCantCauseGC scope(masm); 982 AllowExternalCallThatCantCauseGC scope(masm);
970 __ CallApiFunctionAndReturn(ref, 983 __ CallApiFunctionAndReturn(ref,
984 function_address,
985 thunk_ref,
986 second_arg,
971 kStackUnwindSpace, 987 kStackUnwindSpace,
972 returns_handle, 988 returns_handle,
973 kFastApiCallArguments + 1); 989 kFastApiCallArguments + 1);
974 } 990 }
975 991
976 class CallInterceptorCompiler BASE_EMBEDDED { 992 class CallInterceptorCompiler BASE_EMBEDDED {
977 public: 993 public:
978 CallInterceptorCompiler(StubCompiler* stub_compiler, 994 CallInterceptorCompiler(StubCompiler* stub_compiler,
979 const ParameterCount& arguments, 995 const ParameterCount& arguments,
980 Register name, 996 Register name,
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 Operand(ExternalReference::isolate_address(isolate()))); 1469 Operand(ExternalReference::isolate_address(isolate())));
1454 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); 1470 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize));
1455 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); 1471 __ sw(name(), MemOperand(sp, 0 * kPointerSize));
1456 1472
1457 Address getter_address = v8::ToCData<Address>(callback->getter()); 1473 Address getter_address = v8::ToCData<Address>(callback->getter());
1458 bool returns_handle = 1474 bool returns_handle =
1459 !CallbackTable::ReturnsVoid(isolate(), getter_address); 1475 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1460 1476
1461 Register first_arg = returns_handle ? a1 : a0; 1477 Register first_arg = returns_handle ? a1 : a0;
1462 Register second_arg = returns_handle ? a2 : a1; 1478 Register second_arg = returns_handle ? a2 : a1;
1479 Register third_arg = returns_handle ? a3 : a2;
1463 1480
1464 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. 1481 __ mov(a2, scratch2()); // Saved in case scratch2 == a1.
1465 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name> 1482 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name>
1466 1483
1467 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 1484 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a
1468 // struct from the function (which is currently the case). This means we pass 1485 // struct from the function (which is currently the case). This means we pass
1469 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true. 1486 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true.
1470 // CallApiFunctionAndReturn will set up a0. 1487 // CallApiFunctionAndReturn will set up a0.
1471 1488
1472 const int kApiStackSpace = 1; 1489 const int kApiStackSpace = 1;
1473 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1490 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1474 __ EnterExitFrame(false, kApiStackSpace); 1491 __ EnterExitFrame(false, kApiStackSpace);
1475 1492
1476 // Create AccessorInfo instance on the stack above the exit frame with 1493 // Create AccessorInfo instance on the stack above the exit frame with
1477 // scratch2 (internal::Object** args_) as the data. 1494 // scratch2 (internal::Object** args_) as the data.
1478 __ sw(a2, MemOperand(sp, kPointerSize)); 1495 __ sw(a2, MemOperand(sp, kPointerSize));
1479 // (second argument - see note above) = AccessorInfo& 1496 // (second argument - see note above) = AccessorInfo&
1480 __ Addu(second_arg, sp, kPointerSize); 1497 __ Addu(second_arg, sp, kPointerSize);
1481 1498
1482 const int kStackUnwindSpace = kFastApiCallArguments + 1; 1499 const int kStackUnwindSpace = kFastApiCallArguments + 1;
1500
1483 ApiFunction fun(getter_address); 1501 ApiFunction fun(getter_address);
1484 ExternalReference::Type type = 1502 ExternalReference::Type type =
1485 returns_handle ? 1503 returns_handle ?
1486 ExternalReference::DIRECT_GETTER_CALL : 1504 ExternalReference::DIRECT_GETTER_CALL :
1487 ExternalReference::DIRECT_GETTER_CALL_NEW; 1505 ExternalReference::DIRECT_GETTER_CALL_NEW;
1506 ExternalReference ref = ExternalReference(&fun, type, isolate());
1488 1507
1489 ExternalReference ref = ExternalReference(&fun, type, isolate()); 1508 Address thunk_address = returns_handle
1509 ? FUNCTION_ADDR(&InvokeAccessorGetter)
1510 : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1511 ExternalReference::Type thunk_type =
1512 returns_handle ?
1513 ExternalReference::PROFILING_GETTER_CALL :
1514 ExternalReference::PROFILING_GETTER_CALL_NEW;
1515 ApiFunction thunk_fun(thunk_address);
1516 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
1517 isolate());
1490 __ CallApiFunctionAndReturn(ref, 1518 __ CallApiFunctionAndReturn(ref,
1519 getter_address,
1520 thunk_ref,
1521 third_arg,
1491 kStackUnwindSpace, 1522 kStackUnwindSpace,
1492 returns_handle, 1523 returns_handle,
1493 5); 1524 5);
1494 } 1525 }
1495 1526
1496 1527
1497 void BaseLoadStubCompiler::GenerateLoadInterceptor( 1528 void BaseLoadStubCompiler::GenerateLoadInterceptor(
1498 Register holder_reg, 1529 Register holder_reg,
1499 Handle<JSObject> object, 1530 Handle<JSObject> object,
1500 Handle<JSObject> interceptor_holder, 1531 Handle<JSObject> interceptor_holder,
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3742 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3773 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3743 } 3774 }
3744 } 3775 }
3745 3776
3746 3777
3747 #undef __ 3778 #undef __
3748 3779
3749 } } // namespace v8::internal 3780 } } // namespace v8::internal
3750 3781
3751 #endif // V8_TARGET_ARCH_MIPS 3782 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | src/sampler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698