44 #if defined(__MACH__) && defined(__APPLE__)
45 #define PRINTF_CHECKING
46 #define FPRINTF_CHECKING
48 #define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2)))
49 #define FPRINTF_CHECKING __attribute__ ((format (printf, 2, 3)))
52 #define PRINTF_CHECKING
53 #define FPRINTF_CHECKING
64 void Flush(FILE* out);
103 bool verbose =
true);
110 int WriteAsCFile(
const char* filename,
const char* varname,
111 const char* str,
int size,
bool verbose =
true);
117 template <
typename T>
129 template <
typename T>
132 ASSERT(
Min(dst, const_cast<T*>(src)) + num_words <=
133 Max(dst, const_cast<T*>(src)));
138 static const size_t kBlockCopyLimit = 16;
140 if (num_words < kBlockCopyLimit) {
144 }
while (num_words > 0);
152 template <
typename T>
159 static const size_t kBlockCopyLimit = 16;
161 if (num_words < kBlockCopyLimit &&
162 ((dst < src) || (dst >= (src + num_words *
kPointerSize)))) {
163 T* end = dst + num_words;
167 }
while (num_words > 0);
175 template <
typename T>
178 ASSERT(
Min(dst, const_cast<T*>(src)) + num_bytes <=
179 Max(dst, const_cast<T*>(src)));
180 if (num_bytes == 0)
return;
186 if (num_bytes < static_cast<size_t>(kBlockCopyLimit)) {
190 }
while (num_bytes > 0);
197 template <
typename T,
typename U>
205 #if V8_HOST_ARCH_IA32
207 #elif V8_HOST_ARCH_X64
210 #if defined(__native_client__)
218 #if defined(__GNUC__) && defined(STOS)
222 :
"+&c" (counter),
"+&D" (dest)
226 for (
int i = 0; i < counter; i++) {
241 virtual const char*
data()
const {
return data_.
start(); }
253 Vector<const char>
ReadFile(
const char* filename,
255 bool verbose =
true);
256 Vector<const char>
ReadFile(FILE* file,
258 bool verbose =
true);
261 template <
typename source
char,
typename sink
char>
263 const sourcechar* src,
265 #if defined(V8_HOST_ARCH_ARM)
269 #elif defined(V8_HOST_ARCH_MIPS)
275 template <
typename source
char,
typename sink
char>
276 INLINE(
void CopyChars(sinkchar* dest,
const sourcechar* src,
int chars));
278 template<
typename source
char,
typename sink
char>
279 void CopyChars(sinkchar* dest,
const sourcechar* src,
int chars) {
280 ASSERT(
sizeof(sourcechar) <= 2);
281 ASSERT(
sizeof(sinkchar) <= 2);
282 if (
sizeof(sinkchar) == 1) {
283 if (
sizeof(sourcechar) == 1) {
285 reinterpret_cast<const uint8_t*>(src),
289 reinterpret_cast<const uint16_t*>(src),
293 if (
sizeof(sourcechar) == 1) {
295 reinterpret_cast<const uint8_t*>(src),
299 reinterpret_cast<const uint16_t*>(src),
305 template <
typename source
char,
typename sink
char>
307 sinkchar* limit = dest + chars;
308 #ifdef V8_HOST_CAN_READ_UNALIGNED
309 if (
sizeof(*dest) ==
sizeof(*src)) {
315 static const int kStepSize =
sizeof(uintptr_t) /
sizeof(*dest);
316 ASSERT(dest + kStepSize > dest);
317 while (dest + kStepSize <= limit) {
318 *
reinterpret_cast<uintptr_t*
>(dest) =
319 *reinterpret_cast<const uintptr_t*>(src);
325 while (dest < limit) {
326 *dest++ =
static_cast<sinkchar
>(*src++);
331 #if defined(V8_HOST_ARCH_ARM)
333 switch (static_cast<unsigned>(chars)) {
340 memcpy(dest, src, 2);
343 memcpy(dest, src, 3);
346 memcpy(dest, src, 4);
349 memcpy(dest, src, 5);
352 memcpy(dest, src, 6);
355 memcpy(dest, src, 7);
358 memcpy(dest, src, 8);
361 memcpy(dest, src, 9);
364 memcpy(dest, src, 10);
367 memcpy(dest, src, 11);
370 memcpy(dest, src, 12);
373 memcpy(dest, src, 13);
376 memcpy(dest, src, 14);
379 memcpy(dest, src, 15);
389 if (chars >= OS::kMinComplexConvertMemCopy) {
390 OS::MemCopyUint16Uint8(dest, src, chars);
392 OS::MemCopyUint16Uint8Wrapper(dest, src, chars);
398 switch (static_cast<unsigned>(chars)) {
405 memcpy(dest, src, 4);
408 memcpy(dest, src, 6);
411 memcpy(dest, src, 8);
414 memcpy(dest, src, 10);
417 memcpy(dest, src, 12);
420 memcpy(dest, src, 14);
429 #elif defined(V8_HOST_ARCH_MIPS)
432 memcpy(dest, src, chars);
440 memcpy(dest, src, chars *
sizeof(*dest));
464 #endif // V8_V8UTILS_H_
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,...)
virtual size_t length() const
#define ASSERT(condition)
byte * ReadBytes(const char *filename, int *size, bool verbose)
char * ReadLine(const char *prompt)
static const int kMinComplexMemCopy
void CopyCharsUnsigned(sinkchar *dest, const sourcechar *src, int chars)
AsciiStringAdapter(Vector< const char > data)
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_ASSERT(sizeof(CPURegister)==sizeof(Register))
static void MemCopy(void *dest, const void *src, size_t size)
Vector< const char > ReadFile(const char *filename, bool *exists, bool verbose)
static void MemMove(void *dest, const void *src, size_t size)
void AddFormatted(const char *format,...)
StringBuilder(char *buffer, int size)
void CopyWords(T *dst, const T *src, size_t num_words)
#define T(name, string, precedence)
void AddFormattedList(const char *format, va_list list)
int WriteChars(const char *filename, const char *str, int size, bool verbose)
INLINE(static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
int WriteAsCFile(const char *filename, const char *varname, const char *str, int size, bool verbose=true)
int AppendChars(const char *filename, const char *str, int size, bool verbose)
void CopyBytes(uint8_t *target, uint8_t *source)
void MemsetPointer(T **dest, U *value, int counter)
void PrintPID(const char *format,...)
void MoveWords(T *dst, const T *src, size_t num_words)
int WriteBytes(const char *filename, const byte *bytes, int size, bool verbose)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
void CopyChars(sinkchar *dest, const sourcechar *src, int chars)
virtual const char * data() const