@@ -534,51 +534,76 @@ class V8EXPORT ScriptOrigin {
534
534
class V8EXPORT Script {
535
535
public:
536
536
537
- /* *
538
- * Compiles the specified script. The ScriptOrigin* and ScriptData*
539
- * parameters are owned by the caller of Script::Compile. No
540
- * references to these objects are kept after compilation finishes.
541
- *
542
- * The script object returned is context independent; when run it
543
- * will use the currently entered context.
544
- */
545
- static Local<Script> New (Handle<String> source,
546
- ScriptOrigin* origin = NULL ,
547
- ScriptData* pre_data = NULL );
537
+ /* *
538
+ * Compiles the specified script (context-independent).
539
+ *
540
+ * \param source Script source code.
541
+ * \param origin Script origin, owned by caller, no references are kept
542
+ * when New() returns
543
+ * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
544
+ * using pre_data speeds compilation if it's done multiple times.
545
+ * Owned by caller, no references are kept when New() returns.
546
+ * \param script_data Arbitrary data associated with script. Using
547
+ * this has same effect as calling SetData(), but allows data to be
548
+ * available to compile event handlers.
549
+ * \return Compiled script object (context independent; when run it
550
+ * will use the currently entered context).
551
+ */
552
+ static Local<Script> New (Handle<String> source,
553
+ ScriptOrigin* origin = NULL ,
554
+ ScriptData* pre_data = NULL ,
555
+ Handle<String> script_data = Handle<String>());
548
556
549
- /* *
550
- * Compiles the specified script using the specified file name
551
- * object (typically a string) as the script's origin.
552
- *
553
- * The script object returned is context independent; when run it
554
- * will use the currently entered context.
555
- */
556
- static Local<Script> New (Handle<String> source,
557
- Handle<Value> file_name);
558
-
559
- /* *
560
- * Compiles the specified script. The ScriptOrigin* and ScriptData*
561
- * parameters are owned by the caller of Script::Compile. No
562
- * references to these objects are kept after compilation finishes.
557
+ /* *
558
+ * Compiles the specified script using the specified file name
559
+ * object (typically a string) as the script's origin.
560
+ *
561
+ * \param source Script source code.
562
+ * \patam file_name file name object (typically a string) to be used
563
+ * as the script's origin.
564
+ * \return Compiled script object (context independent; when run it
565
+ * will use the currently entered context).
566
+ */
567
+ static Local<Script> New (Handle<String> source,
568
+ Handle<Value> file_name);
569
+
570
+ /* *
571
+ * Compiles the specified script (bound to current context).
563
572
*
564
- * The script object returned is bound to the context that was active
565
- * when this function was called. When run it will always use this
566
- * context.
573
+ * \param source Script source code.
574
+ * \param origin Script origin, owned by caller, no references are kept
575
+ * when Compile() returns
576
+ * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
577
+ * using pre_data speeds compilation if it's done multiple times.
578
+ * Owned by caller, no references are kept when Compile() returns.
579
+ * \param script_data Arbitrary data associated with script. Using
580
+ * this has same effect as calling SetData(), but makes data available
581
+ * earlier (i.e. to compile event handlers).
582
+ * \return Compiled script object, bound to the context that was active
583
+ * when this function was called. When run it will always use this
584
+ * context.
567
585
*/
568
586
static Local<Script> Compile (Handle<String> source,
569
587
ScriptOrigin* origin = NULL ,
570
- ScriptData* pre_data = NULL );
588
+ ScriptData* pre_data = NULL ,
589
+ Handle<String> script_data = Handle<String>());
571
590
572
591
/* *
573
592
* Compiles the specified script using the specified file name
574
593
* object (typically a string) as the script's origin.
575
594
*
576
- * The script object returned is bound to the context that was active
577
- * when this function was called. When run it will always use this
578
- * context.
595
+ * \param source Script source code.
596
+ * \param file_name File name to use as script's origin
597
+ * \param script_data Arbitrary data associated with script. Using
598
+ * this has same effect as calling SetData(), but makes data available
599
+ * earlier (i.e. to compile event handlers).
600
+ * \return Compiled script object, bound to the context that was active
601
+ * when this function was called. When run it will always use this
602
+ * context.
579
603
*/
580
604
static Local<Script> Compile (Handle<String> source,
581
- Handle<Value> file_name);
605
+ Handle<Value> file_name,
606
+ Handle<String> script_data = Handle<String>());
582
607
583
608
/* *
584
609
* Runs the script returning the resulting value. If the script is
@@ -1196,6 +1221,13 @@ class V8EXPORT Object : public Value {
1196
1221
*/
1197
1222
Local<Value> GetPrototype ();
1198
1223
1224
+ /* *
1225
+ * Set the prototype object. This does not skip objects marked to
1226
+ * be skipped by __proto__ and it does not consult the security
1227
+ * handler.
1228
+ */
1229
+ bool SetPrototype (Handle<Value> prototype);
1230
+
1199
1231
/* *
1200
1232
* Finds an instance of the given function template in the prototype
1201
1233
* chain.
@@ -1354,7 +1386,15 @@ class V8EXPORT Function : public Object {
1354
1386
Local<Value> Call (Handle<Object> recv, int argc, Handle<Value> argv[]);
1355
1387
void SetName (Handle<String> name);
1356
1388
Handle<Value> GetName () const ;
1389
+
1390
+ /* *
1391
+ * Returns zero based line number of function body and
1392
+ * kLineOffsetNotFound if no information available.
1393
+ */
1394
+ int GetScriptLineNumber () const ;
1395
+ ScriptOrigin GetScriptOrigin () const ;
1357
1396
static inline Function* Cast (Value* obj);
1397
+ static const int kLineOffsetNotFound ;
1358
1398
private:
1359
1399
Function ();
1360
1400
static void CheckCast (Value* obj);
@@ -2309,22 +2349,30 @@ class V8EXPORT V8 {
2309
2349
static bool IsProfilerPaused ();
2310
2350
2311
2351
/* *
2312
- * Resumes specified profiler modules.
2352
+ * Resumes specified profiler modules. Can be called several times to
2353
+ * mark the opening of a profiler events block with the given tag.
2354
+ *
2313
2355
* "ResumeProfiler" is equivalent to "ResumeProfilerEx(PROFILER_MODULE_CPU)".
2314
2356
* See ProfilerModules enum.
2315
2357
*
2316
2358
* \param flags Flags specifying profiler modules.
2359
+ * \param tag Profile tag.
2317
2360
*/
2318
- static void ResumeProfilerEx (int flags);
2361
+ static void ResumeProfilerEx (int flags, int tag = 0 );
2319
2362
2320
2363
/* *
2321
- * Pauses specified profiler modules.
2364
+ * Pauses specified profiler modules. Each call to "PauseProfilerEx" closes
2365
+ * a block of profiler events opened by a call to "ResumeProfilerEx" with the
2366
+ * same tag value. There is no need for blocks to be properly nested.
2367
+ * The profiler is paused when the last opened block is closed.
2368
+ *
2322
2369
* "PauseProfiler" is equivalent to "PauseProfilerEx(PROFILER_MODULE_CPU)".
2323
2370
* See ProfilerModules enum.
2324
2371
*
2325
2372
* \param flags Flags specifying profiler modules.
2373
+ * \param tag Profile tag.
2326
2374
*/
2327
- static void PauseProfilerEx (int flags);
2375
+ static void PauseProfilerEx (int flags, int tag = 0 );
2328
2376
2329
2377
/* *
2330
2378
* Returns active (resumed) profiler modules.
0 commit comments