| 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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 872   // Prepare arguments. | 872   // Prepare arguments. | 
| 873   __ Addu(a2, sp, Operand(5 * kPointerSize)); | 873   __ Addu(a2, sp, Operand(5 * kPointerSize)); | 
| 874 | 874 | 
| 875   // Allocate the v8::Arguments structure in the arguments' space since | 875   // Allocate the v8::Arguments structure in the arguments' space since | 
| 876   // it's not controlled by GC. | 876   // it's not controlled by GC. | 
| 877   const int kApiStackSpace = 4; | 877   const int kApiStackSpace = 4; | 
| 878 | 878 | 
| 879   FrameScope frame_scope(masm, StackFrame::MANUAL); | 879   FrameScope frame_scope(masm, StackFrame::MANUAL); | 
| 880   __ EnterExitFrame(false, kApiStackSpace); | 880   __ EnterExitFrame(false, kApiStackSpace); | 
| 881 | 881 | 
| 882   // NOTE: the O32 abi requires a0 to hold a special pointer when returning a | 882   // a0 = v8::Arguments& | 
| 883   // struct from the function (which is currently the case). This means we pass |  | 
| 884   // the first argument in a1 instead of a0, if returns_handle is true. |  | 
| 885   // CallApiFunctionAndReturn will set up a0. |  | 
| 886 |  | 
| 887   Address function_address = v8::ToCData<Address>(api_call_info->callback()); |  | 
| 888   // TODO(dcarney): fix signatures using returns_handle |  | 
| 889   const bool returns_handle = false; |  | 
| 890 |  | 
| 891   Register first_arg = returns_handle ? a1 : a0; |  | 
| 892   Register second_arg = returns_handle ? a2 : a1; |  | 
| 893 |  | 
| 894   // first_arg = v8::Arguments& |  | 
| 895   // Arguments is built at sp + 1 (sp is a reserved spot for ra). | 883   // Arguments is built at sp + 1 (sp is a reserved spot for ra). | 
| 896   __ Addu(first_arg, sp, kPointerSize); | 884   __ Addu(a0, sp, kPointerSize); | 
| 897 | 885 | 
| 898   // v8::Arguments::implicit_args_ | 886   // v8::Arguments::implicit_args_ | 
| 899   __ sw(a2, MemOperand(first_arg, 0 * kPointerSize)); | 887   __ sw(a2, MemOperand(a0, 0 * kPointerSize)); | 
| 900   // v8::Arguments::values_ | 888   // v8::Arguments::values_ | 
| 901   __ Addu(t0, a2, Operand(argc * kPointerSize)); | 889   __ Addu(t0, a2, Operand(argc * kPointerSize)); | 
| 902   __ sw(t0, MemOperand(first_arg, 1 * kPointerSize)); | 890   __ sw(t0, MemOperand(a0, 1 * kPointerSize)); | 
| 903   // v8::Arguments::length_ = argc | 891   // v8::Arguments::length_ = argc | 
| 904   __ li(t0, Operand(argc)); | 892   __ li(t0, Operand(argc)); | 
| 905   __ sw(t0, MemOperand(first_arg, 2 * kPointerSize)); | 893   __ sw(t0, MemOperand(a0, 2 * kPointerSize)); | 
| 906   // v8::Arguments::is_construct_call = 0 | 894   // v8::Arguments::is_construct_call = 0 | 
| 907   __ sw(zero_reg, MemOperand(first_arg, 3 * kPointerSize)); | 895   __ sw(zero_reg, MemOperand(a0, 3 * kPointerSize)); | 
| 908 | 896 | 
| 909   const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; | 897   const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; | 
|  | 898   Address function_address = v8::ToCData<Address>(api_call_info->callback()); | 
| 910   ApiFunction fun(function_address); | 899   ApiFunction fun(function_address); | 
| 911   ExternalReference::Type type = | 900   ExternalReference::Type type = ExternalReference::DIRECT_API_CALL; | 
| 912       returns_handle ? |  | 
| 913           ExternalReference::DIRECT_API_CALL : |  | 
| 914           ExternalReference::DIRECT_API_CALL_NEW; |  | 
| 915   ExternalReference ref = | 901   ExternalReference ref = | 
| 916       ExternalReference(&fun, | 902       ExternalReference(&fun, | 
| 917                         type, | 903                         type, | 
| 918                         masm->isolate()); | 904                         masm->isolate()); | 
| 919 |  | 
| 920   Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 905   Address thunk_address = FUNCTION_ADDR(&InvokeFunctionCallback); | 
| 921   ExternalReference::Type thunk_type = | 906   ExternalReference::Type thunk_type = ExternalReference::PROFILING_API_CALL; | 
| 922       returns_handle ? |  | 
| 923           ExternalReference::PROFILING_API_CALL : |  | 
| 924           ExternalReference::PROFILING_API_CALL_NEW; |  | 
| 925   ApiFunction thunk_fun(thunk_address); | 907   ApiFunction thunk_fun(thunk_address); | 
| 926   ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 908   ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 
| 927       masm->isolate()); | 909       masm->isolate()); | 
| 928 | 910 | 
| 929   AllowExternalCallThatCantCauseGC scope(masm); | 911   AllowExternalCallThatCantCauseGC scope(masm); | 
| 930   __ CallApiFunctionAndReturn(ref, | 912   __ CallApiFunctionAndReturn(ref, | 
| 931                               function_address, | 913                               function_address, | 
| 932                               thunk_ref, | 914                               thunk_ref, | 
| 933                               second_arg, | 915                               a1, | 
| 934                               kStackUnwindSpace, | 916                               kStackUnwindSpace, | 
| 935                               returns_handle, |  | 
| 936                               kFastApiCallArguments + 1); | 917                               kFastApiCallArguments + 1); | 
| 937 } | 918 } | 
| 938 | 919 | 
| 939 class CallInterceptorCompiler BASE_EMBEDDED { | 920 class CallInterceptorCompiler BASE_EMBEDDED { | 
| 940  public: | 921  public: | 
| 941   CallInterceptorCompiler(StubCompiler* stub_compiler, | 922   CallInterceptorCompiler(StubCompiler* stub_compiler, | 
| 942                           const ParameterCount& arguments, | 923                           const ParameterCount& arguments, | 
| 943                           Register name, | 924                           Register name, | 
| 944                           Code::ExtraICState extra_ic_state) | 925                           Code::ExtraICState extra_ic_state) | 
| 945       : stub_compiler_(stub_compiler), | 926       : stub_compiler_(stub_compiler), | 
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1410   __ sw(reg, MemOperand(sp, 5 * kPointerSize)); | 1391   __ sw(reg, MemOperand(sp, 5 * kPointerSize)); | 
| 1411   __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); | 1392   __ sw(scratch3(), MemOperand(sp, 4 * kPointerSize)); | 
| 1412   __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 1393   __ LoadRoot(scratch3(), Heap::kUndefinedValueRootIndex); | 
| 1413   __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); | 1394   __ sw(scratch3(), MemOperand(sp, 3 * kPointerSize)); | 
| 1414   __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); | 1395   __ sw(scratch3(), MemOperand(sp, 2 * kPointerSize)); | 
| 1415   __ li(scratch4(), | 1396   __ li(scratch4(), | 
| 1416         Operand(ExternalReference::isolate_address(isolate()))); | 1397         Operand(ExternalReference::isolate_address(isolate()))); | 
| 1417   __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); | 1398   __ sw(scratch4(), MemOperand(sp, 1 * kPointerSize)); | 
| 1418   __ sw(name(), MemOperand(sp, 0 * kPointerSize)); | 1399   __ sw(name(), MemOperand(sp, 0 * kPointerSize)); | 
| 1419 | 1400 | 
| 1420   Address getter_address = v8::ToCData<Address>(callback->getter()); |  | 
| 1421   // TODO(dcarney): fix signatures using returns_handle |  | 
| 1422   const bool returns_handle = false; |  | 
| 1423 |  | 
| 1424   Register first_arg = returns_handle ? a1 : a0; |  | 
| 1425   Register second_arg = returns_handle ? a2 : a1; |  | 
| 1426   Register third_arg = returns_handle ? a3 : a2; |  | 
| 1427 |  | 
| 1428   __ mov(a2, scratch2());  // Saved in case scratch2 == a1. | 1401   __ mov(a2, scratch2());  // Saved in case scratch2 == a1. | 
| 1429   __ mov(first_arg, sp);  // (first argument - see note below) = Handle<Name> | 1402   __ mov(a0, sp);  // (first argument - a0) = Handle<Name> | 
| 1430 |  | 
| 1431   // NOTE: the O32 abi requires a0 to hold a special pointer when returning a |  | 
| 1432   // struct from the function (which is currently the case). This means we pass |  | 
| 1433   // the arguments in a1-a2 instead of a0-a1, if returns_handle is true. |  | 
| 1434   // CallApiFunctionAndReturn will set up a0. |  | 
| 1435 | 1403 | 
| 1436   const int kApiStackSpace = 1; | 1404   const int kApiStackSpace = 1; | 
| 1437   FrameScope frame_scope(masm(), StackFrame::MANUAL); | 1405   FrameScope frame_scope(masm(), StackFrame::MANUAL); | 
| 1438   __ EnterExitFrame(false, kApiStackSpace); | 1406   __ EnterExitFrame(false, kApiStackSpace); | 
| 1439 | 1407 | 
| 1440   // Create AccessorInfo instance on the stack above the exit frame with | 1408   // Create AccessorInfo instance on the stack above the exit frame with | 
| 1441   // scratch2 (internal::Object** args_) as the data. | 1409   // scratch2 (internal::Object** args_) as the data. | 
| 1442   __ sw(a2, MemOperand(sp, kPointerSize)); | 1410   __ sw(a2, MemOperand(sp, kPointerSize)); | 
| 1443   // (second argument - see note above) = AccessorInfo& | 1411   // (second argument - a1) = AccessorInfo& | 
| 1444   __ Addu(second_arg, sp, kPointerSize); | 1412   __ Addu(a1, sp, kPointerSize); | 
| 1445 | 1413 | 
| 1446   const int kStackUnwindSpace = kFastApiCallArguments + 1; | 1414   const int kStackUnwindSpace = kFastApiCallArguments + 1; | 
| 1447 | 1415   Address getter_address = v8::ToCData<Address>(callback->getter()); | 
| 1448   ApiFunction fun(getter_address); | 1416   ApiFunction fun(getter_address); | 
| 1449   ExternalReference::Type type = | 1417   ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; | 
| 1450       returns_handle ? |  | 
| 1451           ExternalReference::DIRECT_GETTER_CALL : |  | 
| 1452           ExternalReference::DIRECT_GETTER_CALL_NEW; |  | 
| 1453   ExternalReference ref = ExternalReference(&fun, type, isolate()); | 1418   ExternalReference ref = ExternalReference(&fun, type, isolate()); | 
| 1454 | 1419 | 
| 1455   Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1420   Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 
| 1456   ExternalReference::Type thunk_type = | 1421   ExternalReference::Type thunk_type = | 
| 1457       ExternalReference::PROFILING_GETTER_CALL_NEW; | 1422       ExternalReference::PROFILING_GETTER_CALL; | 
| 1458   ApiFunction thunk_fun(thunk_address); | 1423   ApiFunction thunk_fun(thunk_address); | 
| 1459   ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 1424   ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 
| 1460       isolate()); | 1425       isolate()); | 
| 1461   __ CallApiFunctionAndReturn(ref, | 1426   __ CallApiFunctionAndReturn(ref, | 
| 1462                               getter_address, | 1427                               getter_address, | 
| 1463                               thunk_ref, | 1428                               thunk_ref, | 
| 1464                               third_arg, | 1429                               a2, | 
| 1465                               kStackUnwindSpace, | 1430                               kStackUnwindSpace, | 
| 1466                               returns_handle, |  | 
| 1467                               5); | 1431                               5); | 
| 1468 } | 1432 } | 
| 1469 | 1433 | 
| 1470 | 1434 | 
| 1471 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 1435 void BaseLoadStubCompiler::GenerateLoadInterceptor( | 
| 1472     Register holder_reg, | 1436     Register holder_reg, | 
| 1473     Handle<JSObject> object, | 1437     Handle<JSObject> object, | 
| 1474     Handle<JSObject> interceptor_holder, | 1438     Handle<JSObject> interceptor_holder, | 
| 1475     LookupResult* lookup, | 1439     LookupResult* lookup, | 
| 1476     Handle<Name> name) { | 1440     Handle<Name> name) { | 
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3205   // ----------------------------------- | 3169   // ----------------------------------- | 
| 3206   TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3170   TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 
| 3207 } | 3171 } | 
| 3208 | 3172 | 
| 3209 | 3173 | 
| 3210 #undef __ | 3174 #undef __ | 
| 3211 | 3175 | 
| 3212 } }  // namespace v8::internal | 3176 } }  // namespace v8::internal | 
| 3213 | 3177 | 
| 3214 #endif  // V8_TARGET_ARCH_MIPS | 3178 #endif  // V8_TARGET_ARCH_MIPS | 
| OLD | NEW | 
|---|