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

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

Issue 1255173006: Introduce safe interface to "copy and grow" FixedArray. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed nits. Created 5 years, 4 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.cc ('k') | test/mjsunit/regress/regress-crbug-513507.js » ('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 c54d67aeeb32f100a391369a10625be93b39d665..e476bcca84665990347988a1780298a134086fe5 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -4501,6 +4501,61 @@ TEST(Regress173458) {
}
+#ifdef DEBUG
+TEST(Regress513507) {
+ i::FLAG_flush_optimized_code_cache = false;
+ i::FLAG_allow_natives_syntax = true;
+ i::FLAG_gc_global = true;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Heap* heap = isolate->heap();
+ HandleScope scope(isolate);
+
+ // Prepare function whose optimized code map we can use.
+ Handle<SharedFunctionInfo> shared;
+ {
+ HandleScope inner_scope(isolate);
+ CompileRun("function f() { return 1 }"
+ "f(); %OptimizeFunctionOnNextCall(f); f();");
+
+ Handle<JSFunction> f =
+ v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(
+ CcTest::global()->Get(v8_str("f"))));
+ shared = inner_scope.CloseAndEscape(handle(f->shared(), isolate));
+ CompileRun("f = null");
+ }
+
+ // Prepare optimized code that we can use.
+ Handle<Code> code;
+ {
+ HandleScope inner_scope(isolate);
+ CompileRun("function g() { return 2 }"
+ "g(); %OptimizeFunctionOnNextCall(g); g();");
+
+ Handle<JSFunction> g =
+ v8::Utils::OpenHandle(
+ *v8::Handle<v8::Function>::Cast(
+ CcTest::global()->Get(v8_str("g"))));
+ code = inner_scope.CloseAndEscape(handle(g->code(), isolate));
+ if (!code->is_optimized_code()) return;
+ }
+
+ Handle<FixedArray> lit = isolate->factory()->empty_fixed_array();
+ Handle<Context> context(isolate->context());
+
+ // Add the new code several times to the optimized code map and also set an
+ // allocation timeout so that expanding the code map will trigger a GC.
+ heap->set_allocation_timeout(5);
+ FLAG_gc_interval = 1000;
+ for (int i = 0; i < 10; ++i) {
+ BailoutId id = BailoutId(i);
+ SharedFunctionInfo::AddToOptimizedCodeMap(shared, context, code, lit, id);
+ }
+}
+#endif // DEBUG
+
+
class DummyVisitor : public ObjectVisitor {
public:
void VisitPointers(Object** start, Object** end) { }
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-crbug-513507.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698