| 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 5083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5094 | 5094 |
| 5095 | 5095 |
| 5096 void CheckMapRetainingFor(int n) { | 5096 void CheckMapRetainingFor(int n) { |
| 5097 FLAG_retain_maps_for_n_gc = n; | 5097 FLAG_retain_maps_for_n_gc = n; |
| 5098 Isolate* isolate = CcTest::i_isolate(); | 5098 Isolate* isolate = CcTest::i_isolate(); |
| 5099 Heap* heap = isolate->heap(); | 5099 Heap* heap = isolate->heap(); |
| 5100 Handle<WeakCell> weak_cell; | 5100 Handle<WeakCell> weak_cell; |
| 5101 { | 5101 { |
| 5102 HandleScope inner_scope(isolate); | 5102 HandleScope inner_scope(isolate); |
| 5103 Handle<Map> map = Map::Create(isolate, 1); | 5103 Handle<Map> map = Map::Create(isolate, 1); |
| 5104 v8::Local<v8::Value> result = |
| 5105 CompileRun("(function () { return {x : 10}; })();"); |
| 5106 Handle<JSObject> proto = |
| 5107 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
| 5108 map->set_prototype(*proto); |
| 5104 heap->AddRetainedMap(map); | 5109 heap->AddRetainedMap(map); |
| 5105 weak_cell = inner_scope.CloseAndEscape(Map::WeakCellForMap(map)); | 5110 weak_cell = inner_scope.CloseAndEscape(Map::WeakCellForMap(map)); |
| 5106 } | 5111 } |
| 5107 CHECK(!weak_cell->cleared()); | 5112 CHECK(!weak_cell->cleared()); |
| 5108 for (int i = 0; i < n; i++) { | 5113 for (int i = 0; i < n; i++) { |
| 5109 heap->CollectGarbage(OLD_POINTER_SPACE); | 5114 heap->CollectGarbage(OLD_POINTER_SPACE); |
| 5110 } | 5115 } |
| 5111 CHECK(!weak_cell->cleared()); | 5116 CHECK(!weak_cell->cleared()); |
| 5112 heap->CollectGarbage(OLD_POINTER_SPACE); | 5117 heap->CollectGarbage(OLD_POINTER_SPACE); |
| 5113 CHECK(weak_cell->cleared()); | 5118 CHECK(weak_cell->cleared()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 5138 | 5143 |
| 5139 TEST(WritableVsImmortalRoots) { | 5144 TEST(WritableVsImmortalRoots) { |
| 5140 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { | 5145 for (int i = 0; i < Heap::kStrongRootListLength; ++i) { |
| 5141 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); | 5146 Heap::RootListIndex root_index = static_cast<Heap::RootListIndex>(i); |
| 5142 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); | 5147 bool writable = Heap::RootCanBeWrittenAfterInitialization(root_index); |
| 5143 bool immortal = Heap::RootIsImmortalImmovable(root_index); | 5148 bool immortal = Heap::RootIsImmortalImmovable(root_index); |
| 5144 // A root value can be writable, immortal, or neither, but not both. | 5149 // A root value can be writable, immortal, or neither, but not both. |
| 5145 CHECK(!immortal || !writable); | 5150 CHECK(!immortal || !writable); |
| 5146 } | 5151 } |
| 5147 } | 5152 } |
| OLD | NEW |