| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 T* start_; | 370 T* start_; |
| 371 int length_; | 371 int length_; |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 | 374 |
| 375 // A temporary assignment sets a (non-local) variable to a value on | 375 // A temporary assignment sets a (non-local) variable to a value on |
| 376 // construction and resets it the value on destruction. | 376 // construction and resets it the value on destruction. |
| 377 template <typename T> | 377 template <typename T> |
| 378 class TempAssign { | 378 class TempAssign { |
| 379 public: | 379 public: |
| 380 TempAssign(T* var, T value): var_(var), old_value_(*var) { | 380 TempAssign(T* var, const T& value): var_(var), old_value_(*var) { |
| 381 *var = value; | 381 *var = value; |
| 382 } | 382 } |
| 383 | 383 |
| 384 ~TempAssign() { *var_ = old_value_; } | 384 ~TempAssign() { *var_ = old_value_; } |
| 385 | 385 |
| 386 const T& old_value() const { return old_value_; }; |
| 387 |
| 386 private: | 388 private: |
| 387 T* var_; | 389 T* var_; |
| 388 T old_value_; | 390 T old_value_; |
| 389 }; | 391 }; |
| 390 | 392 |
| 391 | 393 |
| 392 template <typename T, int kSize> | 394 template <typename T, int kSize> |
| 393 class EmbeddedVector : public Vector<T> { | 395 class EmbeddedVector : public Vector<T> { |
| 394 public: | 396 public: |
| 395 EmbeddedVector() : Vector<T>(buffer_, kSize) { } | 397 EmbeddedVector() : Vector<T>(buffer_, kSize) { } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 ptr[2] = value >> 8; | 574 ptr[2] = value >> 8; |
| 573 ptr[1] = value >> 16; | 575 ptr[1] = value >> 16; |
| 574 ptr[0] = value >> 24; | 576 ptr[0] = value >> 24; |
| 575 #endif | 577 #endif |
| 576 } | 578 } |
| 577 | 579 |
| 578 | 580 |
| 579 } } // namespace v8::internal | 581 } } // namespace v8::internal |
| 580 | 582 |
| 581 #endif // V8_UTILS_H_ | 583 #endif // V8_UTILS_H_ |
| OLD | NEW |