OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "execution.h" | 7 #include "execution.h" |
8 #include "factory.h" | 8 #include "factory.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 #include "global-handles.h" | 10 #include "global-handles.h" |
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); | 1736 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); |
1737 | 1737 |
1738 Handle<JSObject> o = | 1738 Handle<JSObject> o = |
1739 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 1739 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
1740 | 1740 |
1741 CHECK(HEAP->InNewSpace(*o)); | 1741 CHECK(HEAP->InNewSpace(*o)); |
1742 } | 1742 } |
1743 | 1743 |
1744 | 1744 |
1745 static int CountMapTransitions(Map* map) { | 1745 static int CountMapTransitions(Map* map) { |
1746 int result = 0; | 1746 return map->transitions()->number_of_transitions(); |
1747 DescriptorArray* descs = map->instance_descriptors(); | |
1748 for (int i = 0; i < descs->number_of_descriptors(); i++) { | |
1749 if (descs->IsTransitionOnly(i)) { | |
1750 result++; | |
1751 } | |
1752 } | |
1753 return result; | |
1754 } | 1747 } |
1755 | 1748 |
1756 | 1749 |
1757 // Test that map transitions are cleared and maps are collected with | 1750 // Test that map transitions are cleared and maps are collected with |
1758 // incremental marking as well. | 1751 // incremental marking as well. |
1759 TEST(Regress1465) { | 1752 TEST(Regress1465) { |
1760 i::FLAG_allow_natives_syntax = true; | 1753 i::FLAG_allow_natives_syntax = true; |
1761 i::FLAG_trace_incremental_marking = true; | 1754 i::FLAG_trace_incremental_marking = true; |
1762 InitializeVM(); | 1755 InitializeVM(); |
1763 v8::HandleScope scope; | 1756 v8::HandleScope scope; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); | 1924 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 1"); |
1932 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); | 1925 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages()); |
1933 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); | 1926 HEAP->CollectAllGarbage(Heap::kNoGCFlags, "triggered by test 2"); |
1934 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); | 1927 CHECK_GE(number_of_test_pages + 1, old_pointer_space->CountTotalPages() * 2); |
1935 | 1928 |
1936 // Triggering a last-resort GC should cause all pages to be released | 1929 // Triggering a last-resort GC should cause all pages to be released |
1937 // to the OS so that other processes can seize the memory. | 1930 // to the OS so that other processes can seize the memory. |
1938 HEAP->CollectAllAvailableGarbage("triggered really hard"); | 1931 HEAP->CollectAllAvailableGarbage("triggered really hard"); |
1939 CHECK_EQ(1, old_pointer_space->CountTotalPages()); | 1932 CHECK_EQ(1, old_pointer_space->CountTotalPages()); |
1940 } | 1933 } |
OLD | NEW |