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. | |
41 | 40 |
42 template<typename T> | 41 template<typename T> |
43 class MaybeHandle { | 42 class MaybeHandle { |
44 public: | 43 public: |
45 INLINE(MaybeHandle()) : location_(NULL) { } | 44 INLINE(MaybeHandle()) : location_(NULL) { } |
46 | 45 |
47 // Constructor for handling automatic up casting from Handle. | 46 // Constructor for handling automatic up casting from Handle. |
48 // Ex. Handle<JSArray> can be passed when MaybeHandle<Object> is expected. | 47 // Ex. Handle<JSArray> can be passed when MaybeHandle<Object> is expected. |
49 template <class S> MaybeHandle(Handle<S> handle) { | 48 template <class S> MaybeHandle(Handle<S> handle) { |
50 #ifdef DEBUG | 49 #ifdef DEBUG |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 379 |
381 void Initialize() { | 380 void Initialize() { |
382 next = limit = NULL; | 381 next = limit = NULL; |
383 level = 0; | 382 level = 0; |
384 } | 383 } |
385 }; | 384 }; |
386 | 385 |
387 } } // namespace v8::internal | 386 } } // namespace v8::internal |
388 | 387 |
389 #endif // V8_HANDLES_H_ | 388 #endif // V8_HANDLES_H_ |
OLD | NEW |