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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 886 |
887 | 887 |
888 static void GenerateFastApiDirectCall(MacroAssembler* masm, | 888 static void GenerateFastApiDirectCall(MacroAssembler* masm, |
889 const CallOptimization& optimization, | 889 const CallOptimization& optimization, |
890 int argc) { | 890 int argc) { |
891 // ----------- S t a t e ------------- | 891 // ----------- S t a t e ------------- |
892 // -- sp[0] : holder (set by CheckPrototypes) | 892 // -- sp[0] : holder (set by CheckPrototypes) |
893 // -- sp[4] : callee JS function | 893 // -- sp[4] : callee JS function |
894 // -- sp[8] : call data | 894 // -- sp[8] : call data |
895 // -- sp[12] : isolate | 895 // -- sp[12] : isolate |
896 // -- sp[16] : ReturnValue | 896 // -- sp[16] : ReturnValue default value |
897 // -- sp[20] : last JS argument | 897 // -- sp[20] : ReturnValue |
| 898 // -- sp[24] : last JS argument |
898 // -- ... | 899 // -- ... |
899 // -- sp[(argc + 4) * 4] : first JS argument | 900 // -- sp[(argc + 5) * 4] : first JS argument |
900 // -- sp[(argc + 5) * 4] : receiver | 901 // -- sp[(argc + 6) * 4] : receiver |
901 // ----------------------------------- | 902 // ----------------------------------- |
902 // Get the function and setup the context. | 903 // Get the function and setup the context. |
903 Handle<JSFunction> function = optimization.constant_function(); | 904 Handle<JSFunction> function = optimization.constant_function(); |
904 __ LoadHeapObject(r5, function); | 905 __ LoadHeapObject(r5, function); |
905 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); | 906 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); |
906 | 907 |
907 // Pass the additional arguments. | 908 // Pass the additional arguments. |
908 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 909 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
909 Handle<Object> call_data(api_call_info->data(), masm->isolate()); | 910 Handle<Object> call_data(api_call_info->data(), masm->isolate()); |
910 if (masm->isolate()->heap()->InNewSpace(*call_data)) { | 911 if (masm->isolate()->heap()->InNewSpace(*call_data)) { |
911 __ Move(r0, api_call_info); | 912 __ Move(r0, api_call_info); |
912 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); | 913 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); |
913 } else { | 914 } else { |
914 __ Move(r6, call_data); | 915 __ Move(r6, call_data); |
915 } | 916 } |
916 __ mov(r7, Operand(ExternalReference::isolate_address(masm->isolate()))); | 917 __ mov(r7, Operand(ExternalReference::isolate_address(masm->isolate()))); |
917 // Store JS function, call data, isolate and ReturnValue. | 918 // Store JS function, call data, isolate ReturnValue default and ReturnValue. |
918 __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit()); | 919 __ stm(ib, sp, r5.bit() | r6.bit() | r7.bit()); |
919 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 920 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
920 __ str(r5, MemOperand(sp, 4 * kPointerSize)); | 921 __ str(r5, MemOperand(sp, 4 * kPointerSize)); |
| 922 __ str(r5, MemOperand(sp, 5 * kPointerSize)); |
921 | 923 |
922 // Prepare arguments. | 924 // Prepare arguments. |
923 __ add(r2, sp, Operand(4 * kPointerSize)); | 925 __ add(r2, sp, Operand(5 * kPointerSize)); |
924 | 926 |
925 // Allocate the v8::Arguments structure in the arguments' space since | 927 // Allocate the v8::Arguments structure in the arguments' space since |
926 // it's not controlled by GC. | 928 // it's not controlled by GC. |
927 const int kApiStackSpace = 4; | 929 const int kApiStackSpace = 4; |
928 | 930 |
929 FrameScope frame_scope(masm, StackFrame::MANUAL); | 931 FrameScope frame_scope(masm, StackFrame::MANUAL); |
930 __ EnterExitFrame(false, kApiStackSpace); | 932 __ EnterExitFrame(false, kApiStackSpace); |
931 | 933 |
932 // r0 = v8::Arguments& | 934 // r0 = v8::Arguments& |
933 // Arguments is after the return address. | 935 // Arguments is after the return address. |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1429 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
1428 if (heap()->InNewSpace(callback->data())) { | 1430 if (heap()->InNewSpace(callback->data())) { |
1429 __ Move(scratch3(), callback); | 1431 __ Move(scratch3(), callback); |
1430 __ ldr(scratch3(), FieldMemOperand(scratch3(), | 1432 __ ldr(scratch3(), FieldMemOperand(scratch3(), |
1431 ExecutableAccessorInfo::kDataOffset)); | 1433 ExecutableAccessorInfo::kDataOffset)); |
1432 } else { | 1434 } else { |
1433 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); | 1435 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); |
1434 } | 1436 } |
1435 __ Push(reg, scratch3()); | 1437 __ Push(reg, scratch3()); |
1436 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 1438 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
| 1439 __ mov(scratch4(), scratch3()); |
| 1440 __ Push(scratch3(), scratch4()); |
1437 __ mov(scratch4(), | 1441 __ mov(scratch4(), |
1438 Operand(ExternalReference::isolate_address(isolate()))); | 1442 Operand(ExternalReference::isolate_address(isolate()))); |
1439 __ Push(scratch3(), scratch4(), name()); | 1443 __ Push(scratch4(), name()); |
1440 __ mov(r0, sp); // r0 = Handle<Name> | 1444 __ mov(r0, sp); // r0 = Handle<Name> |
1441 | 1445 |
1442 const int kApiStackSpace = 1; | 1446 const int kApiStackSpace = 1; |
1443 FrameScope frame_scope(masm(), StackFrame::MANUAL); | 1447 FrameScope frame_scope(masm(), StackFrame::MANUAL); |
1444 __ EnterExitFrame(false, kApiStackSpace); | 1448 __ EnterExitFrame(false, kApiStackSpace); |
1445 | 1449 |
1446 // Create AccessorInfo instance on the stack above the exit frame with | 1450 // Create AccessorInfo instance on the stack above the exit frame with |
1447 // scratch2 (internal::Object** args_) as the data. | 1451 // scratch2 (internal::Object** args_) as the data. |
1448 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); | 1452 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); |
1449 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& | 1453 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& |
1450 | 1454 |
1451 const int kStackUnwindSpace = kFastApiCallArguments + 1; | 1455 const int kStackUnwindSpace = kFastApiCallArguments + 1; |
1452 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1456 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1453 bool returns_handle = | 1457 bool returns_handle = |
1454 !CallbackTable::ReturnsVoid(isolate(), getter_address); | 1458 !CallbackTable::ReturnsVoid(isolate(), getter_address); |
1455 ApiFunction fun(getter_address); | 1459 ApiFunction fun(getter_address); |
1456 ExternalReference::Type type = | 1460 ExternalReference::Type type = |
1457 returns_handle ? | 1461 returns_handle ? |
1458 ExternalReference::DIRECT_GETTER_CALL : | 1462 ExternalReference::DIRECT_GETTER_CALL : |
1459 ExternalReference::DIRECT_GETTER_CALL_NEW; | 1463 ExternalReference::DIRECT_GETTER_CALL_NEW; |
1460 | 1464 |
1461 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 1465 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
1462 __ CallApiFunctionAndReturn(ref, | 1466 __ CallApiFunctionAndReturn(ref, |
1463 kStackUnwindSpace, | 1467 kStackUnwindSpace, |
1464 returns_handle, | 1468 returns_handle, |
1465 4); | 1469 5); |
1466 } | 1470 } |
1467 | 1471 |
1468 | 1472 |
1469 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 1473 void BaseLoadStubCompiler::GenerateLoadInterceptor( |
1470 Register holder_reg, | 1474 Register holder_reg, |
1471 Handle<JSObject> object, | 1475 Handle<JSObject> object, |
1472 Handle<JSObject> interceptor_holder, | 1476 Handle<JSObject> interceptor_holder, |
1473 LookupResult* lookup, | 1477 LookupResult* lookup, |
1474 Handle<Name> name) { | 1478 Handle<Name> name) { |
1475 ASSERT(interceptor_holder->HasNamedInterceptor()); | 1479 ASSERT(interceptor_holder->HasNamedInterceptor()); |
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3637 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3641 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3638 } | 3642 } |
3639 } | 3643 } |
3640 | 3644 |
3641 | 3645 |
3642 #undef __ | 3646 #undef __ |
3643 | 3647 |
3644 } } // namespace v8::internal | 3648 } } // namespace v8::internal |
3645 | 3649 |
3646 #endif // V8_TARGET_ARCH_ARM | 3650 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |