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. |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1315 | 1315 |
1316 /** | 1316 /** |
1317 * Returns whether or not the associated function is called as a | 1317 * Returns whether or not the associated function is called as a |
1318 * constructor via "new". | 1318 * constructor via "new". |
1319 */ | 1319 */ |
1320 bool IsConstructor() const; | 1320 bool IsConstructor() const; |
1321 }; | 1321 }; |
1322 | 1322 |
1323 | 1323 |
1324 /** | 1324 /** |
1325 * Isolate::GetSample collects the current JS execution state as a sample. | |
1326 * A collected sample contains program counter values. | |
1327 * | |
1328 * Example: Printing out the stack frames' addresses, from top to bottom. | |
1329 * | |
1330 * Isolate* isolate = Isolate::Current(); | |
1331 * Sample sample; | |
1332 * isolate->GetSample(&sample); | |
1333 * const void* const* i; | |
1334 * for (i = sample.begin(); i != sample.end(); ++i) { | |
1335 * printf("%p\n", *i); | |
1336 * } | |
1337 */ | |
1338 class V8_EXPORT Sample { | |
1339 public: | |
1340 enum { kMaxSize = 255u }; | |
1341 | |
1342 Sample() : size_(0) {} | |
1343 template <class InputIterator> | |
1344 Sample(InputIterator first, InputIterator last) | |
1345 : size_(0) { | |
1346 for (; first != last && size_ < kMaxSize; ++first) data_[size_++] = *first; | |
1347 } | |
1348 | |
1349 typedef const void* const* const_iterator; | |
1350 const_iterator begin() const { return &data_[0]; } | |
1351 const_iterator end() const { return &data_[size_]; } | |
1352 size_t size() const { return size_; } | |
1353 | |
1354 private: | |
1355 const void* data_[kMaxSize]; | |
1356 size_t size_; | |
1357 }; | |
1358 | |
1359 /** | |
1325 * A JSON Parser. | 1360 * A JSON Parser. |
1326 */ | 1361 */ |
1327 class V8_EXPORT JSON { | 1362 class V8_EXPORT JSON { |
1328 public: | 1363 public: |
1329 /** | 1364 /** |
1330 * Tries to parse the string |json_string| and returns it as value if | 1365 * Tries to parse the string |json_string| and returns it as value if |
1331 * successful. | 1366 * successful. |
1332 * | 1367 * |
1333 * \param json_string The string to parse. | 1368 * \param json_string The string to parse. |
1334 * \return The corresponding value if successfully parsed. | 1369 * \return The corresponding value if successfully parsed. |
(...skipping 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4312 * are in the range of 0 - GetNumberOfDataSlots() - 1. | 4347 * are in the range of 0 - GetNumberOfDataSlots() - 1. |
4313 */ | 4348 */ |
4314 V8_INLINE static uint32_t GetNumberOfDataSlots(); | 4349 V8_INLINE static uint32_t GetNumberOfDataSlots(); |
4315 | 4350 |
4316 /** | 4351 /** |
4317 * Get statistics about the heap memory usage. | 4352 * Get statistics about the heap memory usage. |
4318 */ | 4353 */ |
4319 void GetHeapStatistics(HeapStatistics* heap_statistics); | 4354 void GetHeapStatistics(HeapStatistics* heap_statistics); |
4320 | 4355 |
4321 /** | 4356 /** |
4357 * Get a sample from the isolate. | |
4358 */ | |
4359 void GetSample(Sample* sample); | |
yurys
2014/09/09 14:35:20
This is not what the document proposed. The idea w
jochen (gone - plz use gerrit)
2014/09/10 07:39:20
Agreed.
We'll soon delete threads from v8 and ins
gholap
2014/09/17 02:35:06
Acknowledged.
| |
4360 | |
4361 /** | |
4322 * Adjusts the amount of registered external memory. Used to give V8 an | 4362 * Adjusts the amount of registered external memory. Used to give V8 an |
4323 * indication of the amount of externally allocated memory that is kept alive | 4363 * indication of the amount of externally allocated memory that is kept alive |
4324 * by JavaScript objects. V8 uses this to decide when to perform global | 4364 * by JavaScript objects. V8 uses this to decide when to perform global |
4325 * garbage collections. Registering externally allocated memory will trigger | 4365 * garbage collections. Registering externally allocated memory will trigger |
4326 * global garbage collections more often than it would otherwise in an attempt | 4366 * global garbage collections more often than it would otherwise in an attempt |
4327 * to garbage collect the JavaScript objects that keep the externally | 4367 * to garbage collect the JavaScript objects that keep the externally |
4328 * allocated memory alive. | 4368 * allocated memory alive. |
4329 * | 4369 * |
4330 * \param change_in_bytes the change in externally allocated memory that is | 4370 * \param change_in_bytes the change in externally allocated memory that is |
4331 * kept alive by JavaScript objects. | 4371 * kept alive by JavaScript objects. |
(...skipping 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6824 */ | 6864 */ |
6825 | 6865 |
6826 | 6866 |
6827 } // namespace v8 | 6867 } // namespace v8 |
6828 | 6868 |
6829 | 6869 |
6830 #undef TYPE_CHECK | 6870 #undef TYPE_CHECK |
6831 | 6871 |
6832 | 6872 |
6833 #endif // V8_H_ | 6873 #endif // V8_H_ |
OLD | NEW |