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

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

Issue 16286016: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed check that pthread_kill always succeeds 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 925 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a
926 // struct from the function (which is currently the case). This means we pass 926 // struct from the function (which is currently the case). This means we pass
927 // the first argument in a1 instead of a0, if returns_handle is true. 927 // the first argument in a1 instead of a0, if returns_handle is true.
928 // CallApiFunctionAndReturn will set up a0. 928 // CallApiFunctionAndReturn will set up a0.
929 929
930 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 930 Address function_address = v8::ToCData<Address>(api_call_info->callback());
931 bool returns_handle = 931 bool returns_handle =
932 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); 932 !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
933 933
934 Register first_arg = returns_handle ? a1 : a0; 934 Register first_arg = returns_handle ? a1 : a0;
935 Register second_arg = returns_handle ? a2 : a1;
935 936
936 // first_arg = v8::Arguments& 937 // first_arg = v8::Arguments&
937 // Arguments is built at sp + 1 (sp is a reserved spot for ra). 938 // Arguments is built at sp + 1 (sp is a reserved spot for ra).
938 __ Addu(first_arg, sp, kPointerSize); 939 __ Addu(first_arg, sp, kPointerSize);
939 940
940 // v8::Arguments::implicit_args_ 941 // v8::Arguments::implicit_args_
941 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize)); 942 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize));
942 // v8::Arguments::values_ 943 // v8::Arguments::values_
943 __ Addu(t0, a2, Operand(argc * kPointerSize)); 944 __ Addu(t0, a2, Operand(argc * kPointerSize));
944 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize)); 945 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize));
945 // v8::Arguments::length_ = argc 946 // v8::Arguments::length_ = argc
946 __ li(t0, Operand(argc)); 947 __ li(t0, Operand(argc));
947 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize)); 948 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize));
948 // v8::Arguments::is_construct_call = 0 949 // v8::Arguments::is_construct_call = 0
949 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize)); 950 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize));
950 951
951 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 952 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
952 ApiFunction fun(function_address); 953 ApiFunction fun(function_address);
953 ExternalReference::Type type = 954 ExternalReference::Type type =
954 returns_handle ? 955 returns_handle ?
955 ExternalReference::DIRECT_API_CALL : 956 ExternalReference::DIRECT_API_CALL :
956 ExternalReference::DIRECT_API_CALL_NEW; 957 ExternalReference::DIRECT_API_CALL_NEW;
957 ExternalReference ref = 958 ExternalReference ref =
958 ExternalReference(&fun, 959 ExternalReference(&fun,
959 type, 960 type,
960 masm->isolate()); 961 masm->isolate());
962
963 Address thunk_address = returns_handle
964 ? FUNCTION_ADDR(&InvokeInvocationCallback)
965 : FUNCTION_ADDR(&InvokeFunctionCallback);
966 ExternalReference::Type thunk_type =
967 returns_handle ?
968 ExternalReference::PROFILING_API_CALL :
969 ExternalReference::PROFILING_API_CALL_NEW;
970 ApiFunction thunk_fun(thunk_address);
971 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
972 masm->isolate());
973
961 AllowExternalCallThatCantCauseGC scope(masm); 974 AllowExternalCallThatCantCauseGC scope(masm);
962 __ CallApiFunctionAndReturn(ref, 975 __ CallApiFunctionAndReturn(ref,
976 function_address,
977 thunk_ref,
978 second_arg,
963 kStackUnwindSpace, 979 kStackUnwindSpace,
964 returns_handle, 980 returns_handle,
965 kFastApiCallArguments + 1); 981 kFastApiCallArguments + 1);
966 } 982 }
967 983
968 class CallInterceptorCompiler BASE_EMBEDDED { 984 class CallInterceptorCompiler BASE_EMBEDDED {
969 public: 985 public:
970 CallInterceptorCompiler(StubCompiler* stub_compiler, 986 CallInterceptorCompiler(StubCompiler* stub_compiler,
971 const ParameterCount& arguments, 987 const ParameterCount& arguments,
972 Register name, 988 Register name,
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 Operand(ExternalReference::isolate_address(isolate()))); 1461 Operand(ExternalReference::isolate_address(isolate())));
1446 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); 1462 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize));
1447 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); 1463 __ sw(name(), MemOperand(sp, 0 * kPointerSize));
1448 1464
1449 Address getter_address = v8::ToCData<Address>(callback->getter()); 1465 Address getter_address = v8::ToCData<Address>(callback->getter());
1450 bool returns_handle = 1466 bool returns_handle =
1451 !CallbackTable::ReturnsVoid(isolate(), getter_address); 1467 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1452 1468
1453 Register first_arg = returns_handle ? a1 : a0; 1469 Register first_arg = returns_handle ? a1 : a0;
1454 Register second_arg = returns_handle ? a2 : a1; 1470 Register second_arg = returns_handle ? a2 : a1;
1471 Register third_arg = returns_handle ? a3 : a2;
1455 1472
1456 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. 1473 __ mov(a2, scratch2()); // Saved in case scratch2 == a1.
1457 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name> 1474 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name>
1458 1475
1459 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 1476 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a
1460 // struct from the function (which is currently the case). This means we pass 1477 // struct from the function (which is currently the case). This means we pass
1461 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true. 1478 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true.
1462 // CallApiFunctionAndReturn will set up a0. 1479 // CallApiFunctionAndReturn will set up a0.
1463 1480
1464 const int kApiStackSpace = 1; 1481 const int kApiStackSpace = 1;
1465 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1482 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1466 __ EnterExitFrame(false, kApiStackSpace); 1483 __ EnterExitFrame(false, kApiStackSpace);
1467 1484
1468 // Create AccessorInfo instance on the stack above the exit frame with 1485 // Create AccessorInfo instance on the stack above the exit frame with
1469 // scratch2 (internal::Object** args_) as the data. 1486 // scratch2 (internal::Object** args_) as the data.
1470 __ sw(a2, MemOperand(sp, kPointerSize)); 1487 __ sw(a2, MemOperand(sp, kPointerSize));
1471 // (second argument - see note above) = AccessorInfo& 1488 // (second argument - see note above) = AccessorInfo&
1472 __ Addu(second_arg, sp, kPointerSize); 1489 __ Addu(second_arg, sp, kPointerSize);
1473 1490
1474 const int kStackUnwindSpace = kFastApiCallArguments + 1; 1491 const int kStackUnwindSpace = kFastApiCallArguments + 1;
1492
1475 ApiFunction fun(getter_address); 1493 ApiFunction fun(getter_address);
1476 ExternalReference::Type type = 1494 ExternalReference::Type type =
1477 returns_handle ? 1495 returns_handle ?
1478 ExternalReference::DIRECT_GETTER_CALL : 1496 ExternalReference::DIRECT_GETTER_CALL :
1479 ExternalReference::DIRECT_GETTER_CALL_NEW; 1497 ExternalReference::DIRECT_GETTER_CALL_NEW;
1498 ExternalReference ref = ExternalReference(&fun, type, isolate());
1480 1499
1481 ExternalReference ref = ExternalReference(&fun, type, isolate()); 1500 Address thunk_address = returns_handle
1501 ? FUNCTION_ADDR(&InvokeAccessorGetter)
1502 : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
1503 ExternalReference::Type thunk_type =
1504 returns_handle ?
1505 ExternalReference::PROFILING_GETTER_CALL :
1506 ExternalReference::PROFILING_GETTER_CALL_NEW;
1507 ApiFunction thunk_fun(thunk_address);
1508 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type,
1509 isolate());
1482 __ CallApiFunctionAndReturn(ref, 1510 __ CallApiFunctionAndReturn(ref,
1511 getter_address,
1512 thunk_ref,
1513 third_arg,
1483 kStackUnwindSpace, 1514 kStackUnwindSpace,
1484 returns_handle, 1515 returns_handle,
1485 5); 1516 5);
1486 } 1517 }
1487 1518
1488 1519
1489 void BaseLoadStubCompiler::GenerateLoadInterceptor( 1520 void BaseLoadStubCompiler::GenerateLoadInterceptor(
1490 Register holder_reg, 1521 Register holder_reg,
1491 Handle<JSObject> object, 1522 Handle<JSObject> object,
1492 Handle<JSObject> interceptor_holder, 1523 Handle<JSObject> interceptor_holder,
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3734 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3765 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3735 } 3766 }
3736 } 3767 }
3737 3768
3738 3769
3739 #undef __ 3770 #undef __
3740 3771
3741 } } // namespace v8::internal 3772 } } // namespace v8::internal
3742 3773
3743 #endif // V8_TARGET_ARCH_MIPS 3774 #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