# HG changeset patch
# User Hannes Verschore <hv1989@gmail.com>
# Date 1466509931 -7200
# Node ID 7a942a2707771886d8fd76a5dfe07adb0d7f5667
# Parent 01bfa6d7d56176ac9adda98040b7a66b38dfebef
Bug 1280648 - Tracelogger: Don't cache based on pointers to movable gc things, r=bbouvier
diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp
a
|
b
|
TraceLoggerThread::getOrCreateEventPaylo
|
402 | 402 | filename = "<unknown>"; |
403 | 403 | |
404 | 404 | // Only log scripts when enabled otherwise return the global Scripts textId, |
405 | 405 | // which will get filtered out. |
406 | 406 | MOZ_ASSERT(traceLoggerState); |
407 | 407 | if (!traceLoggerState->isTextIdEnabled(type)) |
408 | 408 | return getOrCreateEventPayload(type); |
409 | 409 | |
410 | | PointerHashMap::AddPtr p = pointerMap.lookupForAdd(ptr); |
411 | | if (p) { |
412 | | MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check. |
413 | | return p->value(); |
| 410 | PointerHashMap::AddPtr p; |
| 411 | if (ptr) { |
| 412 | p = pointerMap.lookupForAdd(ptr); |
| 413 | if (p) { |
| 414 | MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check. |
| 415 | return p->value(); |
| 416 | } |
414 | 417 | } |
415 | 418 | |
416 | 419 | // Compute the length of the string to create. |
417 | 420 | size_t lenFilename = strlen(filename); |
418 | 421 | size_t lenLineno = 1; |
419 | 422 | for (size_t i = lineno; i /= 10; lenLineno++); |
420 | 423 | size_t lenColno = 1; |
421 | 424 | for (size_t i = colno; i /= 10; lenColno++); |
… |
… |
TraceLoggerThread::getOrCreateEventPaylo
|
444 | 447 | return nullptr; |
445 | 448 | } |
446 | 449 | |
447 | 450 | if (graph.get()) |
448 | 451 | graph->addTextId(textId, str); |
449 | 452 | |
450 | 453 | nextTextId++; |
451 | 454 | |
452 | | if (!pointerMap.add(p, ptr, payload)) |
453 | | return nullptr; |
| 455 | if (ptr) { |
| 456 | if (!pointerMap.add(p, ptr, payload)) |
| 457 | return nullptr; |
| 458 | } |
454 | 459 | |
455 | 460 | return payload; |
456 | 461 | } |
457 | 462 | |
458 | 463 | TraceLoggerEventPayload* |
459 | 464 | TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, JSScript* script) |
460 | 465 | { |
461 | 466 | return getOrCreateEventPayload(type, script->filename(), script->lineno(), script->column(), |
462 | | script); |
| 467 | nullptr); |
463 | 468 | } |
464 | 469 | |
465 | 470 | TraceLoggerEventPayload* |
466 | 471 | TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, |
467 | 472 | const JS::ReadOnlyCompileOptions& script) |
468 | 473 | { |
469 | | return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, &script); |
| 474 | return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, nullptr); |
470 | 475 | } |
471 | 476 | |
472 | 477 | void |
473 | 478 | TraceLoggerThread::startEvent(TraceLoggerTextId id) { |
474 | 479 | startEvent(uint32_t(id)); |
475 | 480 | } |
476 | 481 | |
477 | 482 | void |