40 void PrintF(
const char* format, ...) {
42 va_start(arguments, format);
48 void PrintF(FILE* out,
const char* format, ...) {
50 va_start(arguments, format);
59 va_start(arguments, format);
74 bool keep_going =
true;
75 fprintf(stdout,
"%s", prompt);
78 if (fgets(line_buf,
sizeof(line_buf), stdin) ==
NULL) {
87 line_buf[len - 2] ==
'\\' &&
88 line_buf[len - 1] ==
'\n') {
91 line_buf[len - 2] =
'\n';
92 line_buf[len - 1] = 0;
94 }
else if ((len > 0) && (line_buf[len - 1] ==
'\n')) {
101 result = NewArray<char>(len + 1);
104 int new_len = offset + len + 1;
105 char* new_result = NewArray<char>(new_len);
117 result[offset] =
'\0';
126 const char* filename) {
127 if (file ==
NULL || fseek(file, 0, SEEK_END) != 0) {
138 char* result = NewArray<char>(*size + extra_space);
139 for (
int i = 0; i < *size && feof(file) == 0;) {
140 int read =
static_cast<int>(fread(&result[i], 1, *size - i, file));
141 if (read != (*size - i) && ferror(file) != 0) {
158 if (file !=
NULL) fclose(file);
165 return reinterpret_cast<byte*
>(chars);
169 static Vector<const char> SetVectorContents(
char* chars,
178 return Vector<const char>(chars,
size);
187 return SetVectorContents(result, size, exists);
196 return SetVectorContents(result, size, exists);
202 while (total < size) {
203 int write =
static_cast<int>(fwrite(str, 1, size - total, f));
252 const char* str =
reinterpret_cast<const char*
>(bytes);
253 return WriteChars(filename, str, size, verbose);
260 va_start(arguments, format);
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
void PrintF(const char *format,...)
static int VSNPrintF(Vector< char > str, const char *format, va_list args)
char * ReadCharsFromFile(FILE *file, int *size, int extra_space, bool verbose, const char *filename)
#define ASSERT(condition)
static void VFPrint(FILE *out, const char *format, va_list args)
byte * ReadBytes(const char *filename, int *size, bool verbose)
char * ReadLine(const char *prompt)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
static void MemCopy(void *dest, const void *src, size_t size)
bool is_finalized() const
Vector< const char > ReadFile(const char *filename, bool *exists, bool verbose)
static FILE * FOpen(const char *path, const char *mode)
static void VPrint(const char *format, va_list args)
void AddFormatted(const char *format,...)
static int GetCurrentProcessId()
int WriteCharsToFile(const char *str, int size, FILE *f)
int StrLength(const char *string)
static void Print(const char *format,...)
void AddFormattedList(const char *format, va_list list)
int WriteChars(const char *filename, const char *str, int size, bool verbose)
int AppendChars(const char *filename, const char *str, int size, bool verbose)
static void PrintError(const char *format,...)
void PrintPID(const char *format,...)
static Vector< T > empty()
int WriteBytes(const char *filename, const byte *bytes, int size, bool verbose)
void DeleteArray(T *array)