Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: src/v8utils.h

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/v8natives.js ('k') | src/variables.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #ifndef V8_V8UTILS_H_ 28 #ifndef V8_V8UTILS_H_
29 #define V8_V8UTILS_H_ 29 #define V8_V8UTILS_H_
30 30
31 #include "utils.h" 31 #include "utils.h"
32 #include "platform.h" // For va_list on Solaris.
32 33
33 namespace v8 { 34 namespace v8 {
34 namespace internal { 35 namespace internal {
35 36
36 // ---------------------------------------------------------------------------- 37 // ----------------------------------------------------------------------------
37 // I/O support. 38 // I/O support.
38 39
39 #if __GNUC__ >= 4 40 #if __GNUC__ >= 4
40 // On gcc we can ask the compiler to check the types of %d-style format 41 // On gcc we can ask the compiler to check the types of %d-style format
41 // specifiers and their associated arguments. TODO(erikcorry) fix this 42 // specifiers and their associated arguments. TODO(erikcorry) fix this
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 dest += kStepSize; 309 dest += kStepSize;
309 src += kStepSize; 310 src += kStepSize;
310 } 311 }
311 } 312 }
312 #endif 313 #endif
313 while (dest < limit) { 314 while (dest < limit) {
314 *dest++ = static_cast<sinkchar>(*src++); 315 *dest++ = static_cast<sinkchar>(*src++);
315 } 316 }
316 } 317 }
317 318
319
320 // A resource for using mmapped files to back external strings that are read
321 // from files.
322 class MemoryMappedExternalResource: public
323 v8::String::ExternalAsciiStringResource {
324 public:
325 explicit MemoryMappedExternalResource(const char* filename);
326 MemoryMappedExternalResource(const char* filename,
327 bool remove_file_on_cleanup);
328 virtual ~MemoryMappedExternalResource();
329
330 virtual const char* data() const { return data_; }
331 virtual size_t length() const { return length_; }
332
333 bool exists() const { return file_ != NULL; }
334 bool is_empty() const { return length_ == 0; }
335
336 bool EnsureIsAscii(bool abort_if_failed) const;
337 bool EnsureIsAscii() const { return EnsureIsAscii(true); }
338 bool IsAscii() const { return EnsureIsAscii(false); }
339
340 private:
341 void Init(const char* filename);
342
343 char* filename_;
344 OS::MemoryMappedFile* file_;
345
346 const char* data_;
347 size_t length_;
348 bool remove_file_on_cleanup_;
349 };
350
351
318 } } // namespace v8::internal 352 } } // namespace v8::internal
319 353
320 #endif // V8_V8UTILS_H_ 354 #endif // V8_V8UTILS_H_
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | src/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698