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

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

Issue 15813005: MIPS: Fix DIRECT_API_CALL_NEW and DIRECT_GETTER_CALL_NEW call. (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') | no next file » | 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 917
918 // Allocate the v8::Arguments structure in the arguments' space since 918 // Allocate the v8::Arguments structure in the arguments' space since
919 // it's not controlled by GC. 919 // it's not controlled by GC.
920 const int kApiStackSpace = 4; 920 const int kApiStackSpace = 4;
921 921
922 FrameScope frame_scope(masm, StackFrame::MANUAL); 922 FrameScope frame_scope(masm, StackFrame::MANUAL);
923 __ EnterExitFrame(false, kApiStackSpace); 923 __ EnterExitFrame(false, kApiStackSpace);
924 924
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. TryCallApiFunctionAndReturn 927 // the first argument in a1 instead of a0, if returns_handle is true.
928 // will handle setting up a0. 928 // CallApiFunctionAndReturn will set up a0.
929 929
930 // a1 = v8::Arguments&
931 // Arguments is built at sp + 1 (sp is a reserved spot for ra).
932 __ Addu(a1, sp, kPointerSize);
933
934 // v8::Arguments::implicit_args_
935 __ sw(a2, MemOperand(a1, 0 * kPointerSize));
936 // v8::Arguments::values_
937 __ Addu(t0, a2, Operand(argc * kPointerSize));
938 __ sw(t0, MemOperand(a1, 1 * kPointerSize));
939 // v8::Arguments::length_ = argc
940 __ li(t0, Operand(argc));
941 __ sw(t0, MemOperand(a1, 2 * kPointerSize));
942 // v8::Arguments::is_construct_call = 0
943 __ sw(zero_reg, MemOperand(a1, 3 * kPointerSize));
944
945 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
946 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 930 Address function_address = v8::ToCData<Address>(api_call_info->callback());
947 bool returns_handle = 931 bool returns_handle =
948 !CallbackTable::ReturnsVoid(masm->isolate(), function_address); 932 !CallbackTable::ReturnsVoid(masm->isolate(), function_address);
933
934 Register first_arg = returns_handle ? a1 : a0;
935
936 // first_arg = v8::Arguments&
937 // Arguments is built at sp + 1 (sp is a reserved spot for ra).
938 __ Addu(first_arg, sp, kPointerSize);
939
940 // v8::Arguments::implicit_args_
941 __ sw(a2, MemOperand(first_arg, 0 * kPointerSize));
942 // v8::Arguments::values_
943 __ Addu(t0, a2, Operand(argc * kPointerSize));
944 __ sw(t0, MemOperand(first_arg, 1 * kPointerSize));
945 // v8::Arguments::length_ = argc
946 __ li(t0, Operand(argc));
947 __ sw(t0, MemOperand(first_arg, 2 * kPointerSize));
948 // v8::Arguments::is_construct_call = 0
949 __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize));
950
951 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
949 ApiFunction fun(function_address); 952 ApiFunction fun(function_address);
950 ExternalReference::Type type = 953 ExternalReference::Type type =
951 returns_handle ? 954 returns_handle ?
952 ExternalReference::DIRECT_API_CALL : 955 ExternalReference::DIRECT_API_CALL :
953 ExternalReference::DIRECT_API_CALL_NEW; 956 ExternalReference::DIRECT_API_CALL_NEW;
954 ExternalReference ref = 957 ExternalReference ref =
955 ExternalReference(&fun, 958 ExternalReference(&fun,
956 type, 959 type,
957 masm->isolate()); 960 masm->isolate());
958 AllowExternalCallThatCantCauseGC scope(masm); 961 AllowExternalCallThatCantCauseGC scope(masm);
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 __ Subu(sp, sp, 5 * kPointerSize); 1438 __ Subu(sp, sp, 5 * kPointerSize);
1436 __ sw(reg, MemOperand(sp, 4 * kPointerSize)); 1439 __ sw(reg, MemOperand(sp, 4 * kPointerSize));
1437 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); 1440 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize));
1438 __ li(scratch3(), 1441 __ li(scratch3(),
1439 Operand(ExternalReference::isolate_address(isolate()))); 1442 Operand(ExternalReference::isolate_address(isolate())));
1440 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex); 1443 __ LoadRoot(scratch4(), Heap::kUndefinedValueRootIndex);
1441 __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); 1444 __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize));
1442 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); 1445 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize));
1443 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); 1446 __ sw(name(), MemOperand(sp, 0 * kPointerSize));
1444 1447
1448 Address getter_address = v8::ToCData<Address>(callback->getter());
1449 bool returns_handle =
1450 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1451
1452 Register first_arg = returns_handle ? a1 : a0;
1453 Register second_arg = returns_handle ? a2 : a1;
1454
1445 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. 1455 __ mov(a2, scratch2()); // Saved in case scratch2 == a1.
1446 __ mov(a1, sp); // a1 (first argument - see note below) = Handle<Name> 1456 __ mov(first_arg, sp); // (first argument - see note below) = Handle<Name>
1447 1457
1448 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 1458 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a
1449 // struct from the function (which is currently the case). This means we pass 1459 // struct from the function (which is currently the case). This means we pass
1450 // the arguments in a1-a2 instead of a0-a1. TryCallApiFunctionAndReturn 1460 // the arguments in a1-a2 instead of a0-a1, if returns_handle is true.
1451 // will handle setting up a0. 1461 // CallApiFunctionAndReturn will set up a0.
1452 1462
1453 const int kApiStackSpace = 1; 1463 const int kApiStackSpace = 1;
1454 FrameScope frame_scope(masm(), StackFrame::MANUAL); 1464 FrameScope frame_scope(masm(), StackFrame::MANUAL);
1455 __ EnterExitFrame(false, kApiStackSpace); 1465 __ EnterExitFrame(false, kApiStackSpace);
1456 1466
1457 // Create AccessorInfo instance on the stack above the exit frame with 1467 // Create AccessorInfo instance on the stack above the exit frame with
1458 // scratch2 (internal::Object** args_) as the data. 1468 // scratch2 (internal::Object** args_) as the data.
1459 __ sw(a2, MemOperand(sp, kPointerSize)); 1469 __ sw(a2, MemOperand(sp, kPointerSize));
1460 // a2 (second argument - see note above) = AccessorInfo& 1470 // (second argument - see note above) = AccessorInfo&
1461 __ Addu(a2, sp, kPointerSize); 1471 __ Addu(second_arg, sp, kPointerSize);
1462 1472
1463 const int kStackUnwindSpace = kFastApiCallArguments + 1; 1473 const int kStackUnwindSpace = kFastApiCallArguments + 1;
1464 Address getter_address = v8::ToCData<Address>(callback->getter());
1465 bool returns_handle =
1466 !CallbackTable::ReturnsVoid(isolate(), getter_address);
1467 ApiFunction fun(getter_address); 1474 ApiFunction fun(getter_address);
1468 ExternalReference::Type type = 1475 ExternalReference::Type type =
1469 returns_handle ? 1476 returns_handle ?
1470 ExternalReference::DIRECT_GETTER_CALL : 1477 ExternalReference::DIRECT_GETTER_CALL :
1471 ExternalReference::DIRECT_GETTER_CALL_NEW; 1478 ExternalReference::DIRECT_GETTER_CALL_NEW;
1472 1479
1473 ExternalReference ref = ExternalReference(&fun, type, isolate()); 1480 ExternalReference ref = ExternalReference(&fun, type, isolate());
1474 __ CallApiFunctionAndReturn(ref, 1481 __ CallApiFunctionAndReturn(ref,
1475 kStackUnwindSpace, 1482 kStackUnwindSpace,
1476 returns_handle, 1483 returns_handle,
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3903 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3897 } 3904 }
3898 } 3905 }
3899 3906
3900 3907
3901 #undef __ 3908 #undef __
3902 3909
3903 } } // namespace v8::internal 3910 } } // namespace v8::internal
3904 3911
3905 #endif // V8_TARGET_ARCH_MIPS 3912 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698