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

Side by Side Diff: src/mips/simulator-mips.cc

Issue 23604004: MIPS: cleanup api callbacks now that handles are never returned directly (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 | « src/mips/macro-assembler-mips.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 int32_t arg5); 1380 int32_t arg5);
1381 1381
1382 // These prototypes handle the four types of FP calls. 1382 // These prototypes handle the four types of FP calls.
1383 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); 1383 typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1);
1384 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); 1384 typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1);
1385 typedef double (*SimulatorRuntimeFPCall)(double darg0); 1385 typedef double (*SimulatorRuntimeFPCall)(double darg0);
1386 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); 1386 typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0);
1387 1387
1388 // This signature supports direct call in to API function native callback 1388 // This signature supports direct call in to API function native callback
1389 // (refer to InvocationCallback in v8.h). 1389 // (refer to InvocationCallback in v8.h).
1390 // NOTE: the O32 abi requires a0 to hold a special pointer when returning a 1390 typedef void (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1391 // struct from the function (which is currently the case). This means we pass 1391 typedef void (*SimulatorRuntimeProfilingApiCall)(int32_t arg0, int32_t arg1);
1392 // the first argument in a1 instead of a0.
1393 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectApiCall)(int32_t arg0);
1394 // Here, we pass the first argument in a0, because this function
1395 // does not return a struct.
1396 typedef void (*SimulatorRuntimeDirectApiCallNew)(int32_t arg0);
1397 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingApiCall)(
1398 int32_t arg0, int32_t arg1);
1399 typedef void (*SimulatorRuntimeProfilingApiCallNew)(int32_t arg0, int32_t arg1);
1400 1392
1401 // This signature supports direct call to accessor getter callback. 1393 // This signature supports direct call to accessor getter callback.
1402 // See comment at SimulatorRuntimeDirectApiCall. 1394 typedef void (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, int32_t arg1);
1403 typedef v8::Handle<v8::Value> (*SimulatorRuntimeDirectGetterCall)(int32_t arg0, 1395 typedef void (*SimulatorRuntimeProfilingGetterCall)(
1404 int32_t arg1);
1405 // See comment at SimulatorRuntimeDirectApiCallNew.
1406 typedef void (*SimulatorRuntimeDirectGetterCallNew)(int32_t arg0,
1407 int32_t arg1);
1408 typedef v8::Handle<v8::Value> (*SimulatorRuntimeProfilingGetterCall)(
1409 int32_t arg0, int32_t arg1, int32_t arg2);
1410 typedef void (*SimulatorRuntimeProfilingGetterCallNew)(
1411 int32_t arg0, int32_t arg1, int32_t arg2); 1396 int32_t arg0, int32_t arg1, int32_t arg2);
1412 1397
1413 // Software interrupt instructions are used by the simulator to call into the 1398 // Software interrupt instructions are used by the simulator to call into the
1414 // C-based V8 runtime. They are also used for debugging with simulator. 1399 // C-based V8 runtime. They are also used for debugging with simulator.
1415 void Simulator::SoftwareInterrupt(Instruction* instr) { 1400 void Simulator::SoftwareInterrupt(Instruction* instr) {
1416 // There are several instructions that could get us here, 1401 // There are several instructions that could get us here,
1417 // the break_ instruction, or several variants of traps. All 1402 // the break_ instruction, or several variants of traps. All
1418 // Are "SPECIAL" class opcode, and are distinuished by function. 1403 // Are "SPECIAL" class opcode, and are distinuished by function.
1419 int32_t func = instr->FunctionFieldRaw(); 1404 int32_t func = instr->FunctionFieldRaw();
1420 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1; 1405 uint32_t code = (func == BREAK) ? instr->Bits(25, 6) : -1;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 case ExternalReference::BUILTIN_FP_FP_CALL: 1531 case ExternalReference::BUILTIN_FP_FP_CALL:
1547 case ExternalReference::BUILTIN_FP_CALL: 1532 case ExternalReference::BUILTIN_FP_CALL:
1548 case ExternalReference::BUILTIN_FP_INT_CALL: 1533 case ExternalReference::BUILTIN_FP_INT_CALL:
1549 PrintF("Returned %f\n", dresult); 1534 PrintF("Returned %f\n", dresult);
1550 break; 1535 break;
1551 default: 1536 default:
1552 UNREACHABLE(); 1537 UNREACHABLE();
1553 break; 1538 break;
1554 } 1539 }
1555 } 1540 }
1541 } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) {
1542 if (::v8::internal::FLAG_trace_sim) {
1543 PrintF("Call to host function at %p args %08x\n",
1544 reinterpret_cast<void*>(external), arg0);
1545 }
1546 SimulatorRuntimeDirectApiCall target =
1547 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
1548 target(arg0);
1556 } else if ( 1549 } else if (
1557 redirection->type() == ExternalReference::DIRECT_API_CALL || 1550 redirection->type() == ExternalReference::PROFILING_API_CALL) {
1558 redirection->type() == ExternalReference::DIRECT_API_CALL_NEW) { 1551 if (::v8::internal::FLAG_trace_sim) {
1559 if (redirection->type() == ExternalReference::DIRECT_API_CALL) { 1552 PrintF("Call to host function at %p args %08x %08x\n",
1560 // See comment at type definition of SimulatorRuntimeDirectApiCall 1553 reinterpret_cast<void*>(external), arg0, arg1);
1561 // for explanation of register usage.
1562 if (::v8::internal::FLAG_trace_sim) {
1563 PrintF("Call to host function at %p args %08x\n",
1564 reinterpret_cast<void*>(external), arg1);
1565 }
1566 SimulatorRuntimeDirectApiCall target =
1567 reinterpret_cast<SimulatorRuntimeDirectApiCall>(external);
1568 v8::Handle<v8::Value> result = target(arg1);
1569 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result);
1570 set_register(v0, arg0);
1571 } else {
1572 if (::v8::internal::FLAG_trace_sim) {
1573 PrintF("Call to host function at %p args %08x\n",
1574 reinterpret_cast<void*>(external), arg0);
1575 }
1576 SimulatorRuntimeDirectApiCallNew target =
1577 reinterpret_cast<SimulatorRuntimeDirectApiCallNew>(external);
1578 target(arg0);
1579 } 1554 }
1555 SimulatorRuntimeProfilingApiCall target =
1556 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external);
1557 target(arg0, arg1);
1580 } else if ( 1558 } else if (
1581 redirection->type() == ExternalReference::PROFILING_API_CALL || 1559 redirection->type() == ExternalReference::DIRECT_GETTER_CALL) {
1582 redirection->type() == ExternalReference::PROFILING_API_CALL_NEW) { 1560 if (::v8::internal::FLAG_trace_sim) {
1583 if (redirection->type() == ExternalReference::PROFILING_API_CALL) { 1561 PrintF("Call to host function at %p args %08x %08x\n",
1584 // See comment at type definition of SimulatorRuntimeDirectApiCall 1562 reinterpret_cast<void*>(external), arg0, arg1);
1585 // for explanation of register usage.
1586 if (::v8::internal::FLAG_trace_sim) {
1587 PrintF("Call to host function at %p args %08x %08x\n",
1588 reinterpret_cast<void*>(external), arg1, arg2);
1589 }
1590 SimulatorRuntimeProfilingApiCall target =
1591 reinterpret_cast<SimulatorRuntimeProfilingApiCall>(external);
1592 v8::Handle<v8::Value> result = target(arg1, arg2);
1593 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result);
1594 set_register(v0, arg0);
1595 } else {
1596 if (::v8::internal::FLAG_trace_sim) {
1597 PrintF("Call to host function at %p args %08x %08x\n",
1598 reinterpret_cast<void*>(external), arg0, arg1);
1599 }
1600 SimulatorRuntimeProfilingApiCallNew target =
1601 reinterpret_cast<SimulatorRuntimeProfilingApiCallNew>(external);
1602 target(arg0, arg1);
1603 } 1563 }
1564 SimulatorRuntimeDirectGetterCall target =
1565 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
1566 target(arg0, arg1);
1604 } else if ( 1567 } else if (
1605 redirection->type() == ExternalReference::DIRECT_GETTER_CALL || 1568 redirection->type() == ExternalReference::PROFILING_GETTER_CALL) {
1606 redirection->type() == ExternalReference::DIRECT_GETTER_CALL_NEW) { 1569 if (::v8::internal::FLAG_trace_sim) {
1607 if (redirection->type() == ExternalReference::DIRECT_GETTER_CALL) { 1570 PrintF("Call to host function at %p args %08x %08x %08x\n",
1608 // See comment at type definition of SimulatorRuntimeDirectGetterCall 1571 reinterpret_cast<void*>(external), arg0, arg1, arg2);
1609 // for explanation of register usage.
1610 if (::v8::internal::FLAG_trace_sim) {
1611 PrintF("Call to host function at %p args %08x %08x\n",
1612 reinterpret_cast<void*>(external), arg1, arg2);
1613 }
1614 SimulatorRuntimeDirectGetterCall target =
1615 reinterpret_cast<SimulatorRuntimeDirectGetterCall>(external);
1616 v8::Handle<v8::Value> result = target(arg1, arg2);
1617 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result);
1618 set_register(v0, arg0);
1619 } else {
1620 if (::v8::internal::FLAG_trace_sim) {
1621 PrintF("Call to host function at %p args %08x %08x\n",
1622 reinterpret_cast<void*>(external), arg0, arg1);
1623 }
1624 SimulatorRuntimeDirectGetterCallNew target =
1625 reinterpret_cast<SimulatorRuntimeDirectGetterCallNew>(external);
1626 target(arg0, arg1);
1627 } 1572 }
1628 } else if ( 1573 SimulatorRuntimeProfilingGetterCall target =
1629 redirection->type() == ExternalReference::PROFILING_GETTER_CALL || 1574 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external);
1630 redirection->type() == ExternalReference::PROFILING_GETTER_CALL_NEW) { 1575 target(arg0, arg1, arg2);
1631 if (redirection->type() == ExternalReference::PROFILING_GETTER_CALL) {
1632 // See comment at type definition of SimulatorRuntimeProfilingGetterCall
1633 // for explanation of register usage.
1634 if (::v8::internal::FLAG_trace_sim) {
1635 PrintF("Call to host function at %p args %08x %08x %08x\n",
1636 reinterpret_cast<void*>(external), arg1, arg2, arg3);
1637 }
1638 SimulatorRuntimeProfilingGetterCall target =
1639 reinterpret_cast<SimulatorRuntimeProfilingGetterCall>(external);
1640 v8::Handle<v8::Value> result = target(arg1, arg2, arg3);
1641 *(reinterpret_cast<int*>(arg0)) = reinterpret_cast<int32_t>(*result);
1642 set_register(v0, arg0);
1643 } else {
1644 if (::v8::internal::FLAG_trace_sim) {
1645 PrintF("Call to host function at %p args %08x %08x %08x\n",
1646 reinterpret_cast<void*>(external), arg0, arg1, arg2);
1647 }
1648 SimulatorRuntimeProfilingGetterCallNew target =
1649 reinterpret_cast<SimulatorRuntimeProfilingGetterCallNew>(external);
1650 target(arg0, arg1, arg2);
1651 }
1652 } else { 1576 } else {
1653 SimulatorRuntimeCall target = 1577 SimulatorRuntimeCall target =
1654 reinterpret_cast<SimulatorRuntimeCall>(external); 1578 reinterpret_cast<SimulatorRuntimeCall>(external);
1655 if (::v8::internal::FLAG_trace_sim) { 1579 if (::v8::internal::FLAG_trace_sim) {
1656 PrintF( 1580 PrintF(
1657 "Call to host function at %p " 1581 "Call to host function at %p "
1658 "args %08x, %08x, %08x, %08x, %08x, %08x\n", 1582 "args %08x, %08x, %08x, %08x, %08x, %08x\n",
1659 FUNCTION_ADDR(target), 1583 FUNCTION_ADDR(target),
1660 arg0, 1584 arg0,
1661 arg1, 1585 arg1,
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 } 2917 }
2994 2918
2995 2919
2996 #undef UNSUPPORTED 2920 #undef UNSUPPORTED
2997 2921
2998 } } // namespace v8::internal 2922 } } // namespace v8::internal
2999 2923
3000 #endif // USE_SIMULATOR 2924 #endif // USE_SIMULATOR
3001 2925
3002 #endif // V8_TARGET_ARCH_MIPS 2926 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698