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

Side by Side Diff: src/utils.h

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp Created 7 years, 1 month 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/unicode.h ('k') | src/v8.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 ASSERT(length == 0 || (length > 0 && data != NULL)); 412 ASSERT(length == 0 || (length > 0 && data != NULL));
413 } 413 }
414 414
415 static Vector<T> New(int length) { 415 static Vector<T> New(int length) {
416 return Vector<T>(NewArray<T>(length), length); 416 return Vector<T>(NewArray<T>(length), length);
417 } 417 }
418 418
419 // Returns a vector using the same backing storage as this one, 419 // Returns a vector using the same backing storage as this one,
420 // spanning from and including 'from', to but not including 'to'. 420 // spanning from and including 'from', to but not including 'to'.
421 Vector<T> SubVector(int from, int to) { 421 Vector<T> SubVector(int from, int to) {
422 ASSERT(to <= length_); 422 SLOW_ASSERT(to <= length_);
423 ASSERT(from < to); 423 SLOW_ASSERT(from < to);
424 ASSERT(0 <= from); 424 ASSERT(0 <= from);
425 return Vector<T>(start() + from, to - from); 425 return Vector<T>(start() + from, to - from);
426 } 426 }
427 427
428 // Returns the length of the vector. 428 // Returns the length of the vector.
429 int length() const { return length_; } 429 int length() const { return length_; }
430 430
431 // Returns whether or not the vector is empty. 431 // Returns whether or not the vector is empty.
432 bool is_empty() const { return length_ == 0; } 432 bool is_empty() const { return length_ == 0; }
433 433
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 bool operator!=(const EnumSet& set) { return bits_ != set.bits_; } 1076 bool operator!=(const EnumSet& set) { return bits_ != set.bits_; }
1077 EnumSet<E, T> operator|(const EnumSet& set) const { 1077 EnumSet<E, T> operator|(const EnumSet& set) const {
1078 return EnumSet<E, T>(bits_ | set.bits_); 1078 return EnumSet<E, T>(bits_ | set.bits_);
1079 } 1079 }
1080 1080
1081 private: 1081 private:
1082 T Mask(E element) const { 1082 T Mask(E element) const {
1083 // The strange typing in ASSERT is necessary to avoid stupid warnings, see: 1083 // The strange typing in ASSERT is necessary to avoid stupid warnings, see:
1084 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680 1084 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680
1085 ASSERT(static_cast<int>(element) < static_cast<int>(sizeof(T) * CHAR_BIT)); 1085 ASSERT(static_cast<int>(element) < static_cast<int>(sizeof(T) * CHAR_BIT));
1086 return 1 << element; 1086 return static_cast<T>(1) << element;
1087 } 1087 }
1088 1088
1089 T bits_; 1089 T bits_;
1090 }; 1090 };
1091 1091
1092 1092
1093 class TypeFeedbackId { 1093 class TypeFeedbackId {
1094 public: 1094 public:
1095 explicit TypeFeedbackId(int id) : id_(id) { } 1095 explicit TypeFeedbackId(int id) : id_(id) { }
1096 int ToInt() const { return id_; } 1096 int ToInt() const { return id_; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 1135
1136 // Every compiled stub starts with this id. 1136 // Every compiled stub starts with this id.
1137 static const int kStubEntryId = 5; 1137 static const int kStubEntryId = 5;
1138 1138
1139 int id_; 1139 int id_;
1140 }; 1140 };
1141 1141
1142 } } // namespace v8::internal 1142 } } // namespace v8::internal
1143 1143
1144 #endif // V8_UTILS_H_ 1144 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/unicode.h ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698