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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 | 1395 |
1396 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor) { | 1396 RUNTIME_FUNCTION(MaybeObject*, KeyedLoadPropertyWithInterceptor) { |
1397 JSObject* receiver = JSObject::cast(args[0]); | 1397 JSObject* receiver = JSObject::cast(args[0]); |
1398 ASSERT(args.smi_at(1) >= 0); | 1398 ASSERT(args.smi_at(1) >= 0); |
1399 uint32_t index = args.smi_at(1); | 1399 uint32_t index = args.smi_at(1); |
1400 return receiver->GetElementWithInterceptor(receiver, index); | 1400 return receiver->GetElementWithInterceptor(receiver, index); |
1401 } | 1401 } |
1402 | 1402 |
1403 | 1403 |
1404 Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) { | 1404 Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) { |
1405 CALL_HEAP_FUNCTION(isolate(), | |
1406 (set_failure(NULL), TryCompileCallInitialize(flags)), | |
1407 Code); | |
1408 } | |
1409 | |
1410 | |
1411 MaybeObject* StubCompiler::TryCompileCallInitialize(Code::Flags flags) { | |
1412 HandleScope scope(isolate()); | |
1413 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1405 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1414 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1406 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1415 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1407 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1416 if (kind == Code::CALL_IC) { | 1408 if (kind == Code::CALL_IC) { |
1417 CallIC::GenerateInitialize(masm(), argc, extra_state); | 1409 CallIC::GenerateInitialize(masm(), argc, extra_state); |
1418 } else { | 1410 } else { |
1419 KeyedCallIC::GenerateInitialize(masm(), argc); | 1411 KeyedCallIC::GenerateInitialize(masm(), argc); |
1420 } | 1412 } |
1421 Object* result; | 1413 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallInitialize"); |
1422 { MaybeObject* maybe_result = | |
1423 GetCodeWithFlags(flags, "CompileCallInitialize"); | |
1424 if (!maybe_result->ToObject(&result)) return maybe_result; | |
1425 } | |
1426 isolate()->counters()->call_initialize_stubs()->Increment(); | 1414 isolate()->counters()->call_initialize_stubs()->Increment(); |
1427 Code* code = Code::cast(result); | |
1428 USE(code); | |
1429 PROFILE(isolate(), | 1415 PROFILE(isolate(), |
1430 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), | 1416 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), |
1431 code, code->arguments_count())); | 1417 *code, code->arguments_count())); |
1432 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, Code::cast(code))); | 1418 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code)); |
1433 return result; | 1419 return code; |
1434 } | 1420 } |
1435 | 1421 |
1436 | 1422 |
1437 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { | 1423 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { |
1438 CALL_HEAP_FUNCTION(isolate(), | 1424 CALL_HEAP_FUNCTION(isolate(), |
1439 (set_failure(NULL), TryCompileCallPreMonomorphic(flags)), | 1425 (set_failure(NULL), TryCompileCallPreMonomorphic(flags)), |
1440 Code); | 1426 Code); |
1441 } | 1427 } |
1442 | 1428 |
1443 | 1429 |
1444 MaybeObject* StubCompiler::TryCompileCallPreMonomorphic(Code::Flags flags) { | 1430 MaybeObject* StubCompiler::TryCompileCallPreMonomorphic(Code::Flags flags) { |
1445 HandleScope scope(isolate()); | 1431 HandleScope scope(isolate()); |
1446 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1432 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1447 // The code of the PreMonomorphic stub is the same as the code | 1433 // The code of the PreMonomorphic stub is the same as the code |
1448 // of the Initialized stub. They just differ on the code object flags. | 1434 // of the Initialized stub. They just differ on the code object flags. |
1449 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1435 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1450 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1436 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1451 if (kind == Code::CALL_IC) { | 1437 if (kind == Code::CALL_IC) { |
1452 CallIC::GenerateInitialize(masm(), argc, extra_state); | 1438 CallIC::GenerateInitialize(masm(), argc, extra_state); |
1453 } else { | 1439 } else { |
1454 KeyedCallIC::GenerateInitialize(masm(), argc); | 1440 KeyedCallIC::GenerateInitialize(masm(), argc); |
1455 } | 1441 } |
1456 Object* result; | 1442 Object* result; |
1457 { MaybeObject* maybe_result = | 1443 { MaybeObject* maybe_result = |
1458 GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); | 1444 TryGetCodeWithFlags(flags, "CompileCallPreMonomorphic"); |
1459 if (!maybe_result->ToObject(&result)) return maybe_result; | 1445 if (!maybe_result->ToObject(&result)) return maybe_result; |
1460 } | 1446 } |
1461 isolate()->counters()->call_premonomorphic_stubs()->Increment(); | 1447 isolate()->counters()->call_premonomorphic_stubs()->Increment(); |
1462 Code* code = Code::cast(result); | 1448 Code* code = Code::cast(result); |
1463 USE(code); | 1449 USE(code); |
1464 PROFILE(isolate(), | 1450 PROFILE(isolate(), |
1465 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), | 1451 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), |
1466 code, code->arguments_count())); | 1452 code, code->arguments_count())); |
1467 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, Code::cast(code))); | 1453 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, Code::cast(code))); |
1468 return result; | 1454 return result; |
(...skipping 13 matching lines...) Expand all Loading... |
1482 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1468 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1483 if (kind == Code::CALL_IC) { | 1469 if (kind == Code::CALL_IC) { |
1484 // Call normal is always with a explict receiver. | 1470 // Call normal is always with a explict receiver. |
1485 ASSERT(!CallIC::Contextual::decode( | 1471 ASSERT(!CallIC::Contextual::decode( |
1486 Code::ExtractExtraICStateFromFlags(flags))); | 1472 Code::ExtractExtraICStateFromFlags(flags))); |
1487 CallIC::GenerateNormal(masm(), argc); | 1473 CallIC::GenerateNormal(masm(), argc); |
1488 } else { | 1474 } else { |
1489 KeyedCallIC::GenerateNormal(masm(), argc); | 1475 KeyedCallIC::GenerateNormal(masm(), argc); |
1490 } | 1476 } |
1491 Object* result; | 1477 Object* result; |
1492 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallNormal"); | 1478 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "CompileCallNormal"); |
1493 if (!maybe_result->ToObject(&result)) return maybe_result; | 1479 if (!maybe_result->ToObject(&result)) return maybe_result; |
1494 } | 1480 } |
1495 isolate()->counters()->call_normal_stubs()->Increment(); | 1481 isolate()->counters()->call_normal_stubs()->Increment(); |
1496 Code* code = Code::cast(result); | 1482 Code* code = Code::cast(result); |
1497 USE(code); | 1483 USE(code); |
1498 PROFILE(isolate(), | 1484 PROFILE(isolate(), |
1499 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), | 1485 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), |
1500 code, code->arguments_count())); | 1486 code, code->arguments_count())); |
1501 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, Code::cast(code))); | 1487 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, Code::cast(code))); |
1502 return result; | 1488 return result; |
(...skipping 12 matching lines...) Expand all Loading... |
1515 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1501 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1516 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1502 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1517 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1503 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1518 if (kind == Code::CALL_IC) { | 1504 if (kind == Code::CALL_IC) { |
1519 CallIC::GenerateMegamorphic(masm(), argc, extra_state); | 1505 CallIC::GenerateMegamorphic(masm(), argc, extra_state); |
1520 } else { | 1506 } else { |
1521 KeyedCallIC::GenerateMegamorphic(masm(), argc); | 1507 KeyedCallIC::GenerateMegamorphic(masm(), argc); |
1522 } | 1508 } |
1523 Object* result; | 1509 Object* result; |
1524 { MaybeObject* maybe_result = | 1510 { MaybeObject* maybe_result = |
1525 GetCodeWithFlags(flags, "CompileCallMegamorphic"); | 1511 TryGetCodeWithFlags(flags, "CompileCallMegamorphic"); |
1526 if (!maybe_result->ToObject(&result)) return maybe_result; | 1512 if (!maybe_result->ToObject(&result)) return maybe_result; |
1527 } | 1513 } |
1528 isolate()->counters()->call_megamorphic_stubs()->Increment(); | 1514 isolate()->counters()->call_megamorphic_stubs()->Increment(); |
1529 Code* code = Code::cast(result); | 1515 Code* code = Code::cast(result); |
1530 USE(code); | 1516 USE(code); |
1531 PROFILE(isolate(), | 1517 PROFILE(isolate(), |
1532 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | 1518 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), |
1533 code, code->arguments_count())); | 1519 code, code->arguments_count())); |
1534 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); | 1520 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); |
1535 return result; | 1521 return result; |
1536 } | 1522 } |
1537 | 1523 |
1538 | 1524 |
1539 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { | 1525 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { |
1540 CALL_HEAP_FUNCTION(isolate(), | 1526 CALL_HEAP_FUNCTION(isolate(), |
1541 (set_failure(NULL), TryCompileCallArguments(flags)), | 1527 (set_failure(NULL), TryCompileCallArguments(flags)), |
1542 Code); | 1528 Code); |
1543 } | 1529 } |
1544 | 1530 |
1545 | 1531 |
1546 MaybeObject* StubCompiler::TryCompileCallArguments(Code::Flags flags) { | 1532 MaybeObject* StubCompiler::TryCompileCallArguments(Code::Flags flags) { |
1547 HandleScope scope(isolate()); | 1533 HandleScope scope(isolate()); |
1548 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1534 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1549 KeyedCallIC::GenerateNonStrictArguments(masm(), argc); | 1535 KeyedCallIC::GenerateNonStrictArguments(masm(), argc); |
1550 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1536 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1551 Object* result; | 1537 Object* result; |
1552 { MaybeObject* maybe_result = | 1538 { MaybeObject* maybe_result = |
1553 GetCodeWithFlags(flags, "CompileCallArguments"); | 1539 TryGetCodeWithFlags(flags, "CompileCallArguments"); |
1554 if (!maybe_result->ToObject(&result)) return maybe_result; | 1540 if (!maybe_result->ToObject(&result)) return maybe_result; |
1555 } | 1541 } |
1556 Code* code = Code::cast(result); | 1542 Code* code = Code::cast(result); |
1557 USE(code); | 1543 USE(code); |
1558 PROFILE(isolate(), | 1544 PROFILE(isolate(), |
1559 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | 1545 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), |
1560 code, code->arguments_count())); | 1546 code, code->arguments_count())); |
1561 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); | 1547 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); |
1562 return result; | 1548 return result; |
1563 } | 1549 } |
(...skipping 10 matching lines...) Expand all Loading... |
1574 HandleScope scope(isolate()); | 1560 HandleScope scope(isolate()); |
1575 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1561 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1576 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1562 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1577 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1563 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
1578 if (kind == Code::CALL_IC) { | 1564 if (kind == Code::CALL_IC) { |
1579 CallIC::GenerateMiss(masm(), argc, extra_state); | 1565 CallIC::GenerateMiss(masm(), argc, extra_state); |
1580 } else { | 1566 } else { |
1581 KeyedCallIC::GenerateMiss(masm(), argc); | 1567 KeyedCallIC::GenerateMiss(masm(), argc); |
1582 } | 1568 } |
1583 Object* result; | 1569 Object* result; |
1584 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallMiss"); | 1570 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "CompileCallMiss"); |
1585 if (!maybe_result->ToObject(&result)) return maybe_result; | 1571 if (!maybe_result->ToObject(&result)) return maybe_result; |
1586 } | 1572 } |
1587 isolate()->counters()->call_megamorphic_stubs()->Increment(); | 1573 isolate()->counters()->call_megamorphic_stubs()->Increment(); |
1588 Code* code = Code::cast(result); | 1574 Code* code = Code::cast(result); |
1589 USE(code); | 1575 USE(code); |
1590 PROFILE(isolate(), | 1576 PROFILE(isolate(), |
1591 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), | 1577 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), |
1592 code, code->arguments_count())); | 1578 code, code->arguments_count())); |
1593 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code))); | 1579 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, Code::cast(code))); |
1594 return result; | 1580 return result; |
1595 } | 1581 } |
1596 | 1582 |
1597 | 1583 |
1598 #ifdef ENABLE_DEBUGGER_SUPPORT | 1584 #ifdef ENABLE_DEBUGGER_SUPPORT |
1599 Handle<Code> StubCompiler::CompileCallDebugBreak(Code::Flags flags) { | 1585 Handle<Code> StubCompiler::CompileCallDebugBreak(Code::Flags flags) { |
1600 CALL_HEAP_FUNCTION(isolate(), | 1586 CALL_HEAP_FUNCTION(isolate(), |
1601 (set_failure(NULL), TryCompileCallDebugBreak(flags)), | 1587 (set_failure(NULL), TryCompileCallDebugBreak(flags)), |
1602 Code); | 1588 Code); |
1603 } | 1589 } |
1604 | 1590 |
1605 | 1591 |
1606 MaybeObject* StubCompiler::TryCompileCallDebugBreak(Code::Flags flags) { | 1592 MaybeObject* StubCompiler::TryCompileCallDebugBreak(Code::Flags flags) { |
1607 HandleScope scope(isolate()); | 1593 HandleScope scope(isolate()); |
1608 Debug::GenerateCallICDebugBreak(masm()); | 1594 Debug::GenerateCallICDebugBreak(masm()); |
1609 Object* result; | 1595 Object* result; |
1610 { MaybeObject* maybe_result = | 1596 { MaybeObject* maybe_result = |
1611 GetCodeWithFlags(flags, "CompileCallDebugBreak"); | 1597 TryGetCodeWithFlags(flags, "CompileCallDebugBreak"); |
1612 if (!maybe_result->ToObject(&result)) return maybe_result; | 1598 if (!maybe_result->ToObject(&result)) return maybe_result; |
1613 } | 1599 } |
1614 Code* code = Code::cast(result); | 1600 Code* code = Code::cast(result); |
1615 USE(code); | 1601 USE(code); |
1616 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1602 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1617 USE(kind); | 1603 USE(kind); |
1618 PROFILE(isolate(), | 1604 PROFILE(isolate(), |
1619 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_DEBUG_BREAK_TAG), | 1605 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_DEBUG_BREAK_TAG), |
1620 code, code->arguments_count())); | 1606 code, code->arguments_count())); |
1621 return result; | 1607 return result; |
(...skipping 15 matching lines...) Expand all Loading... |
1637 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1623 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
1638 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1624 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
1639 if (kind == Code::CALL_IC) { | 1625 if (kind == Code::CALL_IC) { |
1640 // For the debugger extra ic state is irrelevant. | 1626 // For the debugger extra ic state is irrelevant. |
1641 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); | 1627 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); |
1642 } else { | 1628 } else { |
1643 KeyedCallIC::GenerateMiss(masm(), argc); | 1629 KeyedCallIC::GenerateMiss(masm(), argc); |
1644 } | 1630 } |
1645 Object* result; | 1631 Object* result; |
1646 { MaybeObject* maybe_result = | 1632 { MaybeObject* maybe_result = |
1647 GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); | 1633 TryGetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); |
1648 if (!maybe_result->ToObject(&result)) return maybe_result; | 1634 if (!maybe_result->ToObject(&result)) return maybe_result; |
1649 } | 1635 } |
1650 Code* code = Code::cast(result); | 1636 Code* code = Code::cast(result); |
1651 USE(code); | 1637 USE(code); |
1652 PROFILE(isolate(), | 1638 PROFILE(isolate(), |
1653 CodeCreateEvent( | 1639 CodeCreateEvent( |
1654 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), | 1640 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), |
1655 code, | 1641 code, |
1656 code->arguments_count())); | 1642 code->arguments_count())); |
1657 return result; | 1643 return result; |
1658 } | 1644 } |
1659 #endif | 1645 #endif |
1660 | 1646 |
1661 #undef CALL_LOGGER_TAG | 1647 #undef CALL_LOGGER_TAG |
1662 | 1648 |
1663 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, | 1649 Handle<Code> StubCompiler::GetCodeWithFlags(Code::Flags flags, |
1664 const char* name) { | 1650 const char* name) { |
| 1651 // Create code object in the heap. |
| 1652 CodeDesc desc; |
| 1653 masm_.GetCode(&desc); |
| 1654 Handle<Code> code = factory()->NewCode(desc, flags, masm_.CodeObject()); |
| 1655 #ifdef ENABLE_DISASSEMBLER |
| 1656 if (FLAG_print_code_stubs) code->Disassemble(name); |
| 1657 #endif |
| 1658 return code; |
| 1659 } |
| 1660 |
| 1661 |
| 1662 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags, |
| 1663 const char* name) { |
1665 // Check for allocation failures during stub compilation. | 1664 // Check for allocation failures during stub compilation. |
1666 if (failure_->IsFailure()) return failure_; | 1665 if (failure_->IsFailure()) return failure_; |
1667 | 1666 |
1668 // Create code object in the heap. | 1667 // Create code object in the heap. |
1669 CodeDesc desc; | 1668 CodeDesc desc; |
1670 masm_.GetCode(&desc); | 1669 masm_.GetCode(&desc); |
1671 MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject()); | 1670 MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject()); |
1672 #ifdef ENABLE_DISASSEMBLER | 1671 #ifdef ENABLE_DISASSEMBLER |
1673 if (FLAG_print_code_stubs && !result->IsFailure()) { | 1672 if (FLAG_print_code_stubs && !result->IsFailure()) { |
1674 Code::cast(result->ToObjectUnchecked())->Disassemble(name); | 1673 Code::cast(result->ToObjectUnchecked())->Disassemble(name); |
1675 } | 1674 } |
1676 #endif | 1675 #endif |
1677 return result; | 1676 return result; |
1678 } | 1677 } |
1679 | 1678 |
1680 | 1679 |
1681 MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags, String* name) { | 1680 MaybeObject* StubCompiler::TryGetCodeWithFlags(Code::Flags flags, |
| 1681 String* name) { |
1682 if (FLAG_print_code_stubs && (name != NULL)) { | 1682 if (FLAG_print_code_stubs && (name != NULL)) { |
1683 return GetCodeWithFlags(flags, *name->ToCString()); | 1683 return TryGetCodeWithFlags(flags, *name->ToCString()); |
1684 } | 1684 } |
1685 return GetCodeWithFlags(flags, reinterpret_cast<char*>(NULL)); | 1685 return TryGetCodeWithFlags(flags, reinterpret_cast<char*>(NULL)); |
1686 } | 1686 } |
1687 | 1687 |
1688 | 1688 |
1689 void StubCompiler::LookupPostInterceptor(JSObject* holder, | 1689 void StubCompiler::LookupPostInterceptor(JSObject* holder, |
1690 String* name, | 1690 String* name, |
1691 LookupResult* lookup) { | 1691 LookupResult* lookup) { |
1692 holder->LocalLookupRealNamedProperty(name, lookup); | 1692 holder->LocalLookupRealNamedProperty(name, lookup); |
1693 if (!lookup->IsProperty()) { | 1693 if (!lookup->IsProperty()) { |
1694 lookup->NotFound(); | 1694 lookup->NotFound(); |
1695 Object* proto = holder->GetPrototype(); | 1695 Object* proto = holder->GetPrototype(); |
1696 if (!proto->IsNull()) { | 1696 if (!proto->IsNull()) { |
1697 proto->Lookup(name, lookup); | 1697 proto->Lookup(name, lookup); |
1698 } | 1698 } |
1699 } | 1699 } |
1700 } | 1700 } |
1701 | 1701 |
1702 | 1702 |
1703 | 1703 |
1704 MaybeObject* LoadStubCompiler::GetCode(PropertyType type, String* name) { | 1704 MaybeObject* LoadStubCompiler::GetCode(PropertyType type, String* name) { |
1705 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); | 1705 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); |
1706 MaybeObject* result = GetCodeWithFlags(flags, name); | 1706 MaybeObject* result = TryGetCodeWithFlags(flags, name); |
1707 if (!result->IsFailure()) { | 1707 if (!result->IsFailure()) { |
1708 PROFILE(isolate(), | 1708 PROFILE(isolate(), |
1709 CodeCreateEvent(Logger::LOAD_IC_TAG, | 1709 CodeCreateEvent(Logger::LOAD_IC_TAG, |
1710 Code::cast(result->ToObjectUnchecked()), | 1710 Code::cast(result->ToObjectUnchecked()), |
1711 name)); | 1711 name)); |
1712 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, | 1712 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, |
1713 name, | 1713 name, |
1714 Code::cast(result->ToObjectUnchecked()))); | 1714 Code::cast(result->ToObjectUnchecked()))); |
1715 } | 1715 } |
1716 return result; | 1716 return result; |
1717 } | 1717 } |
1718 | 1718 |
1719 | 1719 |
1720 MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, | 1720 MaybeObject* KeyedLoadStubCompiler::GetCode(PropertyType type, |
1721 String* name, | 1721 String* name, |
1722 InlineCacheState state) { | 1722 InlineCacheState state) { |
1723 Code::Flags flags = Code::ComputeFlags( | 1723 Code::Flags flags = Code::ComputeFlags( |
1724 Code::KEYED_LOAD_IC, state, Code::kNoExtraICState, type); | 1724 Code::KEYED_LOAD_IC, state, Code::kNoExtraICState, type); |
1725 MaybeObject* result = GetCodeWithFlags(flags, name); | 1725 MaybeObject* result = TryGetCodeWithFlags(flags, name); |
1726 if (!result->IsFailure()) { | 1726 if (!result->IsFailure()) { |
1727 PROFILE(isolate(), | 1727 PROFILE(isolate(), |
1728 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, | 1728 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, |
1729 Code::cast(result->ToObjectUnchecked()), | 1729 Code::cast(result->ToObjectUnchecked()), |
1730 name)); | 1730 name)); |
1731 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, | 1731 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, |
1732 name, | 1732 name, |
1733 Code::cast(result->ToObjectUnchecked()))); | 1733 Code::cast(result->ToObjectUnchecked()))); |
1734 } | 1734 } |
1735 return result; | 1735 return result; |
1736 } | 1736 } |
1737 | 1737 |
1738 | 1738 |
1739 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { | 1739 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { |
1740 Code::Flags flags = | 1740 Code::Flags flags = |
1741 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); | 1741 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); |
1742 MaybeObject* result = GetCodeWithFlags(flags, name); | 1742 MaybeObject* result = TryGetCodeWithFlags(flags, name); |
1743 if (!result->IsFailure()) { | 1743 if (!result->IsFailure()) { |
1744 PROFILE(isolate(), | 1744 PROFILE(isolate(), |
1745 CodeCreateEvent(Logger::STORE_IC_TAG, | 1745 CodeCreateEvent(Logger::STORE_IC_TAG, |
1746 Code::cast(result->ToObjectUnchecked()), | 1746 Code::cast(result->ToObjectUnchecked()), |
1747 name)); | 1747 name)); |
1748 GDBJIT(AddCode(GDBJITInterface::STORE_IC, | 1748 GDBJIT(AddCode(GDBJITInterface::STORE_IC, |
1749 name, | 1749 name, |
1750 Code::cast(result->ToObjectUnchecked()))); | 1750 Code::cast(result->ToObjectUnchecked()))); |
1751 } | 1751 } |
1752 return result; | 1752 return result; |
1753 } | 1753 } |
1754 | 1754 |
1755 | 1755 |
1756 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, | 1756 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, |
1757 String* name, | 1757 String* name, |
1758 InlineCacheState state) { | 1758 InlineCacheState state) { |
1759 Code::Flags flags = | 1759 Code::Flags flags = |
1760 Code::ComputeFlags(Code::KEYED_STORE_IC, state, strict_mode_, type); | 1760 Code::ComputeFlags(Code::KEYED_STORE_IC, state, strict_mode_, type); |
1761 MaybeObject* result = GetCodeWithFlags(flags, name); | 1761 MaybeObject* result = TryGetCodeWithFlags(flags, name); |
1762 if (!result->IsFailure()) { | 1762 if (!result->IsFailure()) { |
1763 PROFILE(isolate(), | 1763 PROFILE(isolate(), |
1764 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | 1764 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
1765 Code::cast(result->ToObjectUnchecked()), | 1765 Code::cast(result->ToObjectUnchecked()), |
1766 name)); | 1766 name)); |
1767 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, | 1767 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, |
1768 name, | 1768 name, |
1769 Code::cast(result->ToObjectUnchecked()))); | 1769 Code::cast(result->ToObjectUnchecked()))); |
1770 } | 1770 } |
1771 return result; | 1771 return result; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 } | 1839 } |
1840 | 1840 |
1841 | 1841 |
1842 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { | 1842 MaybeObject* CallStubCompiler::GetCode(PropertyType type, String* name) { |
1843 int argc = arguments_.immediate(); | 1843 int argc = arguments_.immediate(); |
1844 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, | 1844 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, |
1845 type, | 1845 type, |
1846 extra_state_, | 1846 extra_state_, |
1847 cache_holder_, | 1847 cache_holder_, |
1848 argc); | 1848 argc); |
1849 return GetCodeWithFlags(flags, name); | 1849 return TryGetCodeWithFlags(flags, name); |
1850 } | 1850 } |
1851 | 1851 |
1852 | 1852 |
1853 MaybeObject* CallStubCompiler::GetCode(JSFunction* function) { | 1853 MaybeObject* CallStubCompiler::GetCode(JSFunction* function) { |
1854 String* function_name = NULL; | 1854 String* function_name = NULL; |
1855 if (function->shared()->name()->IsString()) { | 1855 if (function->shared()->name()->IsString()) { |
1856 function_name = String::cast(function->shared()->name()); | 1856 function_name = String::cast(function->shared()->name()); |
1857 } | 1857 } |
1858 return GetCode(CONSTANT_FUNCTION, function_name); | 1858 return GetCode(CONSTANT_FUNCTION, function_name); |
1859 } | 1859 } |
1860 | 1860 |
1861 | 1861 |
1862 MaybeObject* ConstructStubCompiler::GetCode() { | 1862 MaybeObject* ConstructStubCompiler::GetCode() { |
1863 Code::Flags flags = Code::ComputeFlags(Code::STUB); | 1863 Code::Flags flags = Code::ComputeFlags(Code::STUB); |
1864 Object* result; | 1864 Object* result; |
1865 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ConstructStub"); | 1865 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "ConstructStub"); |
1866 if (!maybe_result->ToObject(&result)) return maybe_result; | 1866 if (!maybe_result->ToObject(&result)) return maybe_result; |
1867 } | 1867 } |
1868 Code* code = Code::cast(result); | 1868 Code* code = Code::cast(result); |
1869 USE(code); | 1869 USE(code); |
1870 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); | 1870 PROFILE(isolate(), CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); |
1871 GDBJIT(AddCode(GDBJITInterface::STUB, "ConstructStub", Code::cast(code))); | 1871 GDBJIT(AddCode(GDBJITInterface::STUB, "ConstructStub", Code::cast(code))); |
1872 return result; | 1872 return result; |
1873 } | 1873 } |
1874 | 1874 |
1875 | 1875 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 expected_receiver_type_ = | 1934 expected_receiver_type_ = |
1935 FunctionTemplateInfo::cast(signature->receiver()); | 1935 FunctionTemplateInfo::cast(signature->receiver()); |
1936 } | 1936 } |
1937 } | 1937 } |
1938 | 1938 |
1939 is_simple_api_call_ = true; | 1939 is_simple_api_call_ = true; |
1940 } | 1940 } |
1941 | 1941 |
1942 | 1942 |
1943 } } // namespace v8::internal | 1943 } } // namespace v8::internal |
OLD | NEW |