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

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

Issue 1109093002: Reland: 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: fix Created 5 years, 7 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/objects-inl.h ('k') | no next file » | 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 5361 matching lines...) Expand 10 before | Expand all | Expand 10 after
5372 TEST(WeakFixedArray) { 5372 TEST(WeakFixedArray) {
5373 CcTest::InitializeVM(); 5373 CcTest::InitializeVM();
5374 v8::HandleScope scope(CcTest::isolate()); 5374 v8::HandleScope scope(CcTest::isolate());
5375 5375
5376 Handle<HeapNumber> number = CcTest::i_isolate()->factory()->NewHeapNumber(1); 5376 Handle<HeapNumber> number = CcTest::i_isolate()->factory()->NewHeapNumber(1);
5377 Handle<WeakFixedArray> array = WeakFixedArray::Add(Handle<Object>(), number); 5377 Handle<WeakFixedArray> array = WeakFixedArray::Add(Handle<Object>(), number);
5378 array->Remove(number); 5378 array->Remove(number);
5379 array->Compact(); 5379 array->Compact();
5380 WeakFixedArray::Add(array, number); 5380 WeakFixedArray::Add(array, number);
5381 } 5381 }
5382
5383
5384 TEST(PreprocessStackTrace) {
5385 // Do not automatically trigger early GC.
5386 FLAG_gc_interval = -1;
5387 CcTest::InitializeVM();
5388 v8::HandleScope scope(CcTest::isolate());
5389 v8::TryCatch try_catch;
5390 CompileRun("throw new Error();");
5391 CHECK(try_catch.HasCaught());
5392 Isolate* isolate = CcTest::i_isolate();
5393 Handle<Object> exception = v8::Utils::OpenHandle(*try_catch.Exception());
5394 Handle<Name> key = isolate->factory()->stack_trace_symbol();
5395 Handle<Object> stack_trace =
5396 JSObject::GetProperty(exception, key).ToHandleChecked();
5397 Handle<Object> code =
5398 Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
5399 CHECK(code->IsCode());
5400
5401 isolate->heap()->CollectAllAvailableGarbage("stack trace preprocessing");
5402
5403 Handle<Object> pos =
5404 Object::GetElement(isolate, stack_trace, 3).ToHandleChecked();
5405 CHECK(pos->IsSmi());
5406
5407 Handle<JSArray> stack_trace_array = Handle<JSArray>::cast(stack_trace);
5408 int array_length = Smi::cast(stack_trace_array->length())->value();
5409 for (int i = 0; i < array_length; i++) {
5410 Handle<Object> element =
5411 Object::GetElement(isolate, stack_trace, i).ToHandleChecked();
5412 CHECK(!element->IsCode());
5413 }
5414 }
OLDNEW
« 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