JSContext: moved dot computation to separate function