OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 desc->CodeStart()); | 1438 desc->CodeStart()); |
1439 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, | 1439 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, |
1440 desc->CodeStart()); | 1440 desc->CodeStart()); |
1441 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, | 1441 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, |
1442 desc->CodeEnd()); | 1442 desc->CodeEnd()); |
1443 } | 1443 } |
1444 #endif // V8_TARGET_ARCH_X64 | 1444 #endif // V8_TARGET_ARCH_X64 |
1445 } | 1445 } |
1446 | 1446 |
1447 | 1447 |
| 1448 Mutex* GDBJITInterface::mutex_ = OS::CreateMutex(); |
| 1449 |
| 1450 |
1448 void GDBJITInterface::AddCode(const char* name, | 1451 void GDBJITInterface::AddCode(const char* name, |
1449 Code* code, | 1452 Code* code, |
1450 GDBJITInterface::CodeTag tag, | 1453 GDBJITInterface::CodeTag tag, |
1451 Script* script) { | 1454 Script* script) { |
1452 if (!FLAG_gdbjit) return; | 1455 if (!FLAG_gdbjit) return; |
| 1456 |
| 1457 ScopedLock lock(mutex_); |
1453 AssertNoAllocation no_gc; | 1458 AssertNoAllocation no_gc; |
1454 | 1459 |
1455 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 1460 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
1456 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; | 1461 if (e->value != NULL && !IsLineInfoTagged(e->value)) return; |
1457 | 1462 |
1458 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); | 1463 GDBJITLineInfo* lineinfo = UntagLineInfo(e->value); |
1459 CodeDescription code_desc(name, | 1464 CodeDescription code_desc(name, |
1460 code, | 1465 code, |
1461 script != NULL ? Handle<Script>(script) | 1466 script != NULL ? Handle<Script>(script) |
1462 : Handle<Script>(), | 1467 : Handle<Script>(), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { | 1516 void GDBJITInterface::AddCode(GDBJITInterface::CodeTag tag, Code* code) { |
1512 if (!FLAG_gdbjit) return; | 1517 if (!FLAG_gdbjit) return; |
1513 | 1518 |
1514 AddCode(tag, "", code); | 1519 AddCode(tag, "", code); |
1515 } | 1520 } |
1516 | 1521 |
1517 | 1522 |
1518 void GDBJITInterface::RemoveCode(Code* code) { | 1523 void GDBJITInterface::RemoveCode(Code* code) { |
1519 if (!FLAG_gdbjit) return; | 1524 if (!FLAG_gdbjit) return; |
1520 | 1525 |
| 1526 ScopedLock lock(mutex_); |
1521 HashMap::Entry* e = GetEntries()->Lookup(code, | 1527 HashMap::Entry* e = GetEntries()->Lookup(code, |
1522 HashForCodeObject(code), | 1528 HashForCodeObject(code), |
1523 false); | 1529 false); |
1524 if (e == NULL) return; | 1530 if (e == NULL) return; |
1525 | 1531 |
1526 if (IsLineInfoTagged(e->value)) { | 1532 if (IsLineInfoTagged(e->value)) { |
1527 delete UntagLineInfo(e->value); | 1533 delete UntagLineInfo(e->value); |
1528 } else { | 1534 } else { |
1529 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); | 1535 JITCodeEntry* entry = static_cast<JITCodeEntry*>(e->value); |
1530 UnregisterCodeEntry(entry); | 1536 UnregisterCodeEntry(entry); |
1531 DestroyCodeEntry(entry); | 1537 DestroyCodeEntry(entry); |
1532 } | 1538 } |
1533 e->value = NULL; | 1539 e->value = NULL; |
1534 GetEntries()->Remove(code, HashForCodeObject(code)); | 1540 GetEntries()->Remove(code, HashForCodeObject(code)); |
1535 } | 1541 } |
1536 | 1542 |
1537 | 1543 |
1538 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, | 1544 void GDBJITInterface::RegisterDetailedLineInfo(Code* code, |
1539 GDBJITLineInfo* line_info) { | 1545 GDBJITLineInfo* line_info) { |
| 1546 ScopedLock lock(mutex_); |
1540 ASSERT(!IsLineInfoTagged(line_info)); | 1547 ASSERT(!IsLineInfoTagged(line_info)); |
1541 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 1548 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
1542 ASSERT(e->value == NULL); | 1549 ASSERT(e->value == NULL); |
1543 e->value = TagLineInfo(line_info); | 1550 e->value = TagLineInfo(line_info); |
1544 } | 1551 } |
1545 | 1552 |
1546 | 1553 |
1547 } } // namespace v8::internal | 1554 } } // namespace v8::internal |
1548 #endif | 1555 #endif |
OLD | NEW |