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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script); | 1404 AddCode(*name_cstring, *code, GDBJITInterface::FUNCTION, *script); |
1405 } else { | 1405 } else { |
1406 AddCode("", *code, GDBJITInterface::FUNCTION, *script); | 1406 AddCode("", *code, GDBJITInterface::FUNCTION, *script); |
1407 } | 1407 } |
1408 } | 1408 } |
1409 | 1409 |
1410 static void AddUnwindInfo(CodeDescription *desc) { | 1410 static void AddUnwindInfo(CodeDescription *desc) { |
1411 #ifdef V8_TARGET_ARCH_X64 | 1411 #ifdef V8_TARGET_ARCH_X64 |
1412 if (desc->tag() == GDBJITInterface::FUNCTION) { | 1412 if (desc->tag() == GDBJITInterface::FUNCTION) { |
1413 // To avoid propagating unwinding information through | 1413 // To avoid propagating unwinding information through |
1414 // compilation pipeline we rely on function prologue | 1414 // compilation pipeline we use an approximation. |
1415 // and epilogue being the same for all code objects generated | 1415 // For most use cases this should not affect usability. |
1416 // by the full code generator. | |
1417 static const int kFramePointerPushOffset = 1; | 1416 static const int kFramePointerPushOffset = 1; |
1418 static const int kFramePointerSetOffset = 4; | 1417 static const int kFramePointerSetOffset = 4; |
1419 static const int kFramePointerPopOffset = -3; | 1418 static const int kFramePointerPopOffset = -3; |
1420 | 1419 |
1421 uintptr_t frame_pointer_push_address = | 1420 uintptr_t frame_pointer_push_address = |
1422 desc->CodeStart() + kFramePointerPushOffset; | 1421 desc->CodeStart() + kFramePointerPushOffset; |
1423 | 1422 |
1424 uintptr_t frame_pointer_set_address = | 1423 uintptr_t frame_pointer_set_address = |
1425 desc->CodeStart() + kFramePointerSetOffset; | 1424 desc->CodeStart() + kFramePointerSetOffset; |
1426 | 1425 |
1427 uintptr_t frame_pointer_pop_address = | 1426 uintptr_t frame_pointer_pop_address = |
1428 desc->CodeEnd() + kFramePointerPopOffset; | 1427 desc->CodeEnd() + kFramePointerPopOffset; |
1429 | 1428 |
1430 #ifdef DEBUG | |
1431 static const uint8_t kFramePointerPushInstruction = 0x48; // push ebp | |
1432 static const uint16_t kFramePointerSetInstruction = 0x5756; // mov ebp, esp | |
1433 static const uint8_t kFramePointerPopInstruction = 0xBE; // pop ebp | |
1434 | |
1435 ASSERT(*reinterpret_cast<uint8_t*>(frame_pointer_push_address) == | |
1436 kFramePointerPushInstruction); | |
1437 ASSERT(*reinterpret_cast<uint16_t*>(frame_pointer_set_address) == | |
1438 kFramePointerSetInstruction); | |
1439 ASSERT(*reinterpret_cast<uint8_t*>(frame_pointer_pop_address) == | |
1440 kFramePointerPopInstruction); | |
1441 #endif | |
1442 | |
1443 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_PUSH, | 1429 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_PUSH, |
1444 frame_pointer_push_address); | 1430 frame_pointer_push_address); |
1445 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, | 1431 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, |
1446 frame_pointer_set_address); | 1432 frame_pointer_set_address); |
1447 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, | 1433 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_POP, |
1448 frame_pointer_pop_address); | 1434 frame_pointer_pop_address); |
1449 } else { | 1435 } else { |
1450 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_PUSH, | 1436 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_PUSH, |
1451 desc->CodeStart()); | 1437 desc->CodeStart()); |
1452 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, | 1438 desc->SetStackStateStartAddress(CodeDescription::POST_RBP_SET, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 GDBJITLineInfo* line_info) { | 1538 GDBJITLineInfo* line_info) { |
1553 ASSERT(!IsLineInfoTagged(line_info)); | 1539 ASSERT(!IsLineInfoTagged(line_info)); |
1554 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); | 1540 HashMap::Entry* e = GetEntries()->Lookup(code, HashForCodeObject(code), true); |
1555 ASSERT(e->value == NULL); | 1541 ASSERT(e->value == NULL); |
1556 e->value = TagLineInfo(line_info); | 1542 e->value = TagLineInfo(line_info); |
1557 } | 1543 } |
1558 | 1544 |
1559 | 1545 |
1560 } } // namespace v8::internal | 1546 } } // namespace v8::internal |
1561 #endif | 1547 #endif |
OLD | NEW |