OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "objects.h" | 32 #include "objects.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // A Handle can be converted into a MaybeHandle. Converting a MaybeHandle | 37 // A Handle can be converted into a MaybeHandle. Converting a MaybeHandle |
38 // into a Handle requires checking that it does not point to NULL. This | 38 // into a Handle requires checking that it does not point to NULL. This |
39 // ensures NULL checks before use. | 39 // ensures NULL checks before use. |
| 40 // Do not use MaybeHandle as argument type. |
40 | 41 |
41 template<typename T> | 42 template<typename T> |
42 class MaybeHandle { | 43 class MaybeHandle { |
43 public: | 44 public: |
44 INLINE(MaybeHandle()) : location_(NULL) { } | 45 INLINE(MaybeHandle()) : location_(NULL) { } |
45 | 46 |
46 // Constructor for handling automatic up casting from Handle. | 47 // Constructor for handling automatic up casting from Handle. |
47 // Ex. Handle<JSArray> can be passed when MaybeHandle<Object> is expected. | 48 // Ex. Handle<JSArray> can be passed when MaybeHandle<Object> is expected. |
48 template <class S> MaybeHandle(Handle<S> handle) { | 49 template <class S> MaybeHandle(Handle<S> handle) { |
49 #ifdef DEBUG | 50 #ifdef DEBUG |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 380 |
380 void Initialize() { | 381 void Initialize() { |
381 next = limit = NULL; | 382 next = limit = NULL; |
382 level = 0; | 383 level = 0; |
383 } | 384 } |
384 }; | 385 }; |
385 | 386 |
386 } } // namespace v8::internal | 387 } } // namespace v8::internal |
387 | 388 |
388 #endif // V8_HANDLES_H_ | 389 #endif // V8_HANDLES_H_ |
OLD | NEW |