Chromium Code Reviews| Index: test/cctest/test-api.cc |
| =================================================================== |
| --- test/cctest/test-api.cc (revision 13599) |
| +++ test/cctest/test-api.cc (working copy) |
| @@ -11585,6 +11585,7 @@ |
| static i::HashMap* code_map = NULL; |
| +static i::HashMap* jitcode_line_info = NULL; |
| static int saw_bar = 0; |
| static int move_events = 0; |
| @@ -11624,7 +11625,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); |
| @@ -11672,6 +11677,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), |
|
danno
2013/02/06 14:21:34
strange indentation, please follow style guideline
|
| + 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); |
| @@ -11705,6 +11747,9 @@ |
| i::HashMap code(MatchPointers); |
| code_map = &code; |
| + i::HashMap lineinfo(MatchPointers); |
| + jitcode_line_info = &lineinfo; |
| + |
| saw_bar = 0; |
| move_events = 0; |
| @@ -11737,6 +11782,7 @@ |
| CHECK_NE(0, move_events); |
| code_map = NULL; |
| + jitcode_line_info = NULL; |
| V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL); |
| } |
| @@ -11758,10 +11804,15 @@ |
| i::HashMap code(MatchPointers); |
| code_map = &code; |
| - V8::SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, event_handler); |
| + i::HashMap lineinfo(MatchPointers); |
| + jitcode_line_info = &lineinfo; |
| + |
| + V8::SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, |
| + event_handler); |
| V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL); |
| code_map = 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 |