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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 | 1291 |
1292 /** | 1292 /** |
1293 * Returns whether or not the associated function is called as a | 1293 * Returns whether or not the associated function is called as a |
1294 * constructor via "new". | 1294 * constructor via "new". |
1295 */ | 1295 */ |
1296 bool IsConstructor() const; | 1296 bool IsConstructor() const; |
1297 }; | 1297 }; |
1298 | 1298 |
1299 | 1299 |
1300 /** | 1300 /** |
1301 * Isolate::Getsample collects the current JS execution state as a sample. | |
alph
2014/09/08 12:47:40
nit: GetSample
gholap
2014/09/08 23:57:38
Done.
| |
1302 * A collected sample contains program counter values. | |
1303 * | |
1304 * Example: Printing out the stack frames' addresses, from top to bottom. | |
1305 * | |
1306 * Isolate* isolate = Isolate::Current(); | |
1307 * Sample sample; | |
1308 * isolate->GetSample(&sample); | |
1309 * const void* const* i; | |
1310 * for (i = sample.begin(); i != sample.end(); ++i) { | |
1311 * printf("%p\n", *i); | |
1312 * } | |
1313 */ | |
1314 class V8_EXPORT Sample { | |
1315 public: | |
1316 enum { kMaxSize = 255u }; | |
1317 | |
1318 Sample() : size_(0) {} | |
1319 template <class InputIterator> | |
1320 Sample(InputIterator first, InputIterator last) : size_(0) { | |
1321 for (; first != last && size_ < kMaxSize; ++first) | |
1322 data_[size_++] = *first; | |
1323 } | |
1324 | |
1325 typedef const void* const* const_iterator; | |
1326 const_iterator begin() const { return &data_[0]; } | |
1327 const_iterator end() const { return &data_[size_]; } | |
1328 size_t size() const { return size_; } | |
1329 | |
1330 private: | |
1331 void const* data_[kMaxSize]; | |
alph
2014/09/08 12:47:40
nit: const void
gholap
2014/09/08 23:57:38
Done.
| |
1332 size_t size_; | |
1333 }; | |
1334 | |
1335 /** | |
1301 * A JSON Parser. | 1336 * A JSON Parser. |
1302 */ | 1337 */ |
1303 class V8_EXPORT JSON { | 1338 class V8_EXPORT JSON { |
1304 public: | 1339 public: |
1305 /** | 1340 /** |
1306 * Tries to parse the string |json_string| and returns it as value if | 1341 * Tries to parse the string |json_string| and returns it as value if |
1307 * successful. | 1342 * successful. |
1308 * | 1343 * |
1309 * \param json_string The string to parse. | 1344 * \param json_string The string to parse. |
1310 * \return The corresponding value if successfully parsed. | 1345 * \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. | 4245 * are in the range of 0 - GetNumberOfDataSlots() - 1. |
4211 */ | 4246 */ |
4212 V8_INLINE static uint32_t GetNumberOfDataSlots(); | 4247 V8_INLINE static uint32_t GetNumberOfDataSlots(); |
4213 | 4248 |
4214 /** | 4249 /** |
4215 * Get statistics about the heap memory usage. | 4250 * Get statistics about the heap memory usage. |
4216 */ | 4251 */ |
4217 void GetHeapStatistics(HeapStatistics* heap_statistics); | 4252 void GetHeapStatistics(HeapStatistics* heap_statistics); |
4218 | 4253 |
4219 /** | 4254 /** |
4255 * Get a sample from the isolate. | |
4256 */ | |
4257 void GetSample(Sample* sample); | |
4258 | |
4259 /** | |
4220 * Adjusts the amount of registered external memory. Used to give V8 an | 4260 * 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 | 4261 * 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 | 4262 * by JavaScript objects. V8 uses this to decide when to perform global |
4223 * garbage collections. Registering externally allocated memory will trigger | 4263 * garbage collections. Registering externally allocated memory will trigger |
4224 * global garbage collections more often than it would otherwise in an attempt | 4264 * global garbage collections more often than it would otherwise in an attempt |
4225 * to garbage collect the JavaScript objects that keep the externally | 4265 * to garbage collect the JavaScript objects that keep the externally |
4226 * allocated memory alive. | 4266 * allocated memory alive. |
4227 * | 4267 * |
4228 * \param change_in_bytes the change in externally allocated memory that is | 4268 * \param change_in_bytes the change in externally allocated memory that is |
4229 * kept alive by JavaScript objects. | 4269 * kept alive by JavaScript objects. |
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6703 */ | 6743 */ |
6704 | 6744 |
6705 | 6745 |
6706 } // namespace v8 | 6746 } // namespace v8 |
6707 | 6747 |
6708 | 6748 |
6709 #undef TYPE_CHECK | 6749 #undef TYPE_CHECK |
6710 | 6750 |
6711 | 6751 |
6712 #endif // V8_H_ | 6752 #endif // V8_H_ |
OLD | NEW |