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

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

Issue 12223027: This patch is the propagation version of https://codereview.chromium.org/10824032 patch (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 10 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/log.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 13684)
+++ test/cctest/test-api.cc (working copy)
@@ -11588,6 +11588,7 @@
static i::HashMap* code_map = NULL;
+static i::HashMap* jitcode_line_info = NULL;
static int saw_bar = 0;
static int move_events = 0;
@@ -11627,7 +11628,11 @@
static void event_handler(const v8::JitCodeEvent* event) {
CHECK(event != NULL);
CHECK(code_map != NULL);
+ CHECK(jitcode_line_info != NULL);
+ class DummyJitCodeLineInfo {
+ };
+
switch (event->type) {
case v8::JitCodeEvent::CODE_ADDED: {
CHECK(event->code_start != NULL);
@@ -11675,6 +11680,43 @@
// Object/code removal events are currently not dispatched from the GC.
CHECK(false);
break;
+
+ // For CODE_START_LINE_INFO_RECORDING event, we will create one
+ // DummyJitCodeLineInfo data structure pointed by event->user_dat. We
+ // record it in jitcode_line_info.
+ case v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING: {
+ DummyJitCodeLineInfo* line_info = new DummyJitCodeLineInfo();
+ v8::JitCodeEvent* temp_event = const_cast<v8::JitCodeEvent*>(event);
+ temp_event->user_data = line_info;
+ i::HashMap::Entry* entry =
+ jitcode_line_info->Lookup(line_info,
+ i::ComputePointerHash(line_info),
+ true);
+ entry->value = reinterpret_cast<void*>(line_info);
+ }
+ break;
+ // For these two events, we will check whether the event->user_data
+ // data structure is created before during CODE_START_LINE_INFO_RECORDING
+ // event. And delete it in CODE_END_LINE_INFO_RECORDING event handling.
+ case v8::JitCodeEvent::CODE_END_LINE_INFO_RECORDING: {
+ CHECK(event->user_data != NULL);
+ uint32_t hash = i::ComputePointerHash(event->user_data);
+ i::HashMap::Entry* entry =
+ jitcode_line_info->Lookup(event->user_data, hash, false);
+ CHECK(entry != NULL);
+ delete reinterpret_cast<DummyJitCodeLineInfo*>(event->user_data);
+ }
+ break;
+
+ case v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO: {
+ CHECK(event->user_data != NULL);
+ uint32_t hash = i::ComputePointerHash(event->user_data);
+ i::HashMap::Entry* entry =
+ jitcode_line_info->Lookup(event->user_data, hash, false);
+ CHECK(entry != NULL);
+ }
+ break;
+
default:
// Impossible event.
CHECK(false);
@@ -11710,6 +11752,9 @@
i::HashMap code(MatchPointers);
code_map = &code;
+ i::HashMap lineinfo(MatchPointers);
+ jitcode_line_info = &lineinfo;
+
saw_bar = 0;
move_events = 0;
@@ -11743,6 +11788,7 @@
CHECK_LT(0, move_events);
code_map = NULL;
+ jitcode_line_info = NULL;
}
isolate->Exit();
@@ -11763,9 +11809,13 @@
i::HashMap code(MatchPointers);
code_map = &code;
+ i::HashMap lineinfo(MatchPointers);
+ jitcode_line_info = &lineinfo;
+
V8::SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, event_handler);
V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL);
+ jitcode_line_info = NULL;
// We expect that we got some events. Note that if we could get code removal
// notifications, we could compare two collections, one created by listening
// from the time of creation of an isolate, and the other by subscribing
« no previous file with comments | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698