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

Side by Side Diff: include/v8.h

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed the comments. Fixed the nits. Created 6 years, 3 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') | test/cctest/test-sampler-api.cc » ('J')
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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 bool IsEval() const; 1290 bool IsEval() const;
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 /* TODO(gholap): This should go away and struct Sample should
1301 just use const void* instead of Address.
1302 Currently we need it because of implementation details. */
1303 typedef unsigned char* Address;
1304
1305
1306 /**
1307 * Isolate::Getsample collects the current JS execution state as a sample.
1308 * A collected sample contains,
1309 * - stack : An array of addresses.
1310 * One address per stack frame.
1311 * The address is the instruction pointer,
1312 * pointing to the instruction which led to the
1313 * creation of the stack frame.
1314 * (for example, a function call)
1315 * - frames_count: Number of stack frames that were captured.
1316 * That is, stack[frames_count+i] might contain meaningless
1317 * addresses for any i >= 0.
1318 */
1319 struct V8_EXPORT Sample {
1320 Sample()
1321 : frames_count(0) {}
1322 static const unsigned kMaxFramesCount = 255;
1323
1324 Address stack[kMaxFramesCount]; // Call stack.
1325 unsigned frames_count; // Number of captured frames.
1326 };
1327
1328
1300 /** 1329 /**
1301 * A JSON Parser. 1330 * A JSON Parser.
1302 */ 1331 */
1303 class V8_EXPORT JSON { 1332 class V8_EXPORT JSON {
1304 public: 1333 public:
1305 /** 1334 /**
1306 * Tries to parse the string |json_string| and returns it as value if 1335 * Tries to parse the string |json_string| and returns it as value if
1307 * successful. 1336 * successful.
1308 * 1337 *
1309 * \param json_string The string to parse. 1338 * \param json_string The string to parse.
(...skipping 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after
4210 * are in the range of 0 - GetNumberOfDataSlots() - 1. 4239 * are in the range of 0 - GetNumberOfDataSlots() - 1.
4211 */ 4240 */
4212 V8_INLINE static uint32_t GetNumberOfDataSlots(); 4241 V8_INLINE static uint32_t GetNumberOfDataSlots();
4213 4242
4214 /** 4243 /**
4215 * Get statistics about the heap memory usage. 4244 * Get statistics about the heap memory usage.
4216 */ 4245 */
4217 void GetHeapStatistics(HeapStatistics* heap_statistics); 4246 void GetHeapStatistics(HeapStatistics* heap_statistics);
4218 4247
4219 /** 4248 /**
4249 * Get a sample from the isolate.
4250 */
4251 void GetSample(Sample* sample);
4252
4253 /**
4220 * Adjusts the amount of registered external memory. Used to give V8 an 4254 * 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 4255 * 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 4256 * by JavaScript objects. V8 uses this to decide when to perform global
4223 * garbage collections. Registering externally allocated memory will trigger 4257 * garbage collections. Registering externally allocated memory will trigger
4224 * global garbage collections more often than it would otherwise in an attempt 4258 * global garbage collections more often than it would otherwise in an attempt
4225 * to garbage collect the JavaScript objects that keep the externally 4259 * to garbage collect the JavaScript objects that keep the externally
4226 * allocated memory alive. 4260 * allocated memory alive.
4227 * 4261 *
4228 * \param change_in_bytes the change in externally allocated memory that is 4262 * \param change_in_bytes the change in externally allocated memory that is
4229 * kept alive by JavaScript objects. 4263 * kept alive by JavaScript objects.
(...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after
6703 */ 6737 */
6704 6738
6705 6739
6706 } // namespace v8 6740 } // namespace v8
6707 6741
6708 6742
6709 #undef TYPE_CHECK 6743 #undef TYPE_CHECK
6710 6744
6711 6745
6712 #endif // V8_H_ 6746 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-sampler-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698