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

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

Issue 23513045: MIPS: Refactoring PropertyCallbackInfo & FunctionCallbackInfo, step 1. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | 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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 : CALL_AS_METHOD; 770 : CALL_AS_METHOD;
771 __ InvokeFunction(a1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind); 771 __ InvokeFunction(a1, arguments, JUMP_FUNCTION, NullCallWrapper(), call_kind);
772 } 772 }
773 773
774 774
775 static void PushInterceptorArguments(MacroAssembler* masm, 775 static void PushInterceptorArguments(MacroAssembler* masm,
776 Register receiver, 776 Register receiver,
777 Register holder, 777 Register holder,
778 Register name, 778 Register name,
779 Handle<JSObject> holder_obj) { 779 Handle<JSObject> holder_obj) {
780 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0);
781 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1);
782 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2);
783 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3);
784 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4);
780 __ push(name); 785 __ push(name);
781 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); 786 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
782 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); 787 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
783 Register scratch = name; 788 Register scratch = name;
784 __ li(scratch, Operand(interceptor)); 789 __ li(scratch, Operand(interceptor));
785 __ Push(scratch, receiver, holder); 790 __ Push(scratch, receiver, holder);
786 __ lw(scratch, FieldMemOperand(scratch, InterceptorInfo::kDataOffset));
787 __ push(scratch);
788 __ li(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
789 __ push(scratch);
790 } 791 }
791 792
792 793
793 static void CompileCallLoadPropertyWithInterceptor( 794 static void CompileCallLoadPropertyWithInterceptor(
794 MacroAssembler* masm, 795 MacroAssembler* masm,
795 Register receiver, 796 Register receiver,
796 Register holder, 797 Register holder,
797 Register name, 798 Register name,
798 Handle<JSObject> holder_obj) { 799 Handle<JSObject> holder_obj) {
799 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 800 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
800 801
801 ExternalReference ref = 802 ExternalReference ref =
802 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), 803 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
803 masm->isolate()); 804 masm->isolate());
804 __ PrepareCEntryArgs(6); 805 __ PrepareCEntryArgs(StubCache::kInterceptorArgsLength);
805 __ PrepareCEntryFunction(ref); 806 __ PrepareCEntryFunction(ref);
806 807
807 CEntryStub stub(1); 808 CEntryStub stub(1);
808 __ CallStub(&stub); 809 __ CallStub(&stub);
809 } 810 }
810 811
811 812
812 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; 813 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength;
813 814
814 // Reserves space for the extra arguments to API function in the 815 // Reserves space for the extra arguments to API function in the
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 FrameScope scope(masm, StackFrame::INTERNAL); 1101 FrameScope scope(masm, StackFrame::INTERNAL);
1101 // Save the name_ register across the call. 1102 // Save the name_ register across the call.
1102 __ push(name_); 1103 __ push(name_);
1103 1104
1104 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); 1105 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder);
1105 1106
1106 __ CallExternalReference( 1107 __ CallExternalReference(
1107 ExternalReference( 1108 ExternalReference(
1108 IC_Utility(IC::kLoadPropertyWithInterceptorForCall), 1109 IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
1109 masm->isolate()), 1110 masm->isolate()),
1110 6); 1111 StubCache::kInterceptorArgsLength);
1111 // Restore the name_ register. 1112 // Restore the name_ register.
1112 __ pop(name_); 1113 __ pop(name_);
1113 // Leave the internal frame. 1114 // Leave the internal frame.
1114 } 1115 }
1115 1116
1116 void LoadWithInterceptor(MacroAssembler* masm, 1117 void LoadWithInterceptor(MacroAssembler* masm,
1117 Register receiver, 1118 Register receiver,
1118 Register holder, 1119 Register holder,
1119 Handle<JSObject> holder_obj, 1120 Handle<JSObject> holder_obj,
1120 Register scratch, 1121 Register scratch,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 GenerateFastApiCall( 1409 GenerateFastApiCall(
1409 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1410 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1410 } 1411 }
1411 1412
1412 1413
1413 void BaseLoadStubCompiler::GenerateLoadCallback( 1414 void BaseLoadStubCompiler::GenerateLoadCallback(
1414 Register reg, 1415 Register reg,
1415 Handle<ExecutableAccessorInfo> callback) { 1416 Handle<ExecutableAccessorInfo> callback) {
1416 // Build AccessorInfo::args_ list on the stack and push property name below 1417 // Build AccessorInfo::args_ list on the stack and push property name below
1417 // the exit frame to make GC aware of them and store pointers to them. 1418 // the exit frame to make GC aware of them and store pointers to them.
1419 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0);
1420 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1);
1421 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2);
1422 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3);
1423 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4);
1424 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5);
1425 ASSERT(!scratch2().is(reg));
1426 ASSERT(!scratch3().is(reg));
1427 ASSERT(!scratch4().is(reg));
1418 __ push(receiver()); 1428 __ push(receiver());
1419 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_ 1429 __ mov(scratch2(), sp); // scratch2 = AccessorInfo::args_
1420 if (heap()->InNewSpace(callback->data())) { 1430 if (heap()->InNewSpace(callback->data())) {
1421 __ li(scratch3(), callback); 1431 __ li(scratch3(), callback);
1422 __ lw(scratch3(), FieldMemOperand(scratch3(), 1432 __ lw(scratch3(), FieldMemOperand(scratch3(),
1423 ExecutableAccessorInfo::kDataOffset)); 1433 ExecutableAccessorInfo::kDataOffset));
1424 } else { 1434 } else {
1425 __ li(scratch3(), Handle<Object>(callback->data(), isolate())); 1435 __ li(scratch3(), Handle<Object>(callback->data(), isolate()));
1426 } 1436 }
1427 __ Subu(sp, sp, 6 * kPointerSize); 1437 __ Subu(sp, sp, 6 * kPointerSize);
1428 __ sw(reg, MemOperand(sp, 5 * kPointerSize)); 1438 __ sw(scratch3(), MemOperand(sp, 5 * kPointerSize));
1439 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
1429 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); 1440 __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize));
1430 __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex);
1431 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); 1441 __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize));
1432 __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize));
1433 __ li(scratch4(), 1442 __ li(scratch4(),
1434 Operand(ExternalReference::isolate_address(isolate()))); 1443 Operand(ExternalReference::isolate_address(isolate())));
1435 __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); 1444 __ sw(scratch4(), MemOperand(sp, 2 * kPointerSize));
1445 __ sw(reg, MemOperand(sp, 1 * kPointerSize));
1436 __ sw(name(), MemOperand(sp, 0 * kPointerSize)); 1446 __ sw(name(), MemOperand(sp, 0 * kPointerSize));
1437 1447
1438 __ mov(a2, scratch2()); // Saved in case scratch2 == a1. 1448 __ mov(a2, scratch2()); // Saved in case scratch2 == a1.
1439 __ mov(a0, sp); // (first argument - a0) = Handle<Name> 1449 __ mov(a0, sp); // (first argument - a0) = 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
(...skipping 12 matching lines...) Expand all
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 a2, 1476 a2,
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 } 1553 }
1544 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup); 1554 GenerateLoadPostInterceptor(holder_reg, interceptor_holder, name, lookup);
1545 } else { // !compile_followup_inline 1555 } else { // !compile_followup_inline
1546 // Call the runtime system to load the interceptor. 1556 // Call the runtime system to load the interceptor.
1547 // Check that the maps haven't changed. 1557 // Check that the maps haven't changed.
1548 PushInterceptorArguments(masm(), receiver(), holder_reg, 1558 PushInterceptorArguments(masm(), receiver(), holder_reg,
1549 this->name(), interceptor_holder); 1559 this->name(), interceptor_holder);
1550 1560
1551 ExternalReference ref = ExternalReference( 1561 ExternalReference ref = ExternalReference(
1552 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); 1562 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
1553 __ TailCallExternalReference(ref, 6, 1); 1563 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1);
1554 } 1564 }
1555 } 1565 }
1556 1566
1557 1567
1558 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { 1568 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) {
1559 if (kind_ == Code::KEYED_CALL_IC) { 1569 if (kind_ == Code::KEYED_CALL_IC) {
1560 __ Branch(miss, ne, a2, Operand(name)); 1570 __ Branch(miss, ne, a2, Operand(name));
1561 } 1571 }
1562 } 1572 }
1563 1573
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 // ----------------------------------- 3194 // -----------------------------------
3185 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3195 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3186 } 3196 }
3187 3197
3188 3198
3189 #undef __ 3199 #undef __
3190 3200
3191 } } // namespace v8::internal 3201 } } // namespace v8::internal
3192 3202
3193 #endif // V8_TARGET_ARCH_MIPS 3203 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698