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

Side by Side Diff: include/v8.h

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 9 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 | « ChangeLog ('k') | samples/lineprocessor.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 Handle<Integer> resource_column_offset_; 527 Handle<Integer> resource_column_offset_;
528 }; 528 };
529 529
530 530
531 /** 531 /**
532 * A compiled JavaScript script. 532 * A compiled JavaScript script.
533 */ 533 */
534 class V8EXPORT Script { 534 class V8EXPORT Script {
535 public: 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);
548
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 /** 537 /**
560 * Compiles the specified script. The ScriptOrigin* and ScriptData* 538 * Compiles the specified script (context-independent).
561 * parameters are owned by the caller of Script::Compile. No
562 * references to these objects are kept after compilation finishes.
563 * 539 *
564 * The script object returned is bound to the context that was active 540 * \param source Script source code.
565 * when this function was called. When run it will always use this 541 * \param origin Script origin, owned by caller, no references are kept
566 * context. 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).
567 */ 551 */
568 static Local<Script> Compile(Handle<String> source, 552 static Local<Script> New(Handle<String> source,
569 ScriptOrigin* origin = NULL, 553 ScriptOrigin* origin = NULL,
570 ScriptData* pre_data = NULL); 554 ScriptData* pre_data = NULL,
555 Handle<String> script_data = Handle<String>());
571 556
572 /** 557 /**
573 * Compiles the specified script using the specified file name 558 * Compiles the specified script using the specified file name
574 * object (typically a string) as the script's origin. 559 * object (typically a string) as the script's origin.
575 * 560 *
576 * The script object returned is bound to the context that was active 561 * \param source Script source code.
577 * when this function was called. When run it will always use this 562 * \patam file_name file name object (typically a string) to be used
578 * context. 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).
572 *
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.
579 */ 585 */
580 static Local<Script> Compile(Handle<String> source, 586 static Local<Script> Compile(Handle<String> source,
581 Handle<Value> file_name); 587 ScriptOrigin* origin = NULL,
588 ScriptData* pre_data = NULL,
589 Handle<String> script_data = Handle<String>());
590
591 /**
592 * Compiles the specified script using the specified file name
593 * object (typically a string) as the script's origin.
594 *
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.
603 */
604 static Local<Script> Compile(Handle<String> source,
605 Handle<Value> file_name,
606 Handle<String> script_data = Handle<String>());
582 607
583 /** 608 /**
584 * Runs the script returning the resulting value. If the script is 609 * Runs the script returning the resulting value. If the script is
585 * context independent (created using ::New) it will be run in the 610 * context independent (created using ::New) it will be run in the
586 * currently entered context. If it is context specific (created 611 * currently entered context. If it is context specific (created
587 * using ::Compile) it will be run in the context in which it was 612 * using ::Compile) it will be run in the context in which it was
588 * compiled. 613 * compiled.
589 */ 614 */
590 Local<Value> Run(); 615 Local<Value> Run();
591 616
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 Local<Array> GetPropertyNames(); 1215 Local<Array> GetPropertyNames();
1191 1216
1192 /** 1217 /**
1193 * Get the prototype object. This does not skip objects marked to 1218 * Get the prototype object. This does not skip objects marked to
1194 * be skipped by __proto__ and it does not consult the security 1219 * be skipped by __proto__ and it does not consult the security
1195 * handler. 1220 * handler.
1196 */ 1221 */
1197 Local<Value> GetPrototype(); 1222 Local<Value> GetPrototype();
1198 1223
1199 /** 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
1231 /**
1200 * Finds an instance of the given function template in the prototype 1232 * Finds an instance of the given function template in the prototype
1201 * chain. 1233 * chain.
1202 */ 1234 */
1203 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); 1235 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl);
1204 1236
1205 /** 1237 /**
1206 * Call builtin Object.prototype.toString on this object. 1238 * Call builtin Object.prototype.toString on this object.
1207 * This is different from Value::ToString() that may call 1239 * This is different from Value::ToString() that may call
1208 * user-defined toString function. This one does not. 1240 * user-defined toString function. This one does not.
1209 */ 1241 */
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 /** 1379 /**
1348 * A JavaScript function object (ECMA-262, 15.3). 1380 * A JavaScript function object (ECMA-262, 15.3).
1349 */ 1381 */
1350 class V8EXPORT Function : public Object { 1382 class V8EXPORT Function : public Object {
1351 public: 1383 public:
1352 Local<Object> NewInstance() const; 1384 Local<Object> NewInstance() const;
1353 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; 1385 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
1354 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); 1386 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
1355 void SetName(Handle<String> name); 1387 void SetName(Handle<String> name);
1356 Handle<Value> GetName() const; 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 static inline Function* Cast(Value* obj); 1396 static inline Function* Cast(Value* obj);
1397 static const int kLineOffsetNotFound;
1358 private: 1398 private:
1359 Function(); 1399 Function();
1360 static void CheckCast(Value* obj); 1400 static void CheckCast(Value* obj);
1361 }; 1401 };
1362 1402
1363 1403
1364 /** 1404 /**
1365 * A JavaScript value that wraps a C++ void*. This type of value is 1405 * A JavaScript value that wraps a C++ void*. This type of value is
1366 * mainly used to associate C++ data structures with JavaScript 1406 * mainly used to associate C++ data structures with JavaScript
1367 * objects. 1407 * objects.
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 * See also PauseProfiler(). 2342 * See also PauseProfiler().
2303 */ 2343 */
2304 static void ResumeProfiler(); 2344 static void ResumeProfiler();
2305 2345
2306 /** 2346 /**
2307 * Return whether profiler is currently paused. 2347 * Return whether profiler is currently paused.
2308 */ 2348 */
2309 static bool IsProfilerPaused(); 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 * "ResumeProfiler" is equivalent to "ResumeProfilerEx(PROFILER_MODULE_CPU)". 2355 * "ResumeProfiler" is equivalent to "ResumeProfilerEx(PROFILER_MODULE_CPU)".
2314 * See ProfilerModules enum. 2356 * See ProfilerModules enum.
2315 * 2357 *
2316 * \param flags Flags specifying profiler modules. 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 * "PauseProfiler" is equivalent to "PauseProfilerEx(PROFILER_MODULE_CPU)". 2369 * "PauseProfiler" is equivalent to "PauseProfilerEx(PROFILER_MODULE_CPU)".
2323 * See ProfilerModules enum. 2370 * See ProfilerModules enum.
2324 * 2371 *
2325 * \param flags Flags specifying profiler modules. 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 * Returns active (resumed) profiler modules. 2378 * Returns active (resumed) profiler modules.
2331 * See ProfilerModules enum. 2379 * See ProfilerModules enum.
2332 * 2380 *
2333 * \returns active profiler modules. 2381 * \returns active profiler modules.
2334 */ 2382 */
2335 static int GetActiveProfilerModules(); 2383 static int GetActiveProfilerModules();
2336 2384
2337 /** 2385 /**
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 3275
3228 } // namespace v8 3276 } // namespace v8
3229 3277
3230 3278
3231 #undef V8EXPORT 3279 #undef V8EXPORT
3232 #undef V8EXPORT_INLINE 3280 #undef V8EXPORT_INLINE
3233 #undef TYPE_CHECK 3281 #undef TYPE_CHECK
3234 3282
3235 3283
3236 #endif // V8_H_ 3284 #endif // V8_H_
OLDNEW
« no previous file with comments | « ChangeLog ('k') | samples/lineprocessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698