OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 template <typename T> | 414 template <typename T> |
415 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms, | 415 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms, |
416 int length) { | 416 int length) { |
417 return Vector< Handle<Object> >( | 417 return Vector< Handle<Object> >( |
418 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length); | 418 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length); |
419 } | 419 } |
420 | 420 |
421 | 421 |
422 // Simple support to read a file into a 0-terminated C-string. | 422 // Simple support to read a file into a 0-terminated C-string. |
423 // The returned buffer must be freed by the caller. | 423 // The returned buffer must be freed by the caller. |
424 // On return, *exits tells whether the file exisited. | 424 // On return, *exits tells whether the file existed. |
425 Vector<const char> ReadFile(const char* filename, | 425 Vector<const char> ReadFile(const char* filename, |
426 bool* exists, | 426 bool* exists, |
427 bool verbose = true); | 427 bool verbose = true); |
428 | 428 |
429 | 429 |
430 // Simple wrapper that allows an ExternalString to refer to a | 430 // Simple wrapper that allows an ExternalString to refer to a |
431 // Vector<const char>. Doesn't assume ownership of the data. | 431 // Vector<const char>. Doesn't assume ownership of the data. |
432 class AsciiStringAdapter: public v8::String::ExternalAsciiStringResource { | 432 class AsciiStringAdapter: public v8::String::ExternalAsciiStringResource { |
433 public: | 433 public: |
434 explicit AsciiStringAdapter(Vector<const char> data) : data_(data) {} | 434 explicit AsciiStringAdapter(Vector<const char> data) : data_(data) {} |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 ptr[2] = value >> 8; | 572 ptr[2] = value >> 8; |
573 ptr[1] = value >> 16; | 573 ptr[1] = value >> 16; |
574 ptr[0] = value >> 24; | 574 ptr[0] = value >> 24; |
575 #endif | 575 #endif |
576 } | 576 } |
577 | 577 |
578 | 578 |
579 } } // namespace v8::internal | 579 } } // namespace v8::internal |
580 | 580 |
581 #endif // V8_UTILS_H_ | 581 #endif // V8_UTILS_H_ |
OLD | NEW |