| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
| 6 * | 6 * |
| 7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
| 8 * | 8 * |
| 9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
| 10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
| 11 * | 11 * |
| 12 * For other documentation see http://code.google.com/apis/v8/ | 12 * For other documentation see http://code.google.com/apis/v8/ |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 #ifndef V8_H_ | 15 #ifndef V8_H_ |
| 16 #define V8_H_ | 16 #define V8_H_ |
| 17 | 17 |
| 18 #include "v8stdint.h" | 18 #include "v8stdint.h" |
| 19 | 19 |
| 20 #if V8_OS_WIN || V8_OS_CYGWIN |
| 21 #include "src/base/win32-headers.h" |
| 22 #endif |
| 23 |
| 20 // We reserve the V8_* prefix for macros defined in V8 public API and | 24 // We reserve the V8_* prefix for macros defined in V8 public API and |
| 21 // assume there are no name conflicts with the embedder's code. | 25 // assume there are no name conflicts with the embedder's code. |
| 22 | 26 |
| 23 #ifdef V8_OS_WIN | 27 #ifdef V8_OS_WIN |
| 24 | 28 |
| 25 // Setup for Windows DLL export/import. When building the V8 DLL the | 29 // Setup for Windows DLL export/import. When building the V8 DLL the |
| 26 // BUILDING_V8_SHARED needs to be defined. When building a program which uses | 30 // BUILDING_V8_SHARED needs to be defined. When building a program which uses |
| 27 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 | 31 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 |
| 28 // static library or building a program which uses the V8 static library neither | 32 // static library or building a program which uses the V8 static library neither |
| 29 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. | 33 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. |
| (...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 | 1295 |
| 1292 /** | 1296 /** |
| 1293 * Returns whether or not the associated function is called as a | 1297 * Returns whether or not the associated function is called as a |
| 1294 * constructor via "new". | 1298 * constructor via "new". |
| 1295 */ | 1299 */ |
| 1296 bool IsConstructor() const; | 1300 bool IsConstructor() const; |
| 1297 }; | 1301 }; |
| 1298 | 1302 |
| 1299 | 1303 |
| 1300 /** | 1304 /** |
| 1305 * Isolate::GetSample collects the current JS execution state as a sample. |
| 1306 * A collected sample contains program counter values. |
| 1307 * |
| 1308 * Example: Printing out the stack frames' addresses, from top to bottom. |
| 1309 * |
| 1310 * Isolate* isolate = Isolate::Current(); |
| 1311 * Sample sample; |
| 1312 * isolate->GetSample(&sample); |
| 1313 * const void* const* i; |
| 1314 * for (i = sample.begin(); i != sample.end(); ++i) { |
| 1315 * printf("%p\n", *i); |
| 1316 * } |
| 1317 */ |
| 1318 class V8_EXPORT Sample { |
| 1319 public: |
| 1320 enum { kMaxSize = 255u }; |
| 1321 |
| 1322 Sample() : size_(0) {} |
| 1323 template <class InputIterator> |
| 1324 Sample(InputIterator first, InputIterator last) : size_(0) { |
| 1325 for (; first != last && size_ < kMaxSize; ++first) |
| 1326 data_[size_++] = *first; |
| 1327 } |
| 1328 |
| 1329 typedef const void* const* const_iterator; |
| 1330 const_iterator begin() const { return &data_[0]; } |
| 1331 const_iterator end() const { return &data_[size_]; } |
| 1332 size_t size() const { return size_; } |
| 1333 |
| 1334 private: |
| 1335 const void* data_[kMaxSize]; |
| 1336 size_t size_; |
| 1337 }; |
| 1338 |
| 1339 /** |
| 1301 * A JSON Parser. | 1340 * A JSON Parser. |
| 1302 */ | 1341 */ |
| 1303 class V8_EXPORT JSON { | 1342 class V8_EXPORT JSON { |
| 1304 public: | 1343 public: |
| 1305 /** | 1344 /** |
| 1306 * Tries to parse the string |json_string| and returns it as value if | 1345 * Tries to parse the string |json_string| and returns it as value if |
| 1307 * successful. | 1346 * successful. |
| 1308 * | 1347 * |
| 1309 * \param json_string The string to parse. | 1348 * \param json_string The string to parse. |
| 1310 * \return The corresponding value if successfully parsed. | 1349 * \return The corresponding value if successfully parsed. |
| (...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 * are in the range of 0 - GetNumberOfDataSlots() - 1. | 4249 * are in the range of 0 - GetNumberOfDataSlots() - 1. |
| 4211 */ | 4250 */ |
| 4212 V8_INLINE static uint32_t GetNumberOfDataSlots(); | 4251 V8_INLINE static uint32_t GetNumberOfDataSlots(); |
| 4213 | 4252 |
| 4214 /** | 4253 /** |
| 4215 * Get statistics about the heap memory usage. | 4254 * Get statistics about the heap memory usage. |
| 4216 */ | 4255 */ |
| 4217 void GetHeapStatistics(HeapStatistics* heap_statistics); | 4256 void GetHeapStatistics(HeapStatistics* heap_statistics); |
| 4218 | 4257 |
| 4219 /** | 4258 /** |
| 4259 * Get a sample from the isolate. |
| 4260 */ |
| 4261 #if V8_OS_POSIX && !V8_OS_CYGWIN |
| 4262 void GetSample(Sample* sample); |
| 4263 #elif V8_OS_WIN || V8_OS_CYGWIN |
| 4264 void GetSample(const CONTEXT& context, Sample* sample); |
| 4265 #endif |
| 4266 |
| 4267 /** |
| 4220 * Adjusts the amount of registered external memory. Used to give V8 an | 4268 * Adjusts the amount of registered external memory. Used to give V8 an |
| 4221 * indication of the amount of externally allocated memory that is kept alive | 4269 * indication of the amount of externally allocated memory that is kept alive |
| 4222 * by JavaScript objects. V8 uses this to decide when to perform global | 4270 * by JavaScript objects. V8 uses this to decide when to perform global |
| 4223 * garbage collections. Registering externally allocated memory will trigger | 4271 * garbage collections. Registering externally allocated memory will trigger |
| 4224 * global garbage collections more often than it would otherwise in an attempt | 4272 * global garbage collections more often than it would otherwise in an attempt |
| 4225 * to garbage collect the JavaScript objects that keep the externally | 4273 * to garbage collect the JavaScript objects that keep the externally |
| 4226 * allocated memory alive. | 4274 * allocated memory alive. |
| 4227 * | 4275 * |
| 4228 * \param change_in_bytes the change in externally allocated memory that is | 4276 * \param change_in_bytes the change in externally allocated memory that is |
| 4229 * kept alive by JavaScript objects. | 4277 * kept alive by JavaScript objects. |
| (...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6703 */ | 6751 */ |
| 6704 | 6752 |
| 6705 | 6753 |
| 6706 } // namespace v8 | 6754 } // namespace v8 |
| 6707 | 6755 |
| 6708 | 6756 |
| 6709 #undef TYPE_CHECK | 6757 #undef TYPE_CHECK |
| 6710 | 6758 |
| 6711 | 6759 |
| 6712 #endif // V8_H_ | 6760 #endif // V8_H_ |
| OLD | NEW |