OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // Force GC to test the poisoned memento handling | 95 // Force GC to test the poisoned memento handling |
96 CcTest::i_isolate()->heap()->CollectGarbage(i::NEW_SPACE); | 96 CcTest::i_isolate()->heap()->CollectGarbage(i::NEW_SPACE); |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 TEST(PretenuringCallNew) { | 100 TEST(PretenuringCallNew) { |
101 CcTest::InitializeVM(); | 101 CcTest::InitializeVM(); |
102 if (!i::FLAG_allocation_site_pretenuring) return; | 102 if (!i::FLAG_allocation_site_pretenuring) return; |
103 if (!i::FLAG_pretenuring_call_new) return; | 103 if (!i::FLAG_pretenuring_call_new) return; |
| 104 if (i::FLAG_always_opt) return; |
104 | 105 |
105 v8::HandleScope scope(CcTest::isolate()); | 106 v8::HandleScope scope(CcTest::isolate()); |
106 Isolate* isolate = CcTest::i_isolate(); | 107 Isolate* isolate = CcTest::i_isolate(); |
107 Heap* heap = isolate->heap(); | 108 Heap* heap = isolate->heap(); |
108 | 109 |
109 int call_count = 10; | 110 int call_count = 10; |
110 i::ScopedVector<char> test_buf(1024); | 111 i::ScopedVector<char> test_buf(1024); |
111 const char* program = | 112 const char* program = |
112 "function f() {" | 113 "function f() {" |
113 " this.a = 3;" | 114 " this.a = 3;" |
(...skipping 15 matching lines...) Expand all Loading... |
129 AllocationMemento* memento = | 130 AllocationMemento* memento = |
130 reinterpret_cast<AllocationMemento*>(memento_address + kHeapObjectTag); | 131 reinterpret_cast<AllocationMemento*>(memento_address + kHeapObjectTag); |
131 CHECK_EQ(memento->map(), heap->allocation_memento_map()); | 132 CHECK_EQ(memento->map(), heap->allocation_memento_map()); |
132 | 133 |
133 // Furthermore, how many mementos did we create? The count should match | 134 // Furthermore, how many mementos did we create? The count should match |
134 // call_count. Note, that mementos are allocated during the inobject slack | 135 // call_count. Note, that mementos are allocated during the inobject slack |
135 // tracking phase. | 136 // tracking phase. |
136 AllocationSite* site = memento->GetAllocationSite(); | 137 AllocationSite* site = memento->GetAllocationSite(); |
137 CHECK_EQ(call_count, site->pretenure_create_count()->value()); | 138 CHECK_EQ(call_count, site->pretenure_create_count()->value()); |
138 } | 139 } |
OLD | NEW |