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

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

Issue 1233073005: Debugger: prepare code for debugging on a per-function basis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 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 unified diff | Download patch
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | test/cctest/test-debug.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 20969 matching lines...) Expand 10 before | Expand all | Expand 10 after
20980 delete task; 20980 delete task;
20981 20981
20982 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData(); 20982 const v8::ScriptCompiler::CachedData* cached_data = source.GetCachedData();
20983 CHECK(cached_data != NULL); 20983 CHECK(cached_data != NULL);
20984 CHECK(cached_data->data != NULL); 20984 CHECK(cached_data->data != NULL);
20985 CHECK(!cached_data->rejected); 20985 CHECK(!cached_data->rejected);
20986 CHECK_GT(cached_data->length, 0); 20986 CHECK_GT(cached_data->length, 0);
20987 } 20987 }
20988 20988
20989 20989
20990 TEST(StreamingWithDebuggingDoesNotProduceParserCache) {
ulan 2015/07/20 13:22:47 Why is this removed?
Yang 2015/07/20 14:25:00 I thought about this. It seems like I have to rest
20991 // If the debugger is active, we should just not produce parser cache at
20992 // all. This is a regeression test: We used to produce a parser cache without
20993 // any data in it (just headers).
20994 i::FLAG_min_preparse_length = 0;
20995 const char* chunks[] = {"function foo() { ret", "urn 13; } f", "oo(); ",
20996 NULL};
20997
20998 LocalContext env;
20999 v8::Isolate* isolate = env->GetIsolate();
21000 v8::HandleScope scope(isolate);
21001
21002 // Make the debugger active by setting a breakpoint.
21003 CompileRun("function break_here() { }");
21004 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(
21005 v8::Utils::OpenHandle(*env->Global()->Get(v8_str("break_here"))));
21006 EnableDebugger();
21007 v8::internal::Debug* debug = CcTest::i_isolate()->debug();
21008 int position = 0;
21009 debug->SetBreakPoint(func, i::Handle<i::Object>(v8::internal::Smi::FromInt(1),
21010 CcTest::i_isolate()),
21011 &position);
21012
21013 v8::ScriptCompiler::StreamedSource source(
21014 new TestSourceStream(chunks),
21015 v8::ScriptCompiler::StreamedSource::ONE_BYTE);
21016 v8::ScriptCompiler::ScriptStreamingTask* task =
21017 v8::ScriptCompiler::StartStreamingScript(
21018 isolate, &source, v8::ScriptCompiler::kProduceParserCache);
21019
21020 // TestSourceStream::GetMoreData won't block, so it's OK to just run the
21021 // task here in the main thread.
21022 task->Run();
21023 delete task;
21024
21025 // Check that we got no cached data.
21026 CHECK(source.GetCachedData() == NULL);
21027 DisableDebugger();
21028 }
21029
21030
21031 TEST(StreamingScriptWithInvalidUtf8) { 20990 TEST(StreamingScriptWithInvalidUtf8) {
21032 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a 20991 // Regression test for a crash: test that invalid UTF-8 bytes in the end of a
21033 // chunk don't produce a crash. 20992 // chunk don't produce a crash.
21034 const char* reference = "\xec\x92\x81\x80\x80"; 20993 const char* reference = "\xec\x92\x81\x80\x80";
21035 char chunk1[] = 20994 char chunk1[] =
21036 "function foo() {\n" 20995 "function foo() {\n"
21037 " // This function will contain an UTF-8 character which is not in\n" 20996 " // This function will contain an UTF-8 character which is not in\n"
21038 " // ASCII.\n" 20997 " // ASCII.\n"
21039 " var foobXXXXX"; // Too many bytes which look like incomplete chars! 20998 " var foobXXXXX"; // Too many bytes which look like incomplete chars!
21040 char chunk2[] = 20999 char chunk2[] =
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
21918 21877
21919 v8::TryCatch try_catch(CcTest::isolate()); 21878 v8::TryCatch try_catch(CcTest::isolate());
21920 timeout_thread.Start(); 21879 timeout_thread.Start();
21921 21880
21922 CompileRun( 21881 CompileRun(
21923 "var ab = new SharedArrayBuffer(4);" 21882 "var ab = new SharedArrayBuffer(4);"
21924 "var i32a = new Int32Array(ab);" 21883 "var i32a = new Int32Array(ab);"
21925 "Atomics.futexWait(i32a, 0, 0);"); 21884 "Atomics.futexWait(i32a, 0, 0);");
21926 CHECK(try_catch.HasTerminated()); 21885 CHECK(try_catch.HasTerminated());
21927 } 21886 }
OLDNEW
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698