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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 876 |
877 | 877 |
878 static void GenerateFastApiDirectCall(MacroAssembler* masm, | 878 static void GenerateFastApiDirectCall(MacroAssembler* masm, |
879 const CallOptimization& optimization, | 879 const CallOptimization& optimization, |
880 int argc) { | 880 int argc) { |
881 // ----------- S t a t e ------------- | 881 // ----------- S t a t e ------------- |
882 // -- sp[0] : holder (set by CheckPrototypes) | 882 // -- sp[0] : holder (set by CheckPrototypes) |
883 // -- sp[4] : callee JS function | 883 // -- sp[4] : callee JS function |
884 // -- sp[8] : call data | 884 // -- sp[8] : call data |
885 // -- sp[12] : isolate | 885 // -- sp[12] : isolate |
886 // -- sp[16] : ReturnValue | 886 // -- sp[16] : ReturnValue default value |
887 // -- sp[20] : last JS argument | 887 // -- sp[20] : ReturnValue |
| 888 // -- sp[24] : last JS argument |
888 // -- ... | 889 // -- ... |
889 // -- sp[(argc + 4) * 4] : first JS argument | 890 // -- sp[(argc + 5) * 4] : first JS argument |
890 // -- sp[(argc + 5) * 4] : receiver | 891 // -- sp[(argc + 6) * 4] : receiver |
891 // ----------------------------------- | 892 // ----------------------------------- |
892 // Get the function and setup the context. | 893 // Get the function and setup the context. |
893 Handle<JSFunction> function = optimization.constant_function(); | 894 Handle<JSFunction> function = optimization.constant_function(); |
894 __ LoadHeapObject(t1, function); | 895 __ LoadHeapObject(t1, function); |
895 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset)); | 896 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset)); |
896 | 897 |
897 // Pass the additional arguments. | 898 // Pass the additional arguments. |
898 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 899 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
899 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 900 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
900 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 901 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
901 __ li(a0, api_call_info); | 902 __ li(a0, api_call_info); |
902 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset)); | 903 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset)); |
903 } else { | 904 } else { |
904 __ li(t2, call_data); | 905 __ li(t2, call_data); |
905 } | 906 } |
906 | 907 |
907 __ li(t3, Operand(ExternalReference::isolate_address(masm->isolate()))); | 908 __ li(t3, Operand(ExternalReference::isolate_address(masm->isolate()))); |
908 // Store JS function, call data, isolate and ReturnValue. | 909 // Store JS function, call data, isolate ReturnValue default and ReturnValue. |
909 __ sw(t1, MemOperand(sp, 1 * kPointerSize)); | 910 __ sw(t1, MemOperand(sp, 1 * kPointerSize)); |
910 __ sw(t2, MemOperand(sp, 2 * kPointerSize)); | 911 __ sw(t2, MemOperand(sp, 2 * kPointerSize)); |
911 __ sw(t3, MemOperand(sp, 3 * kPointerSize)); | 912 __ sw(t3, MemOperand(sp, 3 * kPointerSize)); |
912 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); | 913 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); |
913 __ sw(t1, MemOperand(sp, 4 * kPointerSize)); | 914 __ sw(t1, MemOperand(sp, 4 * kPointerSize)); |
| 915 __ sw(t1, MemOperand(sp, 5 * kPointerSize)); |
914 | 916 |
915 // Prepare arguments. | 917 // Prepare arguments. |
916 __ Addu(a2, sp, Operand(4 * kPointerSize)); | 918 __ Addu(a2, sp, Operand(5 * kPointerSize)); |
917 | 919 |
918 // Allocate the v8::Arguments structure in the arguments' space since | 920 // Allocate the v8::Arguments structure in the arguments' space since |
919 // it's not controlled by GC. | 921 // it's not controlled by GC. |
920 const int kApiStackSpace = 4; | 922 const int kApiStackSpace = 4; |
921 | 923 |
922 FrameScope frame_scope(masm, StackFrame::MANUAL); | 924 FrameScope frame_scope(masm, StackFrame::MANUAL); |
923 __ EnterExitFrame(false, kApiStackSpace); | 925 __ EnterExitFrame(false, kApiStackSpace); |
924 | 926 |
925 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a | 927 // 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 | 928 // struct from the function (which is currently the case). This means we pass |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 // the exit frame to make GC aware of them and store pointers to them. | 1430 // the exit frame to make GC aware of them and store pointers to them. |
1429 __ push(receiver()); | 1431 __ push(receiver()); |
1430 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1432 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
1431 if (heap()->InNewSpace(callback->data())) { | 1433 if (heap()->InNewSpace(callback->data())) { |
1432 __ li(scratch3(), callback); | 1434 __ li(scratch3(), callback); |
1433 __ lw(scratch3(), FieldMemOperand(scratch3(), | 1435 __ lw(scratch3(), FieldMemOperand(scratch3(), |
1434 ExecutableAccessorInfo::kDataOffset)); | 1436 ExecutableAccessorInfo::kDataOffset)); |
1435 } else { | 1437 } else { |
1436 __ li(scratch3(), Handle<Object>(callback->data(), isolate())); | 1438 __ li(scratch3(), Handle<Object>(callback->data(), isolate())); |
1437 } | 1439 } |
1438 __ Subu(sp, sp, 5 * kPointerSize); | 1440 __ Subu(sp, sp, 6 * kPointerSize); |
1439 __ sw(reg, MemOperand(sp, 4 * kPointerSize)); | 1441 __ sw(reg, MemOperand(sp, 5 * kPointerSize)); |
| 1442 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); |
| 1443 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
1440 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); | 1444 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); |
1441 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 1445 __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); |
1442 __ li(scratch4(), | 1446 __ li(scratch4(), |
1443 Operand(ExternalReference::isolate_address(isolate()))); | 1447 Operand(ExternalReference::isolate_address(isolate()))); |
1444 __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); | |
1445 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); | 1448 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); |
1446 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); | 1449 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); |
1447 | 1450 |
1448 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1451 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1449 bool returns_handle = | 1452 bool returns_handle = |
1450 !CallbackTable::ReturnsVoid(isolate(), getter_address); | 1453 !CallbackTable::ReturnsVoid(isolate(), getter_address); |
1451 | 1454 |
1452 Register first_arg = returns_handle ? a1 : a0; | 1455 Register first_arg = returns_handle ? a1 : a0; |
1453 Register second_arg = returns_handle ? a2 : a1; | 1456 Register second_arg = returns_handle ? a2 : a1; |
1454 | 1457 |
(...skipping 19 matching lines...) Expand all Loading... |
1474 ApiFunction fun(getter_address); | 1477 ApiFunction fun(getter_address); |
1475 ExternalReference::Type type = | 1478 ExternalReference::Type type = |
1476 returns_handle ? | 1479 returns_handle ? |
1477 ExternalReference::DIRECT_GETTER_CALL : | 1480 ExternalReference::DIRECT_GETTER_CALL : |
1478 ExternalReference::DIRECT_GETTER_CALL_NEW; | 1481 ExternalReference::DIRECT_GETTER_CALL_NEW; |
1479 | 1482 |
1480 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 1483 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
1481 __ CallApiFunctionAndReturn(ref, | 1484 __ CallApiFunctionAndReturn(ref, |
1482 kStackUnwindSpace, | 1485 kStackUnwindSpace, |
1483 returns_handle, | 1486 returns_handle, |
1484 4); | 1487 5); |
1485 } | 1488 } |
1486 | 1489 |
1487 | 1490 |
1488 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 1491 void BaseLoadStubCompiler::GenerateLoadInterceptor( |
1489 Register holder_reg, | 1492 Register holder_reg, |
1490 Handle<JSObject> object, | 1493 Handle<JSObject> object, |
1491 Handle<JSObject> interceptor_holder, | 1494 Handle<JSObject> interceptor_holder, |
1492 LookupResult* lookup, | 1495 LookupResult* lookup, |
1493 Handle<Name> name) { | 1496 Handle<Name> name) { |
1494 ASSERT(interceptor_holder->HasNamedInterceptor()); | 1497 ASSERT(interceptor_holder->HasNamedInterceptor()); |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3735 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3738 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3736 } | 3739 } |
3737 } | 3740 } |
3738 | 3741 |
3739 | 3742 |
3740 #undef __ | 3743 #undef __ |
3741 | 3744 |
3742 } } // namespace v8::internal | 3745 } } // namespace v8::internal |
3743 | 3746 |
3744 #endif // V8_TARGET_ARCH_MIPS | 3747 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |