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

Unified Diff: test/cctest/test-heap.cc

Issue 19805003: Restore test and behavior prior to deferred stack trace formatting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comment addressed Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/cctest.status ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index d2b915690e2bb03e1c5b0ee4af0fc5271eb0371a..6c59f08ac0644f149c28580fca851a424a6bc446 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2820,20 +2820,26 @@ class SourceResource: public v8::String::ExternalAsciiStringResource {
};
-void ReleaseStackTraceDataTest(const char* source) {
+void ReleaseStackTraceDataTest(const char* source, const char* accessor) {
// Test that the data retained by the Error.stack accessor is released
// after the first time the accessor is fired. We use external string
// to check whether the data is being released since the external string
// resource's callback is fired when the external string is GC'ed.
+ FLAG_use_ic = false; // ICs retain objects.
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
SourceResource* resource = new SourceResource(i::StrDup(source));
{
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::String> source_string = v8::String::NewExternal(resource);
+ HEAP->CollectAllAvailableGarbage();
v8::Script::Compile(source_string)->Run();
CHECK(!resource->IsDisposed());
}
+ // HEAP->CollectAllAvailableGarbage();
+ CHECK(!resource->IsDisposed());
+
+ CompileRun(accessor);
HEAP->CollectAllAvailableGarbage();
// External source has been released.
@@ -2855,8 +2861,33 @@ TEST(ReleaseStackTraceData) {
"} catch (e) { "
" error = e; "
"} ";
- ReleaseStackTraceDataTest(source1);
- ReleaseStackTraceDataTest(source2);
+ static const char* source3 = "var error = null; "
+ /* Normal Error */ "try { "
+ /* as prototype */ " throw new Error(); "
+ "} catch (e) { "
+ " error = {}; "
+ " error.__proto__ = e; "
+ "} ";
+ static const char* source4 = "var error = null; "
+ /* Stack overflow */ "try { "
+ /* as prototype */ " (function f() { f(); })(); "
+ "} catch (e) { "
+ " error = {}; "
+ " error.__proto__ = e; "
+ "} ";
+ static const char* getter = "error.stack";
+ static const char* setter = "error.stack = 0";
+
+ ReleaseStackTraceDataTest(source1, setter);
+ ReleaseStackTraceDataTest(source2, setter);
+ // We do not test source3 and source4 with setter, since the setter is
+ // supposed to (untypically) write to the receiver, not the holder. This is
+ // to emulate the behavior of a data property.
+
+ ReleaseStackTraceDataTest(source1, getter);
+ ReleaseStackTraceDataTest(source2, getter);
+ ReleaseStackTraceDataTest(source3, getter);
+ ReleaseStackTraceDataTest(source4, getter);
}
« no previous file with comments | « test/cctest/cctest.status ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698