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 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2517 i::AddressToTraceMap map; | 2517 i::AddressToTraceMap map; |
2518 | 2518 |
2519 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(150))); | 2519 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(150))); |
2520 | 2520 |
2521 // [0x100, 0x200) -> 1 | 2521 // [0x100, 0x200) -> 1 |
2522 map.AddRange(ToAddress(0x100), 0x100, 1U); | 2522 map.AddRange(ToAddress(0x100), 0x100, 1U); |
2523 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x50))); | 2523 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x50))); |
2524 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x100))); | 2524 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x100))); |
2525 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x150))); | 2525 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x150))); |
2526 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x100 + 0x100))); | 2526 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x100 + 0x100))); |
2527 CHECK_EQ(1, map.size()); | 2527 CHECK_EQ(1, static_cast<int>(map.size())); |
tfarina
2014/03/08 02:26:24
CHECK_EQ(1u, map.size());
?
yurys
2014/03/11 07:36:21
Good point, thanks, will change it in one of the n
| |
2528 | 2528 |
2529 // [0x100, 0x200) -> 1, [0x200, 0x300) -> 2 | 2529 // [0x100, 0x200) -> 1, [0x200, 0x300) -> 2 |
2530 map.AddRange(ToAddress(0x200), 0x100, 2U); | 2530 map.AddRange(ToAddress(0x200), 0x100, 2U); |
2531 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x2a0))); | 2531 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x2a0))); |
2532 CHECK_EQ(2, map.size()); | 2532 CHECK_EQ(2, static_cast<int>(map.size())); |
2533 | 2533 |
2534 // [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2 | 2534 // [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2 |
2535 map.AddRange(ToAddress(0x180), 0x100, 3U); | 2535 map.AddRange(ToAddress(0x180), 0x100, 3U); |
2536 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); | 2536 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); |
2537 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); | 2537 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); |
2538 CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); | 2538 CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); |
2539 CHECK_EQ(3, map.size()); | 2539 CHECK_EQ(3, static_cast<int>(map.size())); |
2540 | 2540 |
2541 // [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2, | 2541 // [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2, |
2542 // [0x400, 0x500) -> 4 | 2542 // [0x400, 0x500) -> 4 |
2543 map.AddRange(ToAddress(0x400), 0x100, 4U); | 2543 map.AddRange(ToAddress(0x400), 0x100, 4U); |
2544 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); | 2544 CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); |
2545 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); | 2545 CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); |
2546 CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); | 2546 CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); |
2547 CHECK_EQ(4, map.GetTraceNodeId(ToAddress(0x450))); | 2547 CHECK_EQ(4, map.GetTraceNodeId(ToAddress(0x450))); |
2548 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x500))); | 2548 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x500))); |
2549 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x350))); | 2549 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x350))); |
2550 CHECK_EQ(4, map.size()); | 2550 CHECK_EQ(4, static_cast<int>(map.size())); |
2551 | 2551 |
2552 // [0x100, 0x180) -> 1, [0x180, 0x200) -> 3, [0x200, 0x600) -> 5 | 2552 // [0x100, 0x180) -> 1, [0x180, 0x200) -> 3, [0x200, 0x600) -> 5 |
2553 map.AddRange(ToAddress(0x200), 0x400, 5U); | 2553 map.AddRange(ToAddress(0x200), 0x400, 5U); |
2554 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2554 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
2555 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x400))); | 2555 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x400))); |
2556 CHECK_EQ(3, map.size()); | 2556 CHECK_EQ(3, static_cast<int>(map.size())); |
2557 | 2557 |
2558 // [0x100, 0x180) -> 1, [0x180, 0x200) -> 7, [0x200, 0x600) ->5 | 2558 // [0x100, 0x180) -> 1, [0x180, 0x200) -> 7, [0x200, 0x600) ->5 |
2559 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2559 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2560 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2560 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2561 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); | 2561 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
2562 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2562 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
2563 CHECK_EQ(3, map.size()); | 2563 CHECK_EQ(3, static_cast<int>(map.size())); |
2564 | 2564 |
2565 map.Clear(); | 2565 map.Clear(); |
2566 CHECK_EQ(0, map.size()); | 2566 CHECK_EQ(0, static_cast<int>(map.size())); |
2567 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); | 2567 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
2568 } | 2568 } |
OLD | NEW |