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

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

Issue 1103843002: Preprocess structured stack trace on GC to get rid of code reference. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 8 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 | « src/objects-inl.h ('k') | no next file » | 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 b8d7676a1bae20fde605ba8fa8f643831bd25ae3..906b4fe8a968fb8beaba0db2fb175d08ee6bd39f 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5379,3 +5379,36 @@ TEST(WeakFixedArray) {
array->Compact();
WeakFixedArray::Add(array, number);
}
+
+
+TEST(PreprocessStackTrace) {
+ // Do not automatically trigger early GC.
+ FLAG_gc_interval = -1;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ v8::TryCatch try_catch;
+ CompileRun("throw new Error();");
+ CHECK(try_catch.HasCaught());
+ Isolate* isolate = CcTest::i_isolate();
+ Handle<Object> exception = v8::Utils::OpenHandle(*try_catch.Exception());
+ Handle<Name> key = isolate->factory()->stack_trace_symbol();
+ Handle<Object> stack_trace =
+ JSObject::GetProperty(exception, key).ToHandleChecked();
+ Handle<Object> code =
+ Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
+ CHECK(code->IsCode());
+
+ isolate->heap()->CollectAllAvailableGarbage("stack trace preprocessing");
+
+ Handle<Object> pos =
+ Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
+ CHECK(pos->IsSmi());
+
+ Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace);
+ int array_length = Smi::cast(stack_trace_array->length())->value();
+ for (int i = 0; i < array_length; i++) {
+ Handle<Object> element =
+ Object::GetElement(isolate, stack_trace, i).ToHandleChecked();
+ CHECK(!element->IsCode());
+ }
+}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698