OLD | NEW |
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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 isolate()->counters()->call_normal_stubs()->Increment(); | 1501 isolate()->counters()->call_normal_stubs()->Increment(); |
1502 PROFILE(isolate(), | 1502 PROFILE(isolate(), |
1503 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), | 1503 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), |
1504 *code, code->arguments_count())); | 1504 *code, code->arguments_count())); |
1505 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code)); | 1505 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code)); |
1506 return code; | 1506 return code; |
1507 } | 1507 } |
1508 | 1508 |
1509 | 1509 |
1510 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { | 1510 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { |
1511 CALL_HEAP_FUNCTION(isolate(), | |
1512 (set_failure(NULL), TryCompileCallMegamorphic(flags)), | |
1513 Code); | |
1514 } | |
1515 | |
1516 | |
1517 MaybeObject* StubCompiler::TryCompileCallMegamorphic(Code::Flags flags) { | |
1518 HandleScope scope(isolate()); | |
1519 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1511 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1520 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1512 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1521 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1513 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1522 if (kind == Code::CALL_IC) { | 1514 if (kind == Code::CALL_IC) { |
1523 CallIC::GenerateMegamorphic(masm(), argc, extra_state); | 1515 CallIC::GenerateMegamorphic(masm(), argc, extra_state); |
1524 } else { | 1516 } else { |
1525 KeyedCallIC::GenerateMegamorphic(masm(), argc); | 1517 KeyedCallIC::GenerateMegamorphic(masm(), argc); |
1526 } | 1518 } |
1527 Object* result; | 1519 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic"); |
1528 { MaybeObject* maybe_result = | |
1529 TryGetCodeWithFlags(flags, "CompileCallMegamorphic"); | |
1530 if (!maybe_result->ToObject(&result)) return maybe_result; | |
1531 } | |
1532 isolate()->counters()->call_megamorphic_stubs()->Increment(); | 1520 isolate()->counters()->call_megamorphic_stubs()->Increment(); |
1533 Code* code = Code::cast(result); | |
1534 USE(code); | |
1535 PROFILE(isolate(), | 1521 PROFILE(isolate(), |
1536 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | 1522 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), |
1537 code, code->arguments_count())); | 1523 *code, code->arguments_count())); |
1538 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); | 1524 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); |
1539 return result; | 1525 return code; |
1540 } | 1526 } |
1541 | 1527 |
1542 | 1528 |
1543 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { | 1529 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { |
1544 CALL_HEAP_FUNCTION(isolate(), | 1530 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1545 (set_failure(NULL), TryCompileCallArguments(flags)), | 1531 KeyedCallIC::GenerateNonStrictArguments(masm(), argc); |
1546 Code); | 1532 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallArguments"); |
| 1533 PROFILE(isolate(), |
| 1534 CodeCreateEvent(CALL_LOGGER_TAG(Code::ExtractKindFromFlags(flags), |
| 1535 CALL_MEGAMORPHIC_TAG), |
| 1536 *code, code->arguments_count())); |
| 1537 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); |
| 1538 return code; |
1547 } | 1539 } |
1548 | 1540 |
1549 | 1541 |
1550 MaybeObject* StubCompiler::TryCompileCallArguments(Code::Flags flags) { | |
1551 HandleScope scope(isolate()); | |
1552 int argc = Code::ExtractArgumentsCountFromFlags(flags); | |
1553 KeyedCallIC::GenerateNonStrictArguments(masm(), argc); | |
1554 Code::Kind kind = Code::ExtractKindFromFlags(flags); | |
1555 Object* result; | |
1556 { MaybeObject* maybe_result = | |
1557 TryGetCodeWithFlags(flags, "CompileCallArguments"); | |
1558 if (!maybe_result->ToObject(&result)) return maybe_result; | |
1559 } | |
1560 Code* code = Code::cast(result); | |
1561 USE(code); | |
1562 PROFILE(isolate(), | |
1563 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | |
1564 code, code->arguments_count())); | |
1565 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); | |
1566 return result; | |
1567 } | |
1568 | |
1569 | |
1570 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { | 1542 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { |
1571 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1543 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1572 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1544 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1573 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1545 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1574 if (kind == Code::CALL_IC) { | 1546 if (kind == Code::CALL_IC) { |
1575 CallIC::GenerateMiss(masm(), argc, extra_state); | 1547 CallIC::GenerateMiss(masm(), argc, extra_state); |
1576 } else { | 1548 } else { |
1577 KeyedCallIC::GenerateMiss(masm(), argc); | 1549 KeyedCallIC::GenerateMiss(masm(), argc); |
1578 } | 1550 } |
1579 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss"); | 1551 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss"); |
(...skipping 28 matching lines...) Expand all Loading... |
1608 PROFILE(isolate(), | 1580 PROFILE(isolate(), |
1609 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), | 1581 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), |
1610 code, code->arguments_count())); | 1582 code, code->arguments_count())); |
1611 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code))); | 1583 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code))); |
1612 return result; | 1584 return result; |
1613 } | 1585 } |
1614 | 1586 |
1615 | 1587 |
1616 #ifdef ENABLE_DEBUGGER_SUPPORT | 1588 #ifdef ENABLE_DEBUGGER_SUPPORT |
1617 Handle<Code> StubCompiler::CompileCallDebugBreak(Code::Flags flags) { | 1589 Handle<Code> StubCompiler::CompileCallDebugBreak(Code::Flags flags) { |
1618 CALL_HEAP_FUNCTION(isolate(), | |
1619 (set_failure(NULL), TryCompileCallDebugBreak(flags)), | |
1620 Code); | |
1621 } | |
1622 | |
1623 | |
1624 MaybeObject* StubCompiler::TryCompileCallDebugBreak(Code::Flags flags) { | |
1625 HandleScope scope(isolate()); | |
1626 Debug::GenerateCallICDebugBreak(masm()); | 1590 Debug::GenerateCallICDebugBreak(masm()); |
1627 Object* result; | 1591 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallDebugBreak"); |
1628 { MaybeObject* maybe_result = | |
1629 TryGetCodeWithFlags(flags, "CompileCallDebugBreak"); | |
1630 if (!maybe_result->ToObject(&result)) return maybe_result; | |
1631 } | |
1632 Code* code = Code::cast(result); | |
1633 USE(code); | |
1634 Code::Kind kind = Code::ExtractKindFromFlags(flags); | |
1635 USE(kind); | |
1636 PROFILE(isolate(), | 1592 PROFILE(isolate(), |
1637 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_DEBUG_BREAK_TAG), | 1593 CodeCreateEvent(CALL_LOGGER_TAG(Code::ExtractKindFromFlags(flags), |
1638 code, code->arguments_count())); | 1594 CALL_DEBUG_BREAK_TAG), |
1639 return result; | 1595 *code, code->arguments_count())); |
| 1596 return code; |
1640 } | 1597 } |
1641 | 1598 |
1642 | 1599 |
1643 Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { | 1600 Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { |
1644 CALL_HEAP_FUNCTION( | 1601 // Use the same code for the the step in preparations as we do for the |
1645 isolate(), | 1602 // miss case. |
1646 (set_failure(NULL), TryCompileCallDebugPrepareStepIn(flags)), | |
1647 Code); | |
1648 } | |
1649 | |
1650 | |
1651 MaybeObject* StubCompiler::TryCompileCallDebugPrepareStepIn(Code::Flags flags) { | |
1652 HandleScope scope(isolate()); | |
1653 // Use the same code for the the step in preparations as we do for | |
1654 // the miss case. | |
1655 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1603 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1656 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1604 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1657 if (kind == Code::CALL_IC) { | 1605 if (kind == Code::CALL_IC) { |
1658 // For the debugger extra ic state is irrelevant. | 1606 // For the debugger extra ic state is irrelevant. |
1659 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); | 1607 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); |
1660 } else { | 1608 } else { |
1661 KeyedCallIC::GenerateMiss(masm(), argc); | 1609 KeyedCallIC::GenerateMiss(masm(), argc); |
1662 } | 1610 } |
1663 Object* result; | 1611 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); |
1664 { MaybeObject* maybe_result = | |
1665 TryGetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); | |
1666 if (!maybe_result->ToObject(&result)) return maybe_result; | |
1667 } | |
1668 Code* code = Code::cast(result); | |
1669 USE(code); | |
1670 PROFILE(isolate(), | 1612 PROFILE(isolate(), |
1671 CodeCreateEvent( | 1613 CodeCreateEvent( |
1672 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), | 1614 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), |
1673 code, | 1615 *code, |
1674 code->arguments_count())); | 1616 code->arguments_count())); |
1675 return result; | 1617 return code; |
1676 } | 1618 } |
1677 #endif | 1619 #endif // ENABLE_DEBUGGER_SUPPORT |
1678 | 1620 |
1679 #undef CALL_LOGGER_TAG | 1621 #undef CALL_LOGGER_TAG |
1680 | 1622 |
| 1623 |
1681 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, | 1624 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, |
1682 const char* name) { | 1625 const char* name) { |
1683 // Create code object in the heap. | 1626 // Create code object in the heap. |
1684 CodeDesc desc; | 1627 CodeDesc desc; |
1685 masm_.GetCode(&desc); | 1628 masm_.GetCode(&desc); |
1686 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject()); | 1629 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject()); |
1687 #ifdef ENABLE_DISASSEMBLER | 1630 #ifdef ENABLE_DISASSEMBLER |
1688 if (FLAG_print_code_stubs) code->Disassemble(name); | 1631 if (FLAG_print_code_stubs) code->Disassemble(name); |
1689 #endif | 1632 #endif |
1690 return code; | 1633 return code; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 expected_receiver_type_ = | 1909 expected_receiver_type_ = |
1967 FunctionTemplateInfo::cast(signature->receiver()); | 1910 FunctionTemplateInfo::cast(signature->receiver()); |
1968 } | 1911 } |
1969 } | 1912 } |
1970 | 1913 |
1971 is_simple_api_call_ = true; | 1914 is_simple_api_call_ = true; |
1972 } | 1915 } |
1973 | 1916 |
1974 | 1917 |
1975 } } // namespace v8::internal | 1918 } } // namespace v8::internal |
OLD | NEW |