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

Side by Side Diff: include/v8.h

Issue 18096: Experimental: merge from bleeding_edge. Merge up to and including... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 11 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 | « benchmarks/run.js ('k') | src/SConscript » ('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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 * This check fails when trying to convert between incompatible 193 * This check fails when trying to convert between incompatible
194 * handles. For example, converting from a Handle<String> to a 194 * handles. For example, converting from a Handle<String> to a
195 * Handle<Number>. 195 * Handle<Number>.
196 */ 196 */
197 TYPE_CHECK(T, S); 197 TYPE_CHECK(T, S);
198 } 198 }
199 199
200 /** 200 /**
201 * Returns true if the handle is empty. 201 * Returns true if the handle is empty.
202 */ 202 */
203 bool IsEmpty() { return val_ == 0; } 203 bool IsEmpty() const { return val_ == 0; }
204 204
205 T* operator->(); 205 T* operator->() const;
206 206
207 T* operator*(); 207 T* operator*() const;
208 208
209 /** 209 /**
210 * Sets the handle to be empty. IsEmpty() will then return true. 210 * Sets the handle to be empty. IsEmpty() will then return true.
211 */ 211 */
212 void Clear() { this->val_ = 0; } 212 void Clear() { this->val_ = 0; }
213 213
214 /** 214 /**
215 * Checks whether two handles are the same. 215 * Checks whether two handles are the same.
216 * Returns true if both are empty, or if the objects 216 * Returns true if both are empty, or if the objects
217 * to which they refer are identical. 217 * to which they refer are identical.
218 * The handles' references are not checked. 218 * The handles' references are not checked.
219 */ 219 */
220 template <class S> bool operator==(Handle<S> that) { 220 template <class S> bool operator==(Handle<S> that) const {
221 void** a = reinterpret_cast<void**>(**this); 221 void** a = reinterpret_cast<void**>(**this);
222 void** b = reinterpret_cast<void**>(*that); 222 void** b = reinterpret_cast<void**>(*that);
223 if (a == 0) return b == 0; 223 if (a == 0) return b == 0;
224 if (b == 0) return false; 224 if (b == 0) return false;
225 return *a == *b; 225 return *a == *b;
226 } 226 }
227 227
228 /** 228 /**
229 * Checks whether two handles are different. 229 * Checks whether two handles are different.
230 * Returns true if only one of the handles is empty, or if 230 * Returns true if only one of the handles is empty, or if
231 * the objects to which they refer are different. 231 * the objects to which they refer are different.
232 * The handles' references are not checked. 232 * The handles' references are not checked.
233 */ 233 */
234 template <class S> bool operator!=(Handle<S> that) { 234 template <class S> bool operator!=(Handle<S> that) const {
235 return !operator==(that); 235 return !operator==(that);
236 } 236 }
237 237
238 template <class S> static inline Handle<T> Cast(Handle<S> that) { 238 template <class S> static inline Handle<T> Cast(Handle<S> that) {
239 if (that.IsEmpty()) return Handle<T>(); 239 if (that.IsEmpty()) return Handle<T>();
240 return Handle<T>(T::Cast(*that)); 240 return Handle<T>(T::Cast(*that));
241 } 241 }
242 242
243 private: 243 private:
244 T* val_; 244 T* val_;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 * it the object reference and the given parameters. 360 * it the object reference and the given parameters.
361 */ 361 */
362 void MakeWeak(void* parameters, WeakReferenceCallback callback); 362 void MakeWeak(void* parameters, WeakReferenceCallback callback);
363 363
364 /** Clears the weak reference to this object.*/ 364 /** Clears the weak reference to this object.*/
365 void ClearWeak(); 365 void ClearWeak();
366 366
367 /** 367 /**
368 *Checks if the handle holds the only reference to an object. 368 *Checks if the handle holds the only reference to an object.
369 */ 369 */
370 bool IsNearDeath(); 370 bool IsNearDeath() const;
371 371
372 /** 372 /**
373 * Returns true if the handle's reference is weak. 373 * Returns true if the handle's reference is weak.
374 */ 374 */
375 bool IsWeak(); 375 bool IsWeak() const;
376 376
377 private: 377 private:
378 friend class ImplementationUtilities; 378 friend class ImplementationUtilities;
379 friend class ObjectTemplate; 379 friend class ObjectTemplate;
380 }; 380 };
381 381
382 382
383 /** 383 /**
384 * A stack-allocated class that governs a number of local handles. 384 * A stack-allocated class that governs a number of local handles.
385 * After a handle scope has been created, all local handles will be 385 * After a handle scope has been created, all local handles will be
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 */ 549 */
550 Local<Value> Run(); 550 Local<Value> Run();
551 }; 551 };
552 552
553 553
554 /** 554 /**
555 * An error message. 555 * An error message.
556 */ 556 */
557 class EXPORT Message { 557 class EXPORT Message {
558 public: 558 public:
559 Local<String> Get(); 559 Local<String> Get() const;
560 Local<String> GetSourceLine(); 560 Local<String> GetSourceLine() const;
561 561
562 Handle<Value> GetScriptResourceName(); 562 Handle<Value> GetScriptResourceName() const;
563 563
564 /** 564 /**
565 * Returns the number, 1-based, of the line where the error occurred. 565 * Returns the number, 1-based, of the line where the error occurred.
566 */ 566 */
567 int GetLineNumber(); 567 int GetLineNumber() const;
568 568
569 /** 569 /**
570 * Returns the index within the script of the first character where 570 * Returns the index within the script of the first character where
571 * the error occurred. 571 * the error occurred.
572 */ 572 */
573 int GetStartPosition(); 573 int GetStartPosition() const;
574 574
575 /** 575 /**
576 * Returns the index within the script of the last character where 576 * Returns the index within the script of the last character where
577 * the error occurred. 577 * the error occurred.
578 */ 578 */
579 int GetEndPosition(); 579 int GetEndPosition() const;
580 580
581 /** 581 /**
582 * Returns the index within the line of the first character where 582 * Returns the index within the line of the first character where
583 * the error occurred. 583 * the error occurred.
584 */ 584 */
585 int GetStartColumn(); 585 int GetStartColumn() const;
586 586
587 /** 587 /**
588 * Returns the index within the line of the last character where 588 * Returns the index within the line of the last character where
589 * the error occurred. 589 * the error occurred.
590 */ 590 */
591 int GetEndColumn(); 591 int GetEndColumn() const;
592 592
593 // TODO(1245381): Print to a string instead of on a FILE. 593 // TODO(1245381): Print to a string instead of on a FILE.
594 static void PrintCurrentStackTrace(FILE* out); 594 static void PrintCurrentStackTrace(FILE* out);
595 }; 595 };
596 596
597 597
598 // --- V a l u e --- 598 // --- V a l u e ---
599 599
600 600
601 /** 601 /**
602 * The superclass of all JavaScript values and objects. 602 * The superclass of all JavaScript values and objects.
603 */ 603 */
604 class EXPORT Value : public Data { 604 class EXPORT Value : public Data {
605 public: 605 public:
606 606
607 /** 607 /**
608 * Returns true if this value is the undefined value. See ECMA-262 608 * Returns true if this value is the undefined value. See ECMA-262
609 * 4.3.10. 609 * 4.3.10.
610 */ 610 */
611 bool IsUndefined(); 611 bool IsUndefined() const;
612 612
613 /** 613 /**
614 * Returns true if this value is the null value. See ECMA-262 614 * Returns true if this value is the null value. See ECMA-262
615 * 4.3.11. 615 * 4.3.11.
616 */ 616 */
617 bool IsNull(); 617 bool IsNull() const;
618 618
619 /** 619 /**
620 * Returns true if this value is true. 620 * Returns true if this value is true.
621 */ 621 */
622 bool IsTrue(); 622 bool IsTrue() const;
623 623
624 /** 624 /**
625 * Returns true if this value is false. 625 * Returns true if this value is false.
626 */ 626 */
627 bool IsFalse(); 627 bool IsFalse() const;
628 628
629 /** 629 /**
630 * Returns true if this value is an instance of the String type. 630 * Returns true if this value is an instance of the String type.
631 * See ECMA-262 8.4. 631 * See ECMA-262 8.4.
632 */ 632 */
633 bool IsString(); 633 bool IsString() const;
634 634
635 /** 635 /**
636 * Returns true if this value is a function. 636 * Returns true if this value is a function.
637 */ 637 */
638 bool IsFunction(); 638 bool IsFunction() const;
639 639
640 /** 640 /**
641 * Returns true if this value is an array. 641 * Returns true if this value is an array.
642 */ 642 */
643 bool IsArray(); 643 bool IsArray() const;
644 644
645 /** 645 /**
646 * Returns true if this value is an object. 646 * Returns true if this value is an object.
647 */ 647 */
648 bool IsObject(); 648 bool IsObject() const;
649 649
650 /** 650 /**
651 * Returns true if this value is boolean. 651 * Returns true if this value is boolean.
652 */ 652 */
653 bool IsBoolean(); 653 bool IsBoolean() const;
654 654
655 /** 655 /**
656 * Returns true if this value is a number. 656 * Returns true if this value is a number.
657 */ 657 */
658 bool IsNumber(); 658 bool IsNumber() const;
659 659
660 /** 660 /**
661 * Returns true if this value is external. 661 * Returns true if this value is external.
662 */ 662 */
663 bool IsExternal(); 663 bool IsExternal() const;
664 664
665 /** 665 /**
666 * Returns true if this value is a 32-bit signed integer. 666 * Returns true if this value is a 32-bit signed integer.
667 */ 667 */
668 bool IsInt32(); 668 bool IsInt32() const;
669 669
670 /** 670 /**
671 * Returns true if this value is a Date. 671 * Returns true if this value is a Date.
672 */ 672 */
673 bool IsDate(); 673 bool IsDate() const;
674 674
675 Local<Boolean> ToBoolean(); 675 Local<Boolean> ToBoolean() const;
676 Local<Number> ToNumber(); 676 Local<Number> ToNumber() const;
677 Local<String> ToString(); 677 Local<String> ToString() const;
678 Local<String> ToDetailString(); 678 Local<String> ToDetailString() const;
679 Local<Object> ToObject(); 679 Local<Object> ToObject() const;
680 Local<Integer> ToInteger(); 680 Local<Integer> ToInteger() const;
681 Local<Uint32> ToUint32(); 681 Local<Uint32> ToUint32() const;
682 Local<Int32> ToInt32(); 682 Local<Int32> ToInt32() const;
683 683
684 /** 684 /**
685 * Attempts to convert a string to an array index. 685 * Attempts to convert a string to an array index.
686 * Returns an empty handle if the conversion fails. 686 * Returns an empty handle if the conversion fails.
687 */ 687 */
688 Local<Uint32> ToArrayIndex(); 688 Local<Uint32> ToArrayIndex() const;
689 689
690 bool BooleanValue(); 690 bool BooleanValue() const;
691 double NumberValue(); 691 double NumberValue() const;
692 int64_t IntegerValue(); 692 int64_t IntegerValue() const;
693 uint32_t Uint32Value(); 693 uint32_t Uint32Value() const;
694 int32_t Int32Value(); 694 int32_t Int32Value() const;
695 695
696 /** JS == */ 696 /** JS == */
697 bool Equals(Handle<Value> that); 697 bool Equals(Handle<Value> that) const;
698 bool StrictEquals(Handle<Value> that); 698 bool StrictEquals(Handle<Value> that) const;
699 }; 699 };
700 700
701 701
702 /** 702 /**
703 * The superclass of primitive values. See ECMA-262 4.3.2. 703 * The superclass of primitive values. See ECMA-262 4.3.2.
704 */ 704 */
705 class EXPORT Primitive : public Value { }; 705 class EXPORT Primitive : public Value { };
706 706
707 707
708 /** 708 /**
709 * A primitive boolean value (ECMA-262, 4.3.14). Either the true 709 * A primitive boolean value (ECMA-262, 4.3.14). Either the true
710 * or false value. 710 * or false value.
711 */ 711 */
712 class EXPORT Boolean : public Primitive { 712 class EXPORT Boolean : public Primitive {
713 public: 713 public:
714 bool Value(); 714 bool Value() const;
715 static inline Handle<Boolean> New(bool value); 715 static inline Handle<Boolean> New(bool value);
716 }; 716 };
717 717
718 718
719 /** 719 /**
720 * A JavaScript string value (ECMA-262, 4.3.17). 720 * A JavaScript string value (ECMA-262, 4.3.17).
721 */ 721 */
722 class EXPORT String : public Primitive { 722 class EXPORT String : public Primitive {
723 public: 723 public:
724 724
725 /** 725 /**
726 * Returns the number of characters in this string. 726 * Returns the number of characters in this string.
727 */ 727 */
728 int Length(); 728 int Length() const;
729 729
730 /** 730 /**
731 * Returns the number of bytes in the UTF-8 encoded 731 * Returns the number of bytes in the UTF-8 encoded
732 * representation of this string. 732 * representation of this string.
733 */ 733 */
734 int Utf8Length(); 734 int Utf8Length() const;
735 735
736 /** 736 /**
737 * Write the contents of the string to an external buffer. 737 * Write the contents of the string to an external buffer.
738 * If no arguments are given, expects the buffer to be large 738 * If no arguments are given, expects the buffer to be large
739 * enough to hold the entire string and NULL terminator. Copies 739 * enough to hold the entire string and NULL terminator. Copies
740 * the contents of the string and the NULL terminator into the 740 * the contents of the string and the NULL terminator into the
741 * buffer. 741 * buffer.
742 * 742 *
743 * Copies up to length characters into the output buffer. 743 * Copies up to length characters into the output buffer.
744 * Only null-terminates if there is enough space in the buffer. 744 * Only null-terminates if there is enough space in the buffer.
745 * 745 *
746 * \param buffer The buffer into which the string will be copied. 746 * \param buffer The buffer into which the string will be copied.
747 * \param start The starting position within the string at which 747 * \param start The starting position within the string at which
748 * copying begins. 748 * copying begins.
749 * \param length The number of bytes to copy from the string. 749 * \param length The number of bytes to copy from the string.
750 * \return The number of characters copied to the buffer 750 * \return The number of characters copied to the buffer
751 * excluding the NULL terminator. 751 * excluding the NULL terminator.
752 */ 752 */
753 int Write(uint16_t* buffer, int start = 0, int length = -1); // UTF-16 753 int Write(uint16_t* buffer, int start = 0, int length = -1) const; // UTF-16
754 int WriteAscii(char* buffer, int start = 0, int length = -1); // ASCII 754 int WriteAscii(char* buffer, int start = 0, int length = -1) const; // ASCII
755 int WriteUtf8(char* buffer, int length = -1); // UTF-8 755 int WriteUtf8(char* buffer, int length = -1) const; // UTF-8
756 756
757 /** 757 /**
758 * Returns true if the string is external 758 * Returns true if the string is external
759 */ 759 */
760 bool IsExternal(); 760 bool IsExternal() const;
761 761
762 /** 762 /**
763 * Returns true if the string is both external and ascii 763 * Returns true if the string is both external and ascii
764 */ 764 */
765 bool IsExternalAscii(); 765 bool IsExternalAscii() const;
766 /** 766 /**
767 * An ExternalStringResource is a wrapper around a two-byte string 767 * An ExternalStringResource is a wrapper around a two-byte string
768 * buffer that resides outside V8's heap. Implement an 768 * buffer that resides outside V8's heap. Implement an
769 * ExternalStringResource to manage the life cycle of the underlying 769 * ExternalStringResource to manage the life cycle of the underlying
770 * buffer. Note that the string data must be immutable. 770 * buffer. Note that the string data must be immutable.
771 */ 771 */
772 class EXPORT ExternalStringResource { // NOLINT 772 class EXPORT ExternalStringResource { // NOLINT
773 public: 773 public:
774 /** 774 /**
775 * Override the destructor to manage the life cycle of the underlying 775 * Override the destructor to manage the life cycle of the underlying
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 private: 815 private:
816 // Disallow copying and assigning. 816 // Disallow copying and assigning.
817 ExternalAsciiStringResource(const ExternalAsciiStringResource&); 817 ExternalAsciiStringResource(const ExternalAsciiStringResource&);
818 void operator=(const ExternalAsciiStringResource&); 818 void operator=(const ExternalAsciiStringResource&);
819 }; 819 };
820 820
821 /** 821 /**
822 * Get the ExternalStringResource for an external string. Only 822 * Get the ExternalStringResource for an external string. Only
823 * valid if IsExternal() returns true. 823 * valid if IsExternal() returns true.
824 */ 824 */
825 ExternalStringResource* GetExternalStringResource(); 825 ExternalStringResource* GetExternalStringResource() const;
826 826
827 /** 827 /**
828 * Get the ExternalAsciiStringResource for an external ascii string. 828 * Get the ExternalAsciiStringResource for an external ascii string.
829 * Only valid if IsExternalAscii() returns true. 829 * Only valid if IsExternalAscii() returns true.
830 */ 830 */
831 ExternalAsciiStringResource* GetExternalAsciiStringResource(); 831 ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
832 832
833 static String* Cast(v8::Value* obj); 833 static String* Cast(v8::Value* obj);
834 834
835 /** 835 /**
836 * Allocates a new string from either utf-8 encoded or ascii data. 836 * Allocates a new string from either utf-8 encoded or ascii data.
837 * The second parameter 'length' gives the buffer length. 837 * The second parameter 'length' gives the buffer length.
838 * If the data is utf-8 encoded, the caller must 838 * If the data is utf-8 encoded, the caller must
839 * be careful to supply the length parameter. 839 * be careful to supply the length parameter.
840 * If it is not given, the function calls 840 * If it is not given, the function calls
841 * 'strlen' to determine the buffer length, it might be 841 * 'strlen' to determine the buffer length, it might be
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 void operator=(const Value&); 931 void operator=(const Value&);
932 }; 932 };
933 }; 933 };
934 934
935 935
936 /** 936 /**
937 * A JavaScript number value (ECMA-262, 4.3.20) 937 * A JavaScript number value (ECMA-262, 4.3.20)
938 */ 938 */
939 class EXPORT Number : public Primitive { 939 class EXPORT Number : public Primitive {
940 public: 940 public:
941 double Value(); 941 double Value() const;
942 static Local<Number> New(double value); 942 static Local<Number> New(double value);
943 static Number* Cast(v8::Value* obj); 943 static Number* Cast(v8::Value* obj);
944 private: 944 private:
945 Number(); 945 Number();
946 }; 946 };
947 947
948 948
949 /** 949 /**
950 * A JavaScript value representing a signed integer. 950 * A JavaScript value representing a signed integer.
951 */ 951 */
952 class EXPORT Integer : public Number { 952 class EXPORT Integer : public Number {
953 public: 953 public:
954 static Local<Integer> New(int32_t value); 954 static Local<Integer> New(int32_t value);
955 int64_t Value(); 955 int64_t Value() const;
956 static Integer* Cast(v8::Value* obj); 956 static Integer* Cast(v8::Value* obj);
957 private: 957 private:
958 Integer(); 958 Integer();
959 }; 959 };
960 960
961 961
962 /** 962 /**
963 * A JavaScript value representing a 32-bit signed integer. 963 * A JavaScript value representing a 32-bit signed integer.
964 */ 964 */
965 class EXPORT Int32 : public Integer { 965 class EXPORT Int32 : public Integer {
966 public: 966 public:
967 int32_t Value(); 967 int32_t Value() const;
968 private: 968 private:
969 Int32(); 969 Int32();
970 }; 970 };
971 971
972 972
973 /** 973 /**
974 * A JavaScript value representing a 32-bit unsigned integer. 974 * A JavaScript value representing a 32-bit unsigned integer.
975 */ 975 */
976 class EXPORT Uint32 : public Integer { 976 class EXPORT Uint32 : public Integer {
977 public: 977 public:
978 uint32_t Value(); 978 uint32_t Value() const;
979 private: 979 private:
980 Uint32(); 980 Uint32();
981 }; 981 };
982 982
983 983
984 /** 984 /**
985 * An instance of the built-in Date constructor (ECMA-262, 15.9). 985 * An instance of the built-in Date constructor (ECMA-262, 15.9).
986 */ 986 */
987 class EXPORT Date : public Value { 987 class EXPORT Date : public Value {
988 public: 988 public:
989 static Local<Value> New(double time); 989 static Local<Value> New(double time);
990 990
991 /** 991 /**
992 * A specialization of Value::NumberValue that is more efficient 992 * A specialization of Value::NumberValue that is more efficient
993 * because we know the structure of this object. 993 * because we know the structure of this object.
994 */ 994 */
995 double NumberValue(); 995 double NumberValue() const;
996 996
997 static Date* Cast(v8::Value* obj); 997 static Date* Cast(v8::Value* obj);
998 }; 998 };
999 999
1000 1000
1001 enum PropertyAttribute { 1001 enum PropertyAttribute {
1002 None = 0, 1002 None = 0,
1003 ReadOnly = 1 << 0, 1003 ReadOnly = 1 << 0,
1004 DontEnum = 1 << 1, 1004 DontEnum = 1 << 1,
1005 DontDelete = 1 << 2 1005 DontDelete = 1 << 2
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 private: 1080 private:
1081 Object(); 1081 Object();
1082 }; 1082 };
1083 1083
1084 1084
1085 /** 1085 /**
1086 * An instance of the built-in array constructor (ECMA-262, 15.4.2). 1086 * An instance of the built-in array constructor (ECMA-262, 15.4.2).
1087 */ 1087 */
1088 class EXPORT Array : public Object { 1088 class EXPORT Array : public Object {
1089 public: 1089 public:
1090 uint32_t Length(); 1090 uint32_t Length() const;
1091 1091
1092 static Local<Array> New(int length = 0); 1092 static Local<Array> New(int length = 0);
1093 static Array* Cast(Value* obj); 1093 static Array* Cast(Value* obj);
1094 private: 1094 private:
1095 Array(); 1095 Array();
1096 }; 1096 };
1097 1097
1098 1098
1099 /** 1099 /**
1100 * A JavaScript function object (ECMA-262, 15.3). 1100 * A JavaScript function object (ECMA-262, 15.3).
1101 */ 1101 */
1102 class EXPORT Function : public Object { 1102 class EXPORT Function : public Object {
1103 public: 1103 public:
1104 Local<Object> NewInstance(); 1104 Local<Object> NewInstance() const;
1105 Local<Object> NewInstance(int argc, Handle<Value> argv[]); 1105 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
1106 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); 1106 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
1107 void SetName(Handle<String> name); 1107 void SetName(Handle<String> name);
1108 Handle<Value> GetName(); 1108 Handle<Value> GetName() const;
1109 static Function* Cast(Value* obj); 1109 static Function* Cast(Value* obj);
1110 private: 1110 private:
1111 Function(); 1111 Function();
1112 }; 1112 };
1113 1113
1114 1114
1115 /** 1115 /**
1116 * A JavaScript value that wraps a c++ void*. This type of value is 1116 * A JavaScript value that wraps a c++ void*. This type of value is
1117 * mainly used to associate c++ data structures with JavaScript 1117 * mainly used to associate c++ data structures with JavaScript
1118 * objects. 1118 * objects.
1119 */ 1119 */
1120 class EXPORT External : public Value { 1120 class EXPORT External : public Value {
1121 public: 1121 public:
1122 static Local<External> New(void* value); 1122 static Local<External> New(void* value);
1123 static External* Cast(Value* obj); 1123 static External* Cast(Value* obj);
1124 void* Value(); 1124 void* Value() const;
1125 private: 1125 private:
1126 External(); 1126 External();
1127 }; 1127 };
1128 1128
1129 1129
1130 // --- T e m p l a t e s --- 1130 // --- T e m p l a t e s ---
1131 1131
1132 1132
1133 /** 1133 /**
1134 * The superclass of object and function templates. 1134 * The superclass of object and function templates.
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 2315
2316 template <class T> 2316 template <class T>
2317 Persistent<T> Persistent<T>::New(Handle<T> that) { 2317 Persistent<T> Persistent<T>::New(Handle<T> that) {
2318 if (that.IsEmpty()) return Persistent<T>(); 2318 if (that.IsEmpty()) return Persistent<T>();
2319 void** p = reinterpret_cast<void**>(*that); 2319 void** p = reinterpret_cast<void**>(*that);
2320 return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p))); 2320 return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p)));
2321 } 2321 }
2322 2322
2323 2323
2324 template <class T> 2324 template <class T>
2325 bool Persistent<T>::IsNearDeath() { 2325 bool Persistent<T>::IsNearDeath() const {
2326 if (this->IsEmpty()) return false; 2326 if (this->IsEmpty()) return false;
2327 return V8::IsGlobalNearDeath(reinterpret_cast<void**>(**this)); 2327 return V8::IsGlobalNearDeath(reinterpret_cast<void**>(**this));
2328 } 2328 }
2329 2329
2330 2330
2331 template <class T> 2331 template <class T>
2332 bool Persistent<T>::IsWeak() { 2332 bool Persistent<T>::IsWeak() const {
2333 if (this->IsEmpty()) return false; 2333 if (this->IsEmpty()) return false;
2334 return V8::IsGlobalWeak(reinterpret_cast<void**>(**this)); 2334 return V8::IsGlobalWeak(reinterpret_cast<void**>(**this));
2335 } 2335 }
2336 2336
2337 2337
2338 template <class T> 2338 template <class T>
2339 void Persistent<T>::Dispose() { 2339 void Persistent<T>::Dispose() {
2340 if (this->IsEmpty()) return; 2340 if (this->IsEmpty()) return;
2341 V8::DisposeGlobal(reinterpret_cast<void**>(**this)); 2341 V8::DisposeGlobal(reinterpret_cast<void**>(**this));
2342 } 2342 }
2343 2343
2344 2344
2345 template <class T> 2345 template <class T>
2346 Persistent<T>::Persistent() : Handle<T>() { } 2346 Persistent<T>::Persistent() : Handle<T>() { }
2347 2347
2348 template <class T> 2348 template <class T>
2349 void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) { 2349 void Persistent<T>::MakeWeak(void* parameters, WeakReferenceCallback callback) {
2350 V8::MakeWeak(reinterpret_cast<void**>(**this), parameters, callback); 2350 V8::MakeWeak(reinterpret_cast<void**>(**this), parameters, callback);
2351 } 2351 }
2352 2352
2353 template <class T> 2353 template <class T>
2354 void Persistent<T>::ClearWeak() { 2354 void Persistent<T>::ClearWeak() {
2355 V8::ClearWeak(reinterpret_cast<void**>(**this)); 2355 V8::ClearWeak(reinterpret_cast<void**>(**this));
2356 } 2356 }
2357 2357
2358 template <class T> 2358 template <class T>
2359 T* Handle<T>::operator->() { 2359 T* Handle<T>::operator->() const {
2360 return val_; 2360 return val_;
2361 } 2361 }
2362 2362
2363 2363
2364 template <class T> 2364 template <class T>
2365 T* Handle<T>::operator*() { 2365 T* Handle<T>::operator*() const {
2366 return val_; 2366 return val_;
2367 } 2367 }
2368 2368
2369 2369
2370 Local<Value> Arguments::operator[](int i) const { 2370 Local<Value> Arguments::operator[](int i) const {
2371 if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); 2371 if (i < 0 || length_ <= i) return Local<Value>(*Undefined());
2372 return Local<Value>(reinterpret_cast<Value*>(values_ - i)); 2372 return Local<Value>(reinterpret_cast<Value*>(values_ - i));
2373 } 2373 }
2374 2374
2375 2375
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 2463
2464 } // namespace v8 2464 } // namespace v8
2465 2465
2466 2466
2467 #undef EXPORT 2467 #undef EXPORT
2468 #undef EXPORT_INLINE 2468 #undef EXPORT_INLINE
2469 #undef TYPE_CHECK 2469 #undef TYPE_CHECK
2470 2470
2471 2471
2472 #endif // V8_H_ 2472 #endif // V8_H_
OLDNEW
« no previous file with comments | « benchmarks/run.js ('k') | src/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698