| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 FAST_HOLEY_ELEMENTS, | 911 FAST_HOLEY_ELEMENTS, |
| 912 TENURED); | 912 TENURED); |
| 913 | 913 |
| 914 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 914 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
| 915 objs[next_objs_index++] = | 915 objs[next_objs_index++] = |
| 916 factory->NewStringFromAscii(CStrVector("abcdefghij")); | 916 factory->NewStringFromAscii(CStrVector("abcdefghij")); |
| 917 objs[next_objs_index++] = | 917 objs[next_objs_index++] = |
| 918 factory->NewStringFromAscii(CStrVector("abcdefghij"), TENURED); | 918 factory->NewStringFromAscii(CStrVector("abcdefghij"), TENURED); |
| 919 | 919 |
| 920 // Allocate a large string (for large object space). | 920 // Allocate a large string (for large object space). |
| 921 int large_size = Page::kMaxNonCodeHeapObjectSize + 1; | 921 int large_size = Page::kMaxRegularHeapObjectSize + 1; |
| 922 char* str = new char[large_size]; | 922 char* str = new char[large_size]; |
| 923 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; | 923 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; |
| 924 str[large_size - 1] = '\0'; | 924 str[large_size - 1] = '\0'; |
| 925 objs[next_objs_index++] = | 925 objs[next_objs_index++] = |
| 926 factory->NewStringFromAscii(CStrVector(str), TENURED); | 926 factory->NewStringFromAscii(CStrVector(str), TENURED); |
| 927 delete[] str; | 927 delete[] str; |
| 928 | 928 |
| 929 // Add a Map object to look for. | 929 // Add a Map object to look for. |
| 930 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 930 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
| 931 | 931 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 Handle<Map> my_map = factory->CopyMap(object_map, 1); | 980 Handle<Map> my_map = factory->CopyMap(object_map, 1); |
| 981 int n_properties = my_map->inobject_properties(); | 981 int n_properties = my_map->inobject_properties(); |
| 982 CHECK_GT(n_properties, 0); | 982 CHECK_GT(n_properties, 0); |
| 983 | 983 |
| 984 int object_size = my_map->instance_size(); | 984 int object_size = my_map->instance_size(); |
| 985 | 985 |
| 986 // Step 2: allocate a lot of objects so to almost fill new space: we need | 986 // Step 2: allocate a lot of objects so to almost fill new space: we need |
| 987 // just enough room to allocate JSObject and thus fill the newspace. | 987 // just enough room to allocate JSObject and thus fill the newspace. |
| 988 | 988 |
| 989 int allocation_amount = Min(FixedArray::kMaxSize, | 989 int allocation_amount = Min(FixedArray::kMaxSize, |
| 990 Page::kMaxNonCodeHeapObjectSize + kPointerSize); | 990 Page::kMaxRegularHeapObjectSize + kPointerSize); |
| 991 int allocation_len = LenFromSize(allocation_amount); | 991 int allocation_len = LenFromSize(allocation_amount); |
| 992 NewSpace* new_space = heap->new_space(); | 992 NewSpace* new_space = heap->new_space(); |
| 993 Address* top_addr = new_space->allocation_top_address(); | 993 Address* top_addr = new_space->allocation_top_address(); |
| 994 Address* limit_addr = new_space->allocation_limit_address(); | 994 Address* limit_addr = new_space->allocation_limit_address(); |
| 995 while ((*limit_addr - *top_addr) > allocation_amount) { | 995 while ((*limit_addr - *top_addr) > allocation_amount) { |
| 996 CHECK(!heap->always_allocate()); | 996 CHECK(!heap->always_allocate()); |
| 997 Object* array = heap->AllocateFixedArray(allocation_len)->ToObjectChecked(); | 997 Object* array = heap->AllocateFixedArray(allocation_len)->ToObjectChecked(); |
| 998 CHECK(!array->IsFailure()); | 998 CHECK(!array->IsFailure()); |
| 999 CHECK(new_space->Contains(array)); | 999 CHECK(new_space->Contains(array)); |
| 1000 } | 1000 } |
| (...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 code = scope.CloseAndEscape(Handle<Code>(bar->code())); | 3740 code = scope.CloseAndEscape(Handle<Code>(bar->code())); |
| 3741 } | 3741 } |
| 3742 | 3742 |
| 3743 // Now make sure that a gc should get rid of the function | 3743 // Now make sure that a gc should get rid of the function |
| 3744 for (int i = 0; i < 4; i++) { | 3744 for (int i = 0; i < 4; i++) { |
| 3745 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3745 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3746 } | 3746 } |
| 3747 | 3747 |
| 3748 ASSERT(code->marked_for_deoptimization()); | 3748 ASSERT(code->marked_for_deoptimization()); |
| 3749 } | 3749 } |
| OLD | NEW |