Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: test/cctest/test-heap.cc

Issue 960103003: Revert of Fix memory leak caused by field type in descriptor array. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/property.h ('k') | test/cctest/test-migrations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5065 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 // Test that the number-string cache has not been resized in the snapshot. 5076 // Test that the number-string cache has not been resized in the snapshot.
5077 CcTest::InitializeVM(); 5077 CcTest::InitializeVM();
5078 Isolate* isolate = CcTest::i_isolate(); 5078 Isolate* isolate = CcTest::i_isolate();
5079 if (!isolate->snapshot_available()) return; 5079 if (!isolate->snapshot_available()) return;
5080 Heap* heap = isolate->heap(); 5080 Heap* heap = isolate->heap();
5081 CHECK_EQ(TestHeap::kInitialNumberStringCacheSize * 2, 5081 CHECK_EQ(TestHeap::kInitialNumberStringCacheSize * 2,
5082 heap->number_string_cache()->length()); 5082 heap->number_string_cache()->length());
5083 } 5083 }
5084 5084
5085 5085
5086 TEST(Regress3877) {
5087 CcTest::InitializeVM();
5088 Isolate* isolate = CcTest::i_isolate();
5089 Heap* heap = isolate->heap();
5090 Factory* factory = isolate->factory();
5091 HandleScope scope(isolate);
5092 CompileRun("function cls() { this.x = 10; }");
5093 Handle<WeakCell> weak_prototype;
5094 {
5095 HandleScope inner_scope(isolate);
5096 v8::Local<v8::Value> result = CompileRun("cls.prototype");
5097 Handle<JSObject> proto =
5098 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
5099 weak_prototype = inner_scope.CloseAndEscape(factory->NewWeakCell(proto));
5100 }
5101 CHECK(!weak_prototype->cleared());
5102 CompileRun(
5103 "var a = { };"
5104 "a.x = new cls();"
5105 "cls.prototype = null;");
5106 for (int i = 0; i < 4; i++) {
5107 heap->CollectAllGarbage(Heap::kNoGCFlags);
5108 }
5109 // The map of a.x keeps prototype alive
5110 CHECK(!weak_prototype->cleared());
5111 // Change the map of a.x and make the previous map garbage collectable.
5112 CompileRun("a.x.__proto__ = {};");
5113 for (int i = 0; i < 4; i++) {
5114 heap->CollectAllGarbage(Heap::kNoGCFlags);
5115 }
5116 CHECK(weak_prototype->cleared());
5117 }
5118
5119
5120 #ifdef DEBUG 5086 #ifdef DEBUG
5121 TEST(PathTracer) { 5087 TEST(PathTracer) {
5122 CcTest::InitializeVM(); 5088 CcTest::InitializeVM();
5123 v8::HandleScope scope(CcTest::isolate()); 5089 v8::HandleScope scope(CcTest::isolate());
5124 5090
5125 v8::Local<v8::Value> result = CompileRun("'abc'"); 5091 v8::Local<v8::Value> result = CompileRun("'abc'");
5126 Handle<Object> o = v8::Utils::OpenHandle(*result); 5092 Handle<Object> o = v8::Utils::OpenHandle(*result);
5127 CcTest::i_isolate()->heap()->TracePathToObject(*o); 5093 CcTest::i_isolate()->heap()->TracePathToObject(*o);
5128 } 5094 }
5129 #endif // DEBUG 5095 #endif // DEBUG
OLDNEW
« no previous file with comments | « src/property.h ('k') | test/cctest/test-migrations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698