Compiler and runtime techniques for optimizing dynamic scripting languages