Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: include/v8.h

Issue 596533002: Initial implementation of GetStackSample sampling profiler API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ARM32 build. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 bool IsEval() const; 1408 bool IsEval() const;
1409 1409
1410 /** 1410 /**
1411 * Returns whether or not the associated function is called as a 1411 * Returns whether or not the associated function is called as a
1412 * constructor via "new". 1412 * constructor via "new".
1413 */ 1413 */
1414 bool IsConstructor() const; 1414 bool IsConstructor() const;
1415 }; 1415 };
1416 1416
1417 1417
1418 // A StateTag represents a possible state of the VM.
1419 enum StateTag { JS, GC, COMPILER, OTHER, EXTERNAL, IDLE };
1420
1421
1422 // A RegisterState represents the current state of registers used
1423 // by the sampling profiler API.
1424 struct RegisterState {
1425 RegisterState() : pc(NULL), sp(NULL), fp(NULL) {}
1426 void* pc; // Instruction pointer.
1427 void* sp; // Stack pointer.
1428 void* fp; // Frame pointer.
1429 };
1430
1431
1432 // The output structure filled up by GetStackSample API function.
1433 struct SampleInfo {
1434 size_t frames_count;
1435 StateTag vm_state;
1436 };
1437
1438
1418 /** 1439 /**
1419 * A JSON Parser. 1440 * A JSON Parser.
1420 */ 1441 */
1421 class V8_EXPORT JSON { 1442 class V8_EXPORT JSON {
1422 public: 1443 public:
1423 /** 1444 /**
1424 * Tries to parse the string |json_string| and returns it as value if 1445 * Tries to parse the string |json_string| and returns it as value if
1425 * successful. 1446 * successful.
1426 * 1447 *
1427 * \param json_string The string to parse. 1448 * \param json_string The string to parse.
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 * are in the range of 0 - GetNumberOfDataSlots() - 1. 4562 * are in the range of 0 - GetNumberOfDataSlots() - 1.
4542 */ 4563 */
4543 V8_INLINE static uint32_t GetNumberOfDataSlots(); 4564 V8_INLINE static uint32_t GetNumberOfDataSlots();
4544 4565
4545 /** 4566 /**
4546 * Get statistics about the heap memory usage. 4567 * Get statistics about the heap memory usage.
4547 */ 4568 */
4548 void GetHeapStatistics(HeapStatistics* heap_statistics); 4569 void GetHeapStatistics(HeapStatistics* heap_statistics);
4549 4570
4550 /** 4571 /**
4572 * Get a call stack sample from the isolate.
4573 * \param state Execution state.
4574 * \param frames Caller allocated buffer to store stack frames.
4575 * \param frames_limit Maximum number of frames to capture. The buffer must
4576 * be large enough to hold the number of frames.
4577 * \param sample_info The sample info is filled up by the function
4578 * provides number of actual captured stack frames and
4579 * the current VM state.
4580 * \note GetStackSample should only be called when the JS thread is paused or
4581 * interrupted. Otherwise the behavior is undefined.
4582 */
4583 void GetStackSample(const RegisterState& state, void** frames,
4584 size_t frames_limit, SampleInfo* sample_info);
4585
4586 /**
4551 * Adjusts the amount of registered external memory. Used to give V8 an 4587 * Adjusts the amount of registered external memory. Used to give V8 an
4552 * indication of the amount of externally allocated memory that is kept alive 4588 * indication of the amount of externally allocated memory that is kept alive
4553 * by JavaScript objects. V8 uses this to decide when to perform global 4589 * by JavaScript objects. V8 uses this to decide when to perform global
4554 * garbage collections. Registering externally allocated memory will trigger 4590 * garbage collections. Registering externally allocated memory will trigger
4555 * global garbage collections more often than it would otherwise in an attempt 4591 * global garbage collections more often than it would otherwise in an attempt
4556 * to garbage collect the JavaScript objects that keep the externally 4592 * to garbage collect the JavaScript objects that keep the externally
4557 * allocated memory alive. 4593 * allocated memory alive.
4558 * 4594 *
4559 * \param change_in_bytes the change in externally allocated memory that is 4595 * \param change_in_bytes the change in externally allocated memory that is
4560 * kept alive by JavaScript objects. 4596 * kept alive by JavaScript objects.
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
6949 */ 6985 */
6950 6986
6951 6987
6952 } // namespace v8 6988 } // namespace v8
6953 6989
6954 6990
6955 #undef TYPE_CHECK 6991 #undef TYPE_CHECK
6956 6992
6957 6993
6958 #endif // V8_H_ 6994 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698