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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 CHECK_EQ(observer1.count(), 16); // no more notifications. | 881 CHECK_EQ(observer1.count(), 16); // no more notifications. |
882 CHECK_EQ(observer2.count(), 3); // this one is still active. | 882 CHECK_EQ(observer2.count(), 3); // this one is still active. |
883 | 883 |
884 new_space->RemoveInlineAllocationObserver(&observer2); | 884 new_space->RemoveInlineAllocationObserver(&observer2); |
885 AllocateUnaligned(new_space, 384); | 885 AllocateUnaligned(new_space, 384); |
886 CHECK_EQ(observer1.count(), 16); | 886 CHECK_EQ(observer1.count(), 16); |
887 CHECK_EQ(observer2.count(), 3); | 887 CHECK_EQ(observer2.count(), 3); |
888 } | 888 } |
889 isolate->Dispose(); | 889 isolate->Dispose(); |
890 } | 890 } |
| 891 |
| 892 |
| 893 UNINITIALIZED_TEST(InlineAllocationObserverCadence) { |
| 894 v8::Isolate::CreateParams create_params; |
| 895 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
| 896 v8::Isolate* isolate = v8::Isolate::New(create_params); |
| 897 { |
| 898 v8::Isolate::Scope isolate_scope(isolate); |
| 899 v8::HandleScope handle_scope(isolate); |
| 900 v8::Context::New(isolate)->Enter(); |
| 901 |
| 902 Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); |
| 903 |
| 904 NewSpace* new_space = i_isolate->heap()->new_space(); |
| 905 |
| 906 Observer observer1(512); |
| 907 new_space->AddInlineAllocationObserver(&observer1); |
| 908 Observer observer2(576); |
| 909 new_space->AddInlineAllocationObserver(&observer2); |
| 910 |
| 911 for (int i = 0; i < 512; ++i) { |
| 912 AllocateUnaligned(new_space, 32); |
| 913 } |
| 914 |
| 915 new_space->RemoveInlineAllocationObserver(&observer1); |
| 916 new_space->RemoveInlineAllocationObserver(&observer2); |
| 917 |
| 918 CHECK_EQ(observer1.count(), 30); |
| 919 CHECK_EQ(observer2.count(), 26); |
| 920 } |
| 921 isolate->Dispose(); |
| 922 } |
OLD | NEW |