OLD | NEW |
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 template <typename T> inline T ToCData(v8::internal::Object* obj) { | 119 template <typename T> inline T ToCData(v8::internal::Object* obj) { |
120 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 120 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
121 return reinterpret_cast<T>( | 121 return reinterpret_cast<T>( |
122 reinterpret_cast<intptr_t>( | 122 reinterpret_cast<intptr_t>( |
123 v8::internal::Foreign::cast(obj)->foreign_address())); | 123 v8::internal::Foreign::cast(obj)->foreign_address())); |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 template <typename T> | 127 template <typename T> |
128 inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { | 128 inline v8::internal::Handle<v8::internal::Object> FromCData(T obj) { |
| 129 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); |
129 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); | 130 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); |
130 return FACTORY->NewForeign( | 131 return isolate->factory()->NewForeign( |
131 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); | 132 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); |
132 } | 133 } |
133 | 134 |
134 | 135 |
135 class ApiFunction { | 136 class ApiFunction { |
136 public: | 137 public: |
137 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } | 138 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } |
138 v8::internal::Address address() { return addr_; } | 139 v8::internal::Address address() { return addr_; } |
139 private: | 140 private: |
140 v8::internal::Address addr_; | 141 v8::internal::Address addr_; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 stress_type_ = stress_type; | 669 stress_type_ = stress_type; |
669 } | 670 } |
670 | 671 |
671 private: | 672 private: |
672 static v8::Testing::StressType stress_type_; | 673 static v8::Testing::StressType stress_type_; |
673 }; | 674 }; |
674 | 675 |
675 } } // namespace v8::internal | 676 } } // namespace v8::internal |
676 | 677 |
677 #endif // V8_API_H_ | 678 #endif // V8_API_H_ |
OLD | NEW |