esri.Graphic requires four parameters instead of two (geometry, symbol, attributes, infoTemplate). So even if you don't need the other two, I think you need them to be there. try this:
map.graphics.add(new esri.Graphic(polyline, polylineSymbol, null, null));
Hope this helps.
... View more