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

Side by Side Diff: include/v8.h

Issue 172043: Context-independent script compilation. (Closed)
Patch Set: Created 11 years, 4 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
« 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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 Handle<Integer> resource_column_offset_; 506 Handle<Integer> resource_column_offset_;
507 }; 507 };
508 508
509 509
510 /** 510 /**
511 * A compiled JavaScript script. 511 * A compiled JavaScript script.
512 */ 512 */
513 class V8EXPORT Script { 513 class V8EXPORT Script {
514 public: 514 public:
515 515
516 /**
517 * Compiles the specified script. The ScriptOrigin* and ScriptData*
518 * parameters are owned by the caller of Script::Compile. No
519 * references to these objects are kept after compilation finishes.
520 *
521 * The script object returned is context independent; when run it
522 * will use the currently entered context.
523 */
524 static Local<Script> New(Handle<String> source,
525 ScriptOrigin* origin = NULL,
526 ScriptData* pre_data = NULL);
527
528 /**
529 * Compiles the specified script using the specified file name
530 * object (typically a string) as the script's origin.
531 *
532 * The script object returned is context independent; when run it
533 * will use the currently entered context.
534 */
535 static Local<Script> New(Handle<String> source,
536 Handle<Value> file_name);
537
516 /** 538 /**
517 * Compiles the specified script. The ScriptOrigin* and ScriptData* 539 * Compiles the specified script. The ScriptOrigin* and ScriptData*
518 * parameters are owned by the caller of Script::Compile. No 540 * parameters are owned by the caller of Script::Compile. No
519 * references to these objects are kept after compilation finishes. 541 * references to these objects are kept after compilation finishes.
542 *
543 * The script object returned is bound to the context that was active
544 * when this function was called. When run it will always use this
545 * context.
520 */ 546 */
521 static Local<Script> Compile(Handle<String> source, 547 static Local<Script> Compile(Handle<String> source,
522 ScriptOrigin* origin = NULL, 548 ScriptOrigin* origin = NULL,
523 ScriptData* pre_data = NULL); 549 ScriptData* pre_data = NULL);
524 550
525 /** 551 /**
526 * Compiles the specified script using the specified file name 552 * Compiles the specified script using the specified file name
527 * object (typically a string) as the script's origin. 553 * object (typically a string) as the script's origin.
554 *
555 * The script object returned is bound to the context that was active
556 * when this function was called. When run it will always use this
557 * context.
528 */ 558 */
529 static Local<Script> Compile(Handle<String> source, 559 static Local<Script> Compile(Handle<String> source,
530 Handle<Value> file_name); 560 Handle<Value> file_name);
531 561
532 /** 562 /**
533 * Runs the script returning the resulting value. 563 * Runs the script returning the resulting value. If the script is
564 * context independent (created using ::New) it will be run in the
565 * currently entered context. If it is context specific (created
566 * using ::Compile) it will be run in the context in which it was
567 * compiled.
534 */ 568 */
535 Local<Value> Run(); 569 Local<Value> Run();
536 570
537 /** 571 /**
538 * Returns the script id value. 572 * Returns the script id value.
539 */ 573 */
540 Local<Value> Id(); 574 Local<Value> Id();
541 575
542 /** 576 /**
543 * Associate an additional data object with the script. This is mainly used 577 * Associate an additional data object with the script. This is mainly used
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 2722
2689 } // namespace v8 2723 } // namespace v8
2690 2724
2691 2725
2692 #undef V8EXPORT 2726 #undef V8EXPORT
2693 #undef V8EXPORT_INLINE 2727 #undef V8EXPORT_INLINE
2694 #undef TYPE_CHECK 2728 #undef TYPE_CHECK
2695 2729
2696 2730
2697 #endif // V8_H_ 2731 #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