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