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 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 : CALL_AS_METHOD; | 778 : CALL_AS_METHOD; |
779 __ InvokeFunction(r1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); | 779 __ InvokeFunction(r1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); |
780 } | 780 } |
781 | 781 |
782 | 782 |
783 static void PushInterceptorArguments(MacroAssembler* masm, | 783 static void PushInterceptorArguments(MacroAssembler* masm, |
784 Register receiver, | 784 Register receiver, |
785 Register holder, | 785 Register holder, |
786 Register name, | 786 Register name, |
787 Handle<JSObject> holder_obj) { | 787 Handle<JSObject> holder_obj) { |
788 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0); | |
789 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1); | |
790 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2); | |
791 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3); | |
792 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4); | |
793 __ push(name); | 788 __ push(name); |
794 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); | 789 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); |
795 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); | 790 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); |
796 Register scratch = name; | 791 Register scratch = name; |
797 __ mov(scratch, Operand(interceptor)); | 792 __ mov(scratch, Operand(interceptor)); |
798 __ push(scratch); | 793 __ push(scratch); |
799 __ push(receiver); | 794 __ push(receiver); |
800 __ push(holder); | 795 __ push(holder); |
| 796 __ ldr(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset)); |
| 797 __ push(scratch); |
| 798 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); |
| 799 __ push(scratch); |
801 } | 800 } |
802 | 801 |
803 | 802 |
804 static void CompileCallLoadPropertyWithInterceptor( | 803 static void CompileCallLoadPropertyWithInterceptor( |
805 MacroAssembler* masm, | 804 MacroAssembler* masm, |
806 Register receiver, | 805 Register receiver, |
807 Register holder, | 806 Register holder, |
808 Register name, | 807 Register name, |
809 Handle<JSObject> holder_obj) { | 808 Handle<JSObject> holder_obj) { |
810 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 809 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
811 | 810 |
812 ExternalReference ref = | 811 ExternalReference ref = |
813 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), | 812 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), |
814 masm->isolate()); | 813 masm->isolate()); |
815 __ mov(r0, Operand(StubCache::kInterceptorArgsLength)); | 814 __ mov(r0, Operand(6)); |
816 __ mov(r1, Operand(ref)); | 815 __ mov(r1, Operand(ref)); |
817 | 816 |
818 CEntryStub stub(1); | 817 CEntryStub stub(1); |
819 __ CallStub(&stub); | 818 __ CallStub(&stub); |
820 } | 819 } |
821 | 820 |
822 | 821 |
823 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; | 822 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; |
824 | 823 |
825 // Reserves space for the extra arguments to API function in the | 824 // Reserves space for the extra arguments to API function in the |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 name, miss_label); | 1103 name, miss_label); |
1105 | 1104 |
1106 // Call a runtime function to load the interceptor property. | 1105 // Call a runtime function to load the interceptor property. |
1107 FrameScope scope(masm, StackFrame::INTERNAL); | 1106 FrameScope scope(masm, StackFrame::INTERNAL); |
1108 // Save the name_ register across the call. | 1107 // Save the name_ register across the call. |
1109 __ push(name_); | 1108 __ push(name_); |
1110 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); | 1109 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); |
1111 __ CallExternalReference( | 1110 __ CallExternalReference( |
1112 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 1111 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
1113 masm->isolate()), | 1112 masm->isolate()), |
1114 StubCache::kInterceptorArgsLength); | 1113 6); |
1115 // Restore the name_ register. | 1114 // Restore the name_ register. |
1116 __ pop(name_); | 1115 __ pop(name_); |
1117 // Leave the internal frame. | 1116 // Leave the internal frame. |
1118 } | 1117 } |
1119 | 1118 |
1120 void LoadWithInterceptor(MacroAssembler* masm, | 1119 void LoadWithInterceptor(MacroAssembler* masm, |
1121 Register receiver, | 1120 Register receiver, |
1122 Register holder, | 1121 Register holder, |
1123 Handle<JSObject> holder_obj, | 1122 Handle<JSObject> holder_obj, |
1124 Register scratch, | 1123 Register scratch, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 GenerateFastApiCall( | 1413 GenerateFastApiCall( |
1415 masm(), call_optimization, receiver(), scratch3(), 0, NULL); | 1414 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
1416 } | 1415 } |
1417 | 1416 |
1418 | 1417 |
1419 void BaseLoadStubCompiler::GenerateLoadCallback( | 1418 void BaseLoadStubCompiler::GenerateLoadCallback( |
1420 Register reg, | 1419 Register reg, |
1421 Handle<ExecutableAccessorInfo> callback) { | 1420 Handle<ExecutableAccessorInfo> callback) { |
1422 // Build AccessorInfo::args_ list on the stack and push property name below | 1421 // Build AccessorInfo::args_ list on the stack and push property name below |
1423 // the exit frame to make GC aware of them and store pointers to them. | 1422 // the exit frame to make GC aware of them and store pointers to them. |
1424 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0); | |
1425 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1); | |
1426 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2); | |
1427 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3); | |
1428 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4); | |
1429 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5); | |
1430 __ push(receiver()); | 1423 __ push(receiver()); |
1431 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ | 1424 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ |
1432 if (heap()->InNewSpace(callback->data())) { | 1425 if (heap()->InNewSpace(callback->data())) { |
1433 __ Move(scratch3(), callback); | 1426 __ Move(scratch3(), callback); |
1434 __ ldr(scratch3(), FieldMemOperand(scratch3(), | 1427 __ ldr(scratch3(), FieldMemOperand(scratch3(), |
1435 ExecutableAccessorInfo::kDataOffset)); | 1428 ExecutableAccessorInfo::kDataOffset)); |
1436 } else { | 1429 } else { |
1437 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); | 1430 __ Move(scratch3(), Handle<Object>(callback->data(), isolate())); |
1438 } | 1431 } |
1439 __ push(scratch3()); | 1432 __ Push(reg, scratch3()); |
1440 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 1433 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); |
1441 __ mov(scratch4(), scratch3()); | 1434 __ mov(scratch4(), scratch3()); |
1442 __ Push(scratch3(), scratch4()); | 1435 __ Push(scratch3(), scratch4()); |
1443 __ mov(scratch4(), | 1436 __ mov(scratch4(), |
1444 Operand(ExternalReference::isolate_address(isolate()))); | 1437 Operand(ExternalReference::isolate_address(isolate()))); |
1445 __ Push(scratch4(), reg, name()); | 1438 __ Push(scratch4(), name()); |
1446 __ mov(r0, sp); // r0 = Handle<Name> | 1439 __ mov(r0, sp); // r0 = Handle<Name> |
1447 | 1440 |
1448 const int kApiStackSpace = 1; | 1441 const int kApiStackSpace = 1; |
1449 FrameScope frame_scope(masm(), StackFrame::MANUAL); | 1442 FrameScope frame_scope(masm(), StackFrame::MANUAL); |
1450 __ EnterExitFrame(false, kApiStackSpace); | 1443 __ EnterExitFrame(false, kApiStackSpace); |
1451 | 1444 |
1452 // Create AccessorInfo instance on the stack above the exit frame with | 1445 // Create AccessorInfo instance on the stack above the exit frame with |
1453 // scratch2 (internal::Object** args_) as the data. | 1446 // scratch2 (internal::Object** args_) as the data. |
1454 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); | 1447 __ str(scratch2(), MemOperand(sp, 1 * kPointerSize)); |
1455 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& | 1448 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& |
1456 | 1449 |
1457 const int kStackUnwindSpace = kFastApiCallArguments + 1; | 1450 const int kStackUnwindSpace = kFastApiCallArguments + 1; |
1458 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1451 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1459 | 1452 |
1460 ApiFunction fun(getter_address); | 1453 ApiFunction fun(getter_address); |
1461 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 1454 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; |
1462 ExternalReference ref = ExternalReference(&fun, type, isolate()); | 1455 ExternalReference ref = ExternalReference(&fun, type, isolate()); |
1463 | 1456 |
1464 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1457 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
1465 ExternalReference::Type thunk_type = | 1458 ExternalReference::Type thunk_type = |
1466 ExternalReference::PROFILING_GETTER_CALL; | 1459 ExternalReference::PROFILING_GETTER_CALL; |
1467 ApiFunction thunk_fun(thunk_address); | 1460 ApiFunction thunk_fun(thunk_address); |
1468 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 1461 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, |
1469 isolate()); | 1462 isolate()); |
1470 __ CallApiFunctionAndReturn(ref, | 1463 __ CallApiFunctionAndReturn(ref, |
1471 getter_address, | 1464 getter_address, |
1472 thunk_ref, | 1465 thunk_ref, |
1473 r2, | 1466 r2, |
1474 kStackUnwindSpace, | 1467 kStackUnwindSpace, |
1475 6); | 1468 5); |
1476 } | 1469 } |
1477 | 1470 |
1478 | 1471 |
1479 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 1472 void BaseLoadStubCompiler::GenerateLoadInterceptor( |
1480 Register holder_reg, | 1473 Register holder_reg, |
1481 Handle<JSObject> object, | 1474 Handle<JSObject> object, |
1482 Handle<JSObject> interceptor_holder, | 1475 Handle<JSObject> interceptor_holder, |
1483 LookupResult* lookup, | 1476 LookupResult* lookup, |
1484 Handle<Name> name) { | 1477 Handle<Name> name) { |
1485 ASSERT(interceptor_holder->HasNamedInterceptor()); | 1478 ASSERT(interceptor_holder->HasNamedInterceptor()); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); | 1546 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); |
1554 } else { // !compile_followup_inline | 1547 } else { // !compile_followup_inline |
1555 // Call the runtime system to load the interceptor. | 1548 // Call the runtime system to load the interceptor. |
1556 // Check that the maps haven't changed. | 1549 // Check that the maps haven't changed. |
1557 PushInterceptorArguments(masm(), receiver(), holder_reg, | 1550 PushInterceptorArguments(masm(), receiver(), holder_reg, |
1558 this->name(), interceptor_holder); | 1551 this->name(), interceptor_holder); |
1559 | 1552 |
1560 ExternalReference ref = | 1553 ExternalReference ref = |
1561 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), | 1554 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), |
1562 isolate()); | 1555 isolate()); |
1563 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1); | 1556 __ TailCallExternalReference(ref, 6, 1); |
1564 } | 1557 } |
1565 } | 1558 } |
1566 | 1559 |
1567 | 1560 |
1568 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { | 1561 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { |
1569 if (kind_ == Code::KEYED_CALL_IC) { | 1562 if (kind_ == Code::KEYED_CALL_IC) { |
1570 __ cmp(r2, Operand(name)); | 1563 __ cmp(r2, Operand(name)); |
1571 __ b(ne, miss); | 1564 __ b(ne, miss); |
1572 } | 1565 } |
1573 } | 1566 } |
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3172 // ----------------------------------- | 3165 // ----------------------------------- |
3173 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3166 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3174 } | 3167 } |
3175 | 3168 |
3176 | 3169 |
3177 #undef __ | 3170 #undef __ |
3178 | 3171 |
3179 } } // namespace v8::internal | 3172 } } // namespace v8::internal |
3180 | 3173 |
3181 #endif // V8_TARGET_ARCH_ARM | 3174 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |