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

Side by Side Diff: src/utils.h

Issue 173115: Change some integer types to make the x64 Win32 platform happier. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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/platform-win32.cc ('k') | src/x64/codegen-x64.cc » ('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 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 108
109 template <typename T> 109 template <typename T>
110 static inline bool IsAligned(T value, T alignment) { 110 static inline bool IsAligned(T value, T alignment) {
111 ASSERT(IsPowerOf2(alignment)); 111 ASSERT(IsPowerOf2(alignment));
112 return (value & (alignment - 1)) == 0; 112 return (value & (alignment - 1)) == 0;
113 } 113 }
114 114
115 115
116 // Returns true if (addr + offset) is aligned. 116 // Returns true if (addr + offset) is aligned.
117 static inline bool IsAddressAligned(Address addr, int alignment, int offset) { 117 static inline bool IsAddressAligned(Address addr,
118 int offs = OffsetFrom(addr + offset); 118 intptr_t alignment,
119 int offset) {
120 intptr_t offs = OffsetFrom(addr + offset);
119 return IsAligned(offs, alignment); 121 return IsAligned(offs, alignment);
120 } 122 }
121 123
122 124
123 // Returns the maximum of the two parameters. 125 // Returns the maximum of the two parameters.
124 template <typename T> 126 template <typename T>
125 static T Max(T a, T b) { 127 static T Max(T a, T b) {
126 return a < b ? b : a; 128 return a < b ? b : a;
127 } 129 }
128 130
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 class ScopedVector : public Vector<T> { 441 class ScopedVector : public Vector<T> {
440 public: 442 public:
441 explicit ScopedVector(int length) : Vector<T>(NewArray<T>(length), length) { } 443 explicit ScopedVector(int length) : Vector<T>(NewArray<T>(length), length) { }
442 ~ScopedVector() { 444 ~ScopedVector() {
443 DeleteArray(this->start()); 445 DeleteArray(this->start());
444 } 446 }
445 }; 447 };
446 448
447 449
448 inline Vector<const char> CStrVector(const char* data) { 450 inline Vector<const char> CStrVector(const char* data) {
449 return Vector<const char>(data, strlen(data)); 451 return Vector<const char>(data, static_cast<int>(strlen(data)));
450 } 452 }
451 453
452 inline Vector<char> MutableCStrVector(char* data) { 454 inline Vector<char> MutableCStrVector(char* data) {
453 return Vector<char>(data, strlen(data)); 455 return Vector<char>(data, static_cast<int>(strlen(data)));
454 } 456 }
455 457
456 inline Vector<char> MutableCStrVector(char* data, int max) { 458 inline Vector<char> MutableCStrVector(char* data, int max) {
457 int length = strlen(data); 459 int length = static_cast<int>(strlen(data));
458 return Vector<char>(data, (length < max) ? length : max); 460 return Vector<char>(data, (length < max) ? length : max);
459 } 461 }
460 462
461 template <typename T> 463 template <typename T>
462 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms, 464 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms,
463 int length) { 465 int length) {
464 return Vector< Handle<Object> >( 466 return Vector< Handle<Object> >(
465 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length); 467 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length);
466 } 468 }
467 469
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 #endif 572 #endif
571 while (dest < limit) { 573 while (dest < limit) {
572 *dest++ = static_cast<sinkchar>(*src++); 574 *dest++ = static_cast<sinkchar>(*src++);
573 } 575 }
574 } 576 }
575 577
576 578
577 } } // namespace v8::internal 579 } } // namespace v8::internal
578 580
579 #endif // V8_UTILS_H_ 581 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/platform-win32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698