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

Side by Side Diff: include/v8.h

Issue 7348008: Merge up to 8597 to experimental/gc from the bleeding edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 5 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 | « build/v8-features.gypi ('k') | include/v8-profiler.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * longer used. 158 * longer used.
159 * 159 *
160 * It is safe to extract the object stored in the handle by 160 * It is safe to extract the object stored in the handle by
161 * dereferencing the handle (for instance, to extract the Object* from 161 * dereferencing the handle (for instance, to extract the Object* from
162 * a Handle<Object>); the value will still be governed by a handle 162 * a Handle<Object>); the value will still be governed by a handle
163 * behind the scenes and the same rules apply to these values as to 163 * behind the scenes and the same rules apply to these values as to
164 * their handles. 164 * their handles.
165 */ 165 */
166 template <class T> class Handle { 166 template <class T> class Handle {
167 public: 167 public:
168
169 /** 168 /**
170 * Creates an empty handle. 169 * Creates an empty handle.
171 */ 170 */
172 inline Handle(); 171 inline Handle();
173 172
174 /** 173 /**
175 * Creates a new handle for the specified value. 174 * Creates a new handle for the specified value.
176 */ 175 */
177 inline explicit Handle(T* val) : val_(val) { } 176 inline explicit Handle(T* val) : val_(val) { }
178 177
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 * cell can be created using Persistent::New and existing handles can 304 * cell can be created using Persistent::New and existing handles can
306 * be disposed using Persistent::Dispose. Since persistent handles 305 * be disposed using Persistent::Dispose. Since persistent handles
307 * are passed by value you may have many persistent handle objects 306 * are passed by value you may have many persistent handle objects
308 * that point to the same storage cell. For instance, if you pass a 307 * that point to the same storage cell. For instance, if you pass a
309 * persistent handle as an argument to a function you will not get two 308 * persistent handle as an argument to a function you will not get two
310 * different storage cells but rather two references to the same 309 * different storage cells but rather two references to the same
311 * storage cell. 310 * storage cell.
312 */ 311 */
313 template <class T> class Persistent : public Handle<T> { 312 template <class T> class Persistent : public Handle<T> {
314 public: 313 public:
315
316 /** 314 /**
317 * Creates an empty persistent handle that doesn't point to any 315 * Creates an empty persistent handle that doesn't point to any
318 * storage cell. 316 * storage cell.
319 */ 317 */
320 inline Persistent(); 318 inline Persistent();
321 319
322 /** 320 /**
323 * Creates a persistent handle for the same storage cell as the 321 * Creates a persistent handle for the same storage cell as the
324 * specified handle. This constructor allows you to pass persistent 322 * specified handle. This constructor allows you to pass persistent
325 * handles as arguments by value and to assign between persistent 323 * handles as arguments by value and to assign between persistent
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 Handle<Integer> resource_line_offset_; 577 Handle<Integer> resource_line_offset_;
580 Handle<Integer> resource_column_offset_; 578 Handle<Integer> resource_column_offset_;
581 }; 579 };
582 580
583 581
584 /** 582 /**
585 * A compiled JavaScript script. 583 * A compiled JavaScript script.
586 */ 584 */
587 class V8EXPORT Script { 585 class V8EXPORT Script {
588 public: 586 public:
589
590 /** 587 /**
591 * Compiles the specified script (context-independent). 588 * Compiles the specified script (context-independent).
592 * 589 *
593 * \param source Script source code. 590 * \param source Script source code.
594 * \param origin Script origin, owned by caller, no references are kept 591 * \param origin Script origin, owned by caller, no references are kept
595 * when New() returns 592 * when New() returns
596 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() 593 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
597 * using pre_data speeds compilation if it's done multiple times. 594 * using pre_data speeds compilation if it's done multiple times.
598 * Owned by caller, no references are kept when New() returns. 595 * Owned by caller, no references are kept when New() returns.
599 * \param script_data Arbitrary data associated with script. Using 596 * \param script_data Arbitrary data associated with script. Using
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 848
852 849
853 // --- Value --- 850 // --- Value ---
854 851
855 852
856 /** 853 /**
857 * The superclass of all JavaScript values and objects. 854 * The superclass of all JavaScript values and objects.
858 */ 855 */
859 class Value : public Data { 856 class Value : public Data {
860 public: 857 public:
861
862 /** 858 /**
863 * Returns true if this value is the undefined value. See ECMA-262 859 * Returns true if this value is the undefined value. See ECMA-262
864 * 4.3.10. 860 * 4.3.10.
865 */ 861 */
866 V8EXPORT bool IsUndefined() const; 862 V8EXPORT bool IsUndefined() const;
867 863
868 /** 864 /**
869 * Returns true if this value is the null value. See ECMA-262 865 * Returns true if this value is the null value. See ECMA-262
870 * 4.3.11. 866 * 4.3.11.
871 */ 867 */
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 V8EXPORT bool Value() const; 979 V8EXPORT bool Value() const;
984 static inline Handle<Boolean> New(bool value); 980 static inline Handle<Boolean> New(bool value);
985 }; 981 };
986 982
987 983
988 /** 984 /**
989 * A JavaScript string value (ECMA-262, 4.3.17). 985 * A JavaScript string value (ECMA-262, 4.3.17).
990 */ 986 */
991 class String : public Primitive { 987 class String : public Primitive {
992 public: 988 public:
993
994 /** 989 /**
995 * Returns the number of characters in this string. 990 * Returns the number of characters in this string.
996 */ 991 */
997 V8EXPORT int Length() const; 992 V8EXPORT int Length() const;
998 993
999 /** 994 /**
1000 * Returns the number of bytes in the UTF-8 encoded 995 * Returns the number of bytes in the UTF-8 encoded
1001 * representation of this string. 996 * representation of this string.
1002 */ 997 */
1003 V8EXPORT int Utf8Length() const; 998 V8EXPORT int Utf8Length() const;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1458
1464 /** 1459 /**
1465 * Returns an array containing the names of the enumerable properties 1460 * Returns an array containing the names of the enumerable properties
1466 * of this object, including properties from prototype objects. The 1461 * of this object, including properties from prototype objects. The
1467 * array returned by this method contains the same values as would 1462 * array returned by this method contains the same values as would
1468 * be enumerated by a for-in statement over this object. 1463 * be enumerated by a for-in statement over this object.
1469 */ 1464 */
1470 V8EXPORT Local<Array> GetPropertyNames(); 1465 V8EXPORT Local<Array> GetPropertyNames();
1471 1466
1472 /** 1467 /**
1468 * This function has the same functionality as GetPropertyNames but
1469 * the returned array doesn't contain the names of properties from
1470 * prototype objects.
1471 */
1472 V8EXPORT Local<Array> GetOwnPropertyNames();
1473
1474 /**
1473 * Get the prototype object. This does not skip objects marked to 1475 * Get the prototype object. This does not skip objects marked to
1474 * be skipped by __proto__ and it does not consult the security 1476 * be skipped by __proto__ and it does not consult the security
1475 * handler. 1477 * handler.
1476 */ 1478 */
1477 V8EXPORT Local<Value> GetPrototype(); 1479 V8EXPORT Local<Value> GetPrototype();
1478 1480
1479 /** 1481 /**
1480 * Set the prototype object. This does not skip objects marked to 1482 * Set the prototype object. This does not skip objects marked to
1481 * be skipped by __proto__ and it does not consult the security 1483 * be skipped by __proto__ and it does not consult the security
1482 * handler. 1484 * handler.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 /** 1635 /**
1634 * Call an Object as a constructor if a callback is set by the 1636 * Call an Object as a constructor if a callback is set by the
1635 * ObjectTemplate::SetCallAsFunctionHandler method. 1637 * ObjectTemplate::SetCallAsFunctionHandler method.
1636 * Note: This method behaves like the Function::NewInstance method. 1638 * Note: This method behaves like the Function::NewInstance method.
1637 */ 1639 */
1638 V8EXPORT Local<Value> CallAsConstructor(int argc, 1640 V8EXPORT Local<Value> CallAsConstructor(int argc,
1639 Handle<Value> argv[]); 1641 Handle<Value> argv[]);
1640 1642
1641 V8EXPORT static Local<Object> New(); 1643 V8EXPORT static Local<Object> New();
1642 static inline Object* Cast(Value* obj); 1644 static inline Object* Cast(Value* obj);
1645
1643 private: 1646 private:
1644 V8EXPORT Object(); 1647 V8EXPORT Object();
1645 V8EXPORT static void CheckCast(Value* obj); 1648 V8EXPORT static void CheckCast(Value* obj);
1646 V8EXPORT Local<Value> CheckedGetInternalField(int index); 1649 V8EXPORT Local<Value> CheckedGetInternalField(int index);
1647 V8EXPORT void* SlowGetPointerFromInternalField(int index); 1650 V8EXPORT void* SlowGetPointerFromInternalField(int index);
1648 1651
1649 /** 1652 /**
1650 * If quick access to the internal field is possible this method 1653 * If quick access to the internal field is possible this method
1651 * returns the value. Otherwise an empty handle is returned. 1654 * returns the value. Otherwise an empty handle is returned.
1652 */ 1655 */
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2134 * 2137 *
2135 * Call with a value of true to make the __proto__ accessor ignore 2138 * Call with a value of true to make the __proto__ accessor ignore
2136 * instances of the function template. Call with a value of false 2139 * instances of the function template. Call with a value of false
2137 * to make the __proto__ accessor not ignore instances of the 2140 * to make the __proto__ accessor not ignore instances of the
2138 * function template. By default, instances of a function template 2141 * function template. By default, instances of a function template
2139 * are not ignored. 2142 * are not ignored.
2140 */ 2143 */
2141 void SetHiddenPrototype(bool value); 2144 void SetHiddenPrototype(bool value);
2142 2145
2143 /** 2146 /**
2147 * Sets the property attributes of the 'prototype' property of functions
2148 * created from this FunctionTemplate. Can be any combination of ReadOnly,
2149 * DontEnum and DontDelete.
2150 */
2151 void SetPrototypeAttributes(int attributes);
2152
2153 /**
2144 * Returns true if the given object is an instance of this function 2154 * Returns true if the given object is an instance of this function
2145 * template. 2155 * template.
2146 */ 2156 */
2147 bool HasInstance(Handle<Value> object); 2157 bool HasInstance(Handle<Value> object);
2148 2158
2149 private: 2159 private:
2150 FunctionTemplate(); 2160 FunctionTemplate();
2151 void AddInstancePropertyAccessor(Handle<String> name, 2161 void AddInstancePropertyAccessor(Handle<String> name,
2152 AccessorGetter getter, 2162 AccessorGetter getter,
2153 AccessorSetter setter, 2163 AccessorSetter setter,
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 kGCCallbackFlagCompacted = 1 << 0 2551 kGCCallbackFlagCompacted = 1 << 0
2542 }; 2552 };
2543 2553
2544 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); 2554 typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags);
2545 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); 2555 typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags);
2546 2556
2547 typedef void (*GCCallback)(); 2557 typedef void (*GCCallback)();
2548 2558
2549 2559
2550 /** 2560 /**
2551 * Profiler modules.
2552 *
2553 * In V8, profiler consists of several modules: CPU profiler, and different
2554 * kinds of heap profiling. Each can be turned on / off independently.
2555 * When PROFILER_MODULE_HEAP_SNAPSHOT flag is passed to ResumeProfilerEx,
2556 * modules are enabled only temporarily for making a snapshot of the heap.
2557 */
2558 enum ProfilerModules {
2559 PROFILER_MODULE_NONE = 0,
2560 PROFILER_MODULE_CPU = 1,
2561 PROFILER_MODULE_HEAP_STATS = 1 << 1,
2562 PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2,
2563 PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16
2564 };
2565
2566
2567 /**
2568 * Collection of V8 heap information. 2561 * Collection of V8 heap information.
2569 * 2562 *
2570 * Instances of this class can be passed to v8::V8::HeapStatistics to 2563 * Instances of this class can be passed to v8::V8::HeapStatistics to
2571 * get heap statistics from V8. 2564 * get heap statistics from V8.
2572 */ 2565 */
2573 class V8EXPORT HeapStatistics { 2566 class V8EXPORT HeapStatistics {
2574 public: 2567 public:
2575 HeapStatistics(); 2568 HeapStatistics();
2576 size_t total_heap_size() { return total_heap_size_; } 2569 size_t total_heap_size() { return total_heap_size_; }
2577 size_t total_heap_size_executable() { return total_heap_size_executable_; } 2570 size_t total_heap_size_executable() { return total_heap_size_executable_; }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2675 */ 2668 */
2676 void SetData(void* data); 2669 void SetData(void* data);
2677 2670
2678 /** 2671 /**
2679 * Retrive embedder-specific data from the isolate. 2672 * Retrive embedder-specific data from the isolate.
2680 * Returns NULL if SetData has never been called. 2673 * Returns NULL if SetData has never been called.
2681 */ 2674 */
2682 void* GetData(); 2675 void* GetData();
2683 2676
2684 private: 2677 private:
2685
2686 Isolate(); 2678 Isolate();
2687 Isolate(const Isolate&); 2679 Isolate(const Isolate&);
2688 ~Isolate(); 2680 ~Isolate();
2689 Isolate& operator=(const Isolate&); 2681 Isolate& operator=(const Isolate&);
2690 void* operator new(size_t size); 2682 void* operator new(size_t size);
2691 void operator delete(void*, size_t); 2683 void operator delete(void*, size_t);
2692 }; 2684 };
2693 2685
2694 2686
2695 class StartupData { 2687 class StartupData {
2696 public: 2688 public:
2697 enum CompressionAlgorithm { 2689 enum CompressionAlgorithm {
2698 kUncompressed, 2690 kUncompressed,
2699 kBZip2 2691 kBZip2
2700 }; 2692 };
2701 2693
2702 const char* data; 2694 const char* data;
2703 int compressed_size; 2695 int compressed_size;
2704 int raw_size; 2696 int raw_size;
2705 }; 2697 };
2706 2698
2699
2700 /**
2701 * A helper class for driving V8 startup data decompression. It is based on
2702 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory
2703 * for an embedder to use this class, instead, API functions can be used
2704 * directly.
2705 *
2706 * For an example of the class usage, see the "shell.cc" sample application.
2707 */
2708 class V8EXPORT StartupDataDecompressor { // NOLINT
2709 public:
2710 StartupDataDecompressor();
2711 virtual ~StartupDataDecompressor();
2712 int Decompress();
2713
2714 protected:
2715 virtual int DecompressData(char* raw_data,
2716 int* raw_data_size,
2717 const char* compressed_data,
2718 int compressed_data_size) = 0;
2719
2720 private:
2721 char** raw_data;
2722 };
2723
2707 /** 2724 /**
2708 * Container class for static utility functions. 2725 * Container class for static utility functions.
2709 */ 2726 */
2710 class V8EXPORT V8 { 2727 class V8EXPORT V8 {
2711 public: 2728 public:
2712 /** Set the callback to invoke in case of fatal errors. */ 2729 /** Set the callback to invoke in case of fatal errors. */
2713 static void SetFatalErrorHandler(FatalErrorCallback that); 2730 static void SetFatalErrorHandler(FatalErrorCallback that);
2714 2731
2715 /** 2732 /**
2716 * Set the callback to invoke to check if code generation from 2733 * Set the callback to invoke to check if code generation from
(...skipping 29 matching lines...) Expand all
2746 * 2763 *
2747 * This is how interaction with V8 should look like: 2764 * This is how interaction with V8 should look like:
2748 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount(); 2765 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
2749 * v8::StartupData* compressed_data = 2766 * v8::StartupData* compressed_data =
2750 * new v8::StartupData[compressed_data_count]; 2767 * new v8::StartupData[compressed_data_count];
2751 * v8::V8::GetCompressedStartupData(compressed_data); 2768 * v8::V8::GetCompressedStartupData(compressed_data);
2752 * ... decompress data (compressed_data can be updated in-place) ... 2769 * ... decompress data (compressed_data can be updated in-place) ...
2753 * v8::V8::SetDecompressedStartupData(compressed_data); 2770 * v8::V8::SetDecompressedStartupData(compressed_data);
2754 * ... now V8 can be initialized 2771 * ... now V8 can be initialized
2755 * ... make sure the decompressed data stays valid until V8 shutdown 2772 * ... make sure the decompressed data stays valid until V8 shutdown
2773 *
2774 * A helper class StartupDataDecompressor is provided. It implements
2775 * the protocol of the interaction described above, and can be used in
2776 * most cases instead of calling these API functions directly.
2756 */ 2777 */
2757 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm(); 2778 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
2758 static int GetCompressedStartupDataCount(); 2779 static int GetCompressedStartupDataCount();
2759 static void GetCompressedStartupData(StartupData* compressed_data); 2780 static void GetCompressedStartupData(StartupData* compressed_data);
2760 static void SetDecompressedStartupData(StartupData* decompressed_data); 2781 static void SetDecompressedStartupData(StartupData* decompressed_data);
2761 2782
2762 /** 2783 /**
2763 * Adds a message listener. 2784 * Adds a message listener.
2764 * 2785 *
2765 * The same message listener can be added more than once and in that 2786 * The same message listener can be added more than once and in that
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 * See also PauseProfiler(). 2977 * See also PauseProfiler().
2957 */ 2978 */
2958 static void ResumeProfiler(); 2979 static void ResumeProfiler();
2959 2980
2960 /** 2981 /**
2961 * Return whether profiler is currently paused. 2982 * Return whether profiler is currently paused.
2962 */ 2983 */
2963 static bool IsProfilerPaused(); 2984 static bool IsProfilerPaused();
2964 2985
2965 /** 2986 /**
2966 * Resumes specified profiler modules. Can be called several times to
2967 * mark the opening of a profiler events block with the given tag.
2968 *
2969 * "ResumeProfiler" is equivalent to "ResumeProfilerEx(PROFILER_MODULE_CPU)".
2970 * See ProfilerModules enum.
2971 *
2972 * \param flags Flags specifying profiler modules.
2973 * \param tag Profile tag.
2974 */
2975 static void ResumeProfilerEx(int flags, int tag = 0);
2976
2977 /**
2978 * Pauses specified profiler modules. Each call to "PauseProfilerEx" closes
2979 * a block of profiler events opened by a call to "ResumeProfilerEx" with the
2980 * same tag value. There is no need for blocks to be properly nested.
2981 * The profiler is paused when the last opened block is closed.
2982 *
2983 * "PauseProfiler" is equivalent to "PauseProfilerEx(PROFILER_MODULE_CPU)".
2984 * See ProfilerModules enum.
2985 *
2986 * \param flags Flags specifying profiler modules.
2987 * \param tag Profile tag.
2988 */
2989 static void PauseProfilerEx(int flags, int tag = 0);
2990
2991 /**
2992 * Returns active (resumed) profiler modules.
2993 * See ProfilerModules enum.
2994 *
2995 * \returns active profiler modules.
2996 */
2997 static int GetActiveProfilerModules();
2998
2999 /**
3000 * If logging is performed into a memory buffer (via --logfile=*), allows to 2987 * If logging is performed into a memory buffer (via --logfile=*), allows to
3001 * retrieve previously written messages. This can be used for retrieving 2988 * retrieve previously written messages. This can be used for retrieving
3002 * profiler log data in the application. This function is thread-safe. 2989 * profiler log data in the application. This function is thread-safe.
3003 * 2990 *
3004 * Caller provides a destination buffer that must exist during GetLogLines 2991 * Caller provides a destination buffer that must exist during GetLogLines
3005 * call. Only whole log lines are copied into the buffer. 2992 * call. Only whole log lines are copied into the buffer.
3006 * 2993 *
3007 * \param from_pos specified a point in a buffer to read from, 0 is the 2994 * \param from_pos specified a point in a buffer to read from, 0 is the
3008 * beginning of a buffer. It is assumed that caller updates its current 2995 * beginning of a buffer. It is assumed that caller updates its current
3009 * position using returned size value from the previous call. 2996 * position using returned size value from the previous call.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 */ 3054 */
3068 static void TerminateExecution(Isolate* isolate = NULL); 3055 static void TerminateExecution(Isolate* isolate = NULL);
3069 3056
3070 /** 3057 /**
3071 * Is V8 terminating JavaScript execution. 3058 * Is V8 terminating JavaScript execution.
3072 * 3059 *
3073 * Returns true if JavaScript execution is currently terminating 3060 * Returns true if JavaScript execution is currently terminating
3074 * because of a call to TerminateExecution. In that case there are 3061 * because of a call to TerminateExecution. In that case there are
3075 * still JavaScript frames on the stack and the termination 3062 * still JavaScript frames on the stack and the termination
3076 * exception is still active. 3063 * exception is still active.
3064 *
3065 * \param isolate The isolate in which to check.
3077 */ 3066 */
3078 static bool IsExecutionTerminating(); 3067 static bool IsExecutionTerminating(Isolate* isolate = NULL);
3079 3068
3080 /** 3069 /**
3081 * Releases any resources used by v8 and stops any utility threads 3070 * Releases any resources used by v8 and stops any utility threads
3082 * that may be running. Note that disposing v8 is permanent, it 3071 * that may be running. Note that disposing v8 is permanent, it
3083 * cannot be reinitialized. 3072 * cannot be reinitialized.
3084 * 3073 *
3085 * It should generally not be necessary to dispose v8 before exiting 3074 * It should generally not be necessary to dispose v8 before exiting
3086 * a process, this should happen automatically. It is only necessary 3075 * a process, this should happen automatically. It is only necessary
3087 * to use if the process needs the resources taken up by v8. 3076 * to use if the process needs the resources taken up by v8.
3088 */ 3077 */
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 template <class T> friend class Persistent; 3126 template <class T> friend class Persistent;
3138 friend class Context; 3127 friend class Context;
3139 }; 3128 };
3140 3129
3141 3130
3142 /** 3131 /**
3143 * An external exception handler. 3132 * An external exception handler.
3144 */ 3133 */
3145 class V8EXPORT TryCatch { 3134 class V8EXPORT TryCatch {
3146 public: 3135 public:
3147
3148 /** 3136 /**
3149 * Creates a new try/catch block and registers it with v8. 3137 * Creates a new try/catch block and registers it with v8.
3150 */ 3138 */
3151 TryCatch(); 3139 TryCatch();
3152 3140
3153 /** 3141 /**
3154 * Unregisters and deletes this try/catch block. 3142 * Unregisters and deletes this try/catch block.
3155 */ 3143 */
3156 ~TryCatch(); 3144 ~TryCatch();
3157 3145
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 void SetVerbose(bool value); 3217 void SetVerbose(bool value);
3230 3218
3231 /** 3219 /**
3232 * Set whether or not this TryCatch should capture a Message object 3220 * Set whether or not this TryCatch should capture a Message object
3233 * which holds source information about where the exception 3221 * which holds source information about where the exception
3234 * occurred. True by default. 3222 * occurred. True by default.
3235 */ 3223 */
3236 void SetCaptureMessage(bool value); 3224 void SetCaptureMessage(bool value);
3237 3225
3238 private: 3226 private:
3227 v8::internal::Isolate* isolate_;
3239 void* next_; 3228 void* next_;
3240 void* exception_; 3229 void* exception_;
3241 void* message_; 3230 void* message_;
3242 bool is_verbose_ : 1; 3231 bool is_verbose_ : 1;
3243 bool can_continue_ : 1; 3232 bool can_continue_ : 1;
3244 bool capture_message_ : 1; 3233 bool capture_message_ : 1;
3245 bool rethrow_ : 1; 3234 bool rethrow_ : 1;
3246 3235
3247 friend class v8::internal::Isolate; 3236 friend class v8::internal::Isolate;
3248 }; 3237 };
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
3683 static const int kStringResourceOffset = 3 * kApiPointerSize; 3672 static const int kStringResourceOffset = 3 * kApiPointerSize;
3684 }; 3673 };
3685 3674
3686 /** 3675 /**
3687 * This class exports constants and functionality from within v8 that 3676 * This class exports constants and functionality from within v8 that
3688 * is necessary to implement inline functions in the v8 api. Don't 3677 * is necessary to implement inline functions in the v8 api. Don't
3689 * depend on functions and constants defined here. 3678 * depend on functions and constants defined here.
3690 */ 3679 */
3691 class Internals { 3680 class Internals {
3692 public: 3681 public:
3693
3694 // These values match non-compiler-dependent values defined within 3682 // These values match non-compiler-dependent values defined within
3695 // the implementation of v8. 3683 // the implementation of v8.
3696 static const int kHeapObjectMapOffset = 0; 3684 static const int kHeapObjectMapOffset = 0;
3697 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; 3685 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
3698 static const int kStringResourceOffset = 3686 static const int kStringResourceOffset =
3699 InternalConstants<kApiPointerSize>::kStringResourceOffset; 3687 InternalConstants<kApiPointerSize>::kStringResourceOffset;
3700 3688
3701 static const int kForeignAddressOffset = kApiPointerSize; 3689 static const int kForeignAddressOffset = kApiPointerSize;
3702 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; 3690 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
3703 static const int kFullStringRepresentationMask = 0x07; 3691 static const int kFullStringRepresentationMask = 0x07;
3704 static const int kExternalTwoByteRepresentationTag = 0x02; 3692 static const int kExternalTwoByteRepresentationTag = 0x02;
3705 3693
3706 static const int kJSObjectType = 0xa3; 3694 static const int kJSObjectType = 0xa4;
3707 static const int kFirstNonstringType = 0x80; 3695 static const int kFirstNonstringType = 0x80;
3708 static const int kForeignType = 0x85; 3696 static const int kForeignType = 0x85;
3709 3697
3710 static inline bool HasHeapObjectTag(internal::Object* value) { 3698 static inline bool HasHeapObjectTag(internal::Object* value) {
3711 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == 3699 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
3712 kHeapObjectTag); 3700 kHeapObjectTag);
3713 } 3701 }
3714 3702
3715 static inline bool HasSmiTag(internal::Object* value) { 3703 static inline bool HasSmiTag(internal::Object* value) {
3716 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); 3704 return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
4115 4103
4116 4104
4117 } // namespace v8 4105 } // namespace v8
4118 4106
4119 4107
4120 #undef V8EXPORT 4108 #undef V8EXPORT
4121 #undef TYPE_CHECK 4109 #undef TYPE_CHECK
4122 4110
4123 4111
4124 #endif // V8_H_ 4112 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/v8-features.gypi ('k') | include/v8-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698