| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 }; | 405 }; |
| 406 | 406 |
| 407 | 407 |
| 408 template <typename T> | 408 template <typename T> |
| 409 class ScopedVector : public Vector<T> { | 409 class ScopedVector : public Vector<T> { |
| 410 public: | 410 public: |
| 411 explicit ScopedVector(int length) : Vector<T>(NewArray<T>(length), length) { } | 411 explicit ScopedVector(int length) : Vector<T>(NewArray<T>(length), length) { } |
| 412 ~ScopedVector() { | 412 ~ScopedVector() { |
| 413 DeleteArray(this->start()); | 413 DeleteArray(this->start()); |
| 414 } | 414 } |
| 415 |
| 416 private: |
| 417 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedVector); |
| 415 }; | 418 }; |
| 416 | 419 |
| 417 | 420 |
| 418 inline Vector<const char> CStrVector(const char* data) { | 421 inline Vector<const char> CStrVector(const char* data) { |
| 419 return Vector<const char>(data, StrLength(data)); | 422 return Vector<const char>(data, StrLength(data)); |
| 420 } | 423 } |
| 421 | 424 |
| 422 inline Vector<char> MutableCStrVector(char* data) { | 425 inline Vector<char> MutableCStrVector(char* data) { |
| 423 return Vector<char>(data, StrLength(data)); | 426 return Vector<char>(data, StrLength(data)); |
| 424 } | 427 } |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 657 |
| 655 Dest dest; | 658 Dest dest; |
| 656 memcpy(&dest, &source, sizeof(dest)); | 659 memcpy(&dest, &source, sizeof(dest)); |
| 657 return dest; | 660 return dest; |
| 658 } | 661 } |
| 659 | 662 |
| 660 } } // namespace v8::internal | 663 } } // namespace v8::internal |
| 661 | 664 |
| 662 | 665 |
| 663 #endif // V8_UTILS_H_ | 666 #endif // V8_UTILS_H_ |
| OLD | NEW |