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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 # define V8_EXPORT __attribute__ ((visibility("default"))) | 48 # define V8_EXPORT __attribute__ ((visibility("default"))) |
49 # else | 49 # else |
50 # define V8_EXPORT | 50 # define V8_EXPORT |
51 # endif | 51 # endif |
52 #else | 52 #else |
53 # define V8_EXPORT | 53 # define V8_EXPORT |
54 #endif | 54 #endif |
55 | 55 |
56 #endif // V8_OS_WIN | 56 #endif // V8_OS_WIN |
57 | 57 |
58 #if V8_OS_POSIX && !V8_OS_CYGWIN | |
59 #include <ucontext.h> | |
60 typedef ucontext_t context_t; | |
61 #elif V8_OS_WIN || V8_OS_CYGWIN | |
62 #include "src/base/win32-headers.h" | |
63 /* #include <windows.h> */ | |
64 /* #if !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR) */ | |
yurys
2014/09/19 08:08:11
We shouldn't expose all this platform-specific stu
| |
65 /* #include <dbghelp.h> // For SymLoadModule64 and al. */ | |
66 /* #endif // !defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR) */ | |
67 /* #include <ws2tcpip.h> */ | |
68 /* #undef CONST */ | |
69 /* #undef STRICT */ | |
70 typedef CONTEXT context_t; | |
71 #endif | |
72 | |
58 /** | 73 /** |
59 * The v8 JavaScript engine. | 74 * The v8 JavaScript engine. |
60 */ | 75 */ |
61 namespace v8 { | 76 namespace v8 { |
62 | 77 |
63 class AccessorSignature; | 78 class AccessorSignature; |
64 class Array; | 79 class Array; |
65 class Boolean; | 80 class Boolean; |
66 class BooleanObject; | 81 class BooleanObject; |
67 class Context; | 82 class Context; |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1408 bool IsEval() const; | 1423 bool IsEval() const; |
1409 | 1424 |
1410 /** | 1425 /** |
1411 * Returns whether or not the associated function is called as a | 1426 * Returns whether or not the associated function is called as a |
1412 * constructor via "new". | 1427 * constructor via "new". |
1413 */ | 1428 */ |
1414 bool IsConstructor() const; | 1429 bool IsConstructor() const; |
1415 }; | 1430 }; |
1416 | 1431 |
1417 | 1432 |
1433 struct RegisterState { | |
1434 RegisterState() : pc(NULL), sp(NULL), fp(NULL) {} | |
1435 explicit RegisterState(const context_t& context); | |
yurys
2014/09/19 08:08:11
This is a platform-specific constructor, please do
| |
1436 void* pc; // Instruction pointer. | |
1437 void* sp; // Stack pointer. | |
1438 void* fp; // Frame pointer. | |
1439 }; | |
1440 | |
1441 | |
1442 /** | |
1443 * Isolate::GetSample collects the current JS execution state as a sample. | |
1444 * A collected sample contains program counter values. | |
1445 */ | |
1446 class V8_EXPORT Sample { | |
1447 public: | |
1448 enum { kMaxSize = 255u }; | |
1449 | |
1450 Sample() : size_(0) {} | |
1451 template <class InputIterator> | |
1452 Sample(InputIterator first, InputIterator last) | |
1453 : size_(0) { | |
1454 for (; first != last && size_ < kMaxSize; ++first) data_[size_++] = *first; | |
1455 } | |
1456 | |
1457 typedef const void* const* const_iterator; | |
1458 const_iterator begin() const { return &data_[0]; } | |
1459 const_iterator end() const { return &data_[size_]; } | |
1460 size_t size() const { return size_; } | |
1461 | |
1462 private: | |
1463 const void* data_[kMaxSize]; | |
1464 size_t size_; | |
1465 }; | |
1466 | |
1467 | |
1418 /** | 1468 /** |
1419 * A JSON Parser. | 1469 * A JSON Parser. |
1420 */ | 1470 */ |
1421 class V8_EXPORT JSON { | 1471 class V8_EXPORT JSON { |
1422 public: | 1472 public: |
1423 /** | 1473 /** |
1424 * Tries to parse the string |json_string| and returns it as value if | 1474 * Tries to parse the string |json_string| and returns it as value if |
1425 * successful. | 1475 * successful. |
1426 * | 1476 * |
1427 * \param json_string The string to parse. | 1477 * \param json_string The string to parse. |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4542 * are in the range of 0 - GetNumberOfDataSlots() - 1. | 4592 * are in the range of 0 - GetNumberOfDataSlots() - 1. |
4543 */ | 4593 */ |
4544 V8_INLINE static uint32_t GetNumberOfDataSlots(); | 4594 V8_INLINE static uint32_t GetNumberOfDataSlots(); |
4545 | 4595 |
4546 /** | 4596 /** |
4547 * Get statistics about the heap memory usage. | 4597 * Get statistics about the heap memory usage. |
4548 */ | 4598 */ |
4549 void GetHeapStatistics(HeapStatistics* heap_statistics); | 4599 void GetHeapStatistics(HeapStatistics* heap_statistics); |
4550 | 4600 |
4551 /** | 4601 /** |
4602 * Get a sample from the isolate. | |
4603 * \param sp Stack pointer. | |
yurys
2014/09/19 08:08:11
There are not such params, they are passed as |sta
| |
4604 * \param fp Frame pointer. | |
4605 * \param sample Pointer to (a pre-allocated) sample which will be filled. | |
4606 * \note GetSample should only be called when the JS thread is paused or | |
4607 * interrupted. If that is not the case, | |
4608 * GetSample behaviour is undefined. | |
4609 */ | |
4610 void GetSample(const RegisterState& state, Sample* sample); | |
4611 | |
4612 /** | |
4552 * Adjusts the amount of registered external memory. Used to give V8 an | 4613 * Adjusts the amount of registered external memory. Used to give V8 an |
4553 * indication of the amount of externally allocated memory that is kept alive | 4614 * indication of the amount of externally allocated memory that is kept alive |
4554 * by JavaScript objects. V8 uses this to decide when to perform global | 4615 * by JavaScript objects. V8 uses this to decide when to perform global |
4555 * garbage collections. Registering externally allocated memory will trigger | 4616 * garbage collections. Registering externally allocated memory will trigger |
4556 * global garbage collections more often than it would otherwise in an attempt | 4617 * global garbage collections more often than it would otherwise in an attempt |
4557 * to garbage collect the JavaScript objects that keep the externally | 4618 * to garbage collect the JavaScript objects that keep the externally |
4558 * allocated memory alive. | 4619 * allocated memory alive. |
4559 * | 4620 * |
4560 * \param change_in_bytes the change in externally allocated memory that is | 4621 * \param change_in_bytes the change in externally allocated memory that is |
4561 * kept alive by JavaScript objects. | 4622 * kept alive by JavaScript objects. |
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6995 */ | 7056 */ |
6996 | 7057 |
6997 | 7058 |
6998 } // namespace v8 | 7059 } // namespace v8 |
6999 | 7060 |
7000 | 7061 |
7001 #undef TYPE_CHECK | 7062 #undef TYPE_CHECK |
7002 | 7063 |
7003 | 7064 |
7004 #endif // V8_H_ | 7065 #endif // V8_H_ |
OLD | NEW |