Open Scope: A Pragmatic JavaScript Pattern for Modular Instrumentation

Florent Marchand de Kerchove, Jacques Noyé, Mario Südholt · HAL (Le Centre pour la Communication Scientifique Directe) · 2015

We report on our experience instrumenting Narcissus, a JavaScript interpreter written in JavaScript, to allow the dynamic deployment of dynamic program analyses. Instrumenting an interpreter is a cross-cutting change that can affect many parts of the interpreter source code. We propose a simple open scope pattern that minimizes the changes to the interpreter, while allowing us to implement program analyses in their own files, and to compose them dynamically. We apply our pattern to Narcissus using standard JavaScript features, and find that the gain in extensibility offsets a small loss in performance.

Read the paper · More papers on PaperTik