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