OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 | 2231 |
2232 /** JS == */ | 2232 /** JS == */ |
2233 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const); | 2233 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const); |
2234 V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, | 2234 V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, |
2235 Local<Value> that) const; | 2235 Local<Value> that) const; |
2236 bool StrictEquals(Local<Value> that) const; | 2236 bool StrictEquals(Local<Value> that) const; |
2237 bool SameValue(Local<Value> that) const; | 2237 bool SameValue(Local<Value> that) const; |
2238 | 2238 |
2239 template <class T> V8_INLINE static Value* Cast(T* value); | 2239 template <class T> V8_INLINE static Value* Cast(T* value); |
2240 | 2240 |
2241 Local<String> TypeOf(v8::Isolate*); | 2241 Local<String> TypeOf(Isolate*); |
2242 | 2242 |
2243 private: | 2243 private: |
2244 V8_INLINE bool QuickIsUndefined() const; | 2244 V8_INLINE bool QuickIsUndefined() const; |
2245 V8_INLINE bool QuickIsNull() const; | 2245 V8_INLINE bool QuickIsNull() const; |
2246 V8_INLINE bool QuickIsString() const; | 2246 V8_INLINE bool QuickIsString() const; |
2247 bool FullIsUndefined() const; | 2247 bool FullIsUndefined() const; |
2248 bool FullIsNull() const; | 2248 bool FullIsNull() const; |
2249 bool FullIsString() const; | 2249 bool FullIsString() const; |
2250 }; | 2250 }; |
2251 | 2251 |
(...skipping 26 matching lines...) Expand all Loading... |
2278 public: | 2278 public: |
2279 /** | 2279 /** |
2280 * Returns the identity hash for this object. The current implementation | 2280 * Returns the identity hash for this object. The current implementation |
2281 * uses an inline property on the object to store the identity hash. | 2281 * uses an inline property on the object to store the identity hash. |
2282 * | 2282 * |
2283 * The return value will never be 0. Also, it is not guaranteed to be | 2283 * The return value will never be 0. Also, it is not guaranteed to be |
2284 * unique. | 2284 * unique. |
2285 */ | 2285 */ |
2286 int GetIdentityHash(); | 2286 int GetIdentityHash(); |
2287 | 2287 |
2288 V8_INLINE static Name* Cast(v8::Value* obj); | 2288 V8_INLINE static Name* Cast(Value* obj); |
| 2289 |
2289 private: | 2290 private: |
2290 static void CheckCast(v8::Value* obj); | 2291 static void CheckCast(Value* obj); |
2291 }; | 2292 }; |
2292 | 2293 |
2293 | 2294 |
2294 enum class NewStringType { kNormal, kInternalized }; | 2295 enum class NewStringType { kNormal, kInternalized }; |
2295 | 2296 |
2296 | 2297 |
2297 /** | 2298 /** |
2298 * A JavaScript string value (ECMA-262, 4.3.17). | 2299 * A JavaScript string value (ECMA-262, 4.3.17). |
2299 */ | 2300 */ |
2300 class V8_EXPORT String : public Name { | 2301 class V8_EXPORT String : public Name { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 int options = NO_OPTIONS) const; | 2379 int options = NO_OPTIONS) const; |
2379 // UTF-8 encoded characters. | 2380 // UTF-8 encoded characters. |
2380 int WriteUtf8(char* buffer, | 2381 int WriteUtf8(char* buffer, |
2381 int length = -1, | 2382 int length = -1, |
2382 int* nchars_ref = NULL, | 2383 int* nchars_ref = NULL, |
2383 int options = NO_OPTIONS) const; | 2384 int options = NO_OPTIONS) const; |
2384 | 2385 |
2385 /** | 2386 /** |
2386 * A zero length string. | 2387 * A zero length string. |
2387 */ | 2388 */ |
2388 V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate); | 2389 V8_INLINE static Local<String> Empty(Isolate* isolate); |
2389 | 2390 |
2390 /** | 2391 /** |
2391 * Returns true if the string is external | 2392 * Returns true if the string is external |
2392 */ | 2393 */ |
2393 bool IsExternal() const; | 2394 bool IsExternal() const; |
2394 | 2395 |
2395 /** | 2396 /** |
2396 * Returns true if the string is both external and one-byte. | 2397 * Returns true if the string is both external and one-byte. |
2397 */ | 2398 */ |
2398 bool IsExternalOneByte() const; | 2399 bool IsExternalOneByte() const; |
(...skipping 13 matching lines...) Expand all Loading... |
2412 * delete operator. This method can be overridden in subclasses to | 2413 * delete operator. This method can be overridden in subclasses to |
2413 * control how allocated external string resources are disposed. | 2414 * control how allocated external string resources are disposed. |
2414 */ | 2415 */ |
2415 virtual void Dispose() { delete this; } | 2416 virtual void Dispose() { delete this; } |
2416 | 2417 |
2417 // Disallow copying and assigning. | 2418 // Disallow copying and assigning. |
2418 ExternalStringResourceBase(const ExternalStringResourceBase&) = delete; | 2419 ExternalStringResourceBase(const ExternalStringResourceBase&) = delete; |
2419 void operator=(const ExternalStringResourceBase&) = delete; | 2420 void operator=(const ExternalStringResourceBase&) = delete; |
2420 | 2421 |
2421 private: | 2422 private: |
2422 friend class v8::internal::Heap; | 2423 friend class internal::Heap; |
2423 }; | 2424 }; |
2424 | 2425 |
2425 /** | 2426 /** |
2426 * An ExternalStringResource is a wrapper around a two-byte string | 2427 * An ExternalStringResource is a wrapper around a two-byte string |
2427 * buffer that resides outside V8's heap. Implement an | 2428 * buffer that resides outside V8's heap. Implement an |
2428 * ExternalStringResource to manage the life cycle of the underlying | 2429 * ExternalStringResource to manage the life cycle of the underlying |
2429 * buffer. Note that the string data must be immutable. | 2430 * buffer. Note that the string data must be immutable. |
2430 */ | 2431 */ |
2431 class V8_EXPORT ExternalStringResource | 2432 class V8_EXPORT ExternalStringResource |
2432 : public ExternalStringResourceBase { | 2433 : public ExternalStringResourceBase { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 // Retrieve a global symbol. Similar to |For|, but using a separate | 2684 // Retrieve a global symbol. Similar to |For|, but using a separate |
2684 // registry that is not accessible by (and cannot clash with) JavaScript code. | 2685 // registry that is not accessible by (and cannot clash with) JavaScript code. |
2685 static Local<Symbol> ForApi(Isolate *isolate, Local<String> name); | 2686 static Local<Symbol> ForApi(Isolate *isolate, Local<String> name); |
2686 | 2687 |
2687 // Well-known symbols | 2688 // Well-known symbols |
2688 static Local<Symbol> GetIterator(Isolate* isolate); | 2689 static Local<Symbol> GetIterator(Isolate* isolate); |
2689 static Local<Symbol> GetUnscopables(Isolate* isolate); | 2690 static Local<Symbol> GetUnscopables(Isolate* isolate); |
2690 static Local<Symbol> GetToStringTag(Isolate* isolate); | 2691 static Local<Symbol> GetToStringTag(Isolate* isolate); |
2691 static Local<Symbol> GetIsConcatSpreadable(Isolate* isolate); | 2692 static Local<Symbol> GetIsConcatSpreadable(Isolate* isolate); |
2692 | 2693 |
2693 V8_INLINE static Symbol* Cast(v8::Value* obj); | 2694 V8_INLINE static Symbol* Cast(Value* obj); |
2694 | 2695 |
2695 private: | 2696 private: |
2696 Symbol(); | 2697 Symbol(); |
2697 static void CheckCast(v8::Value* obj); | 2698 static void CheckCast(Value* obj); |
2698 }; | 2699 }; |
2699 | 2700 |
2700 | 2701 |
2701 /** | 2702 /** |
2702 * A private symbol | 2703 * A private symbol |
2703 * | 2704 * |
2704 * This is an experimental feature. Use at your own risk. | 2705 * This is an experimental feature. Use at your own risk. |
2705 */ | 2706 */ |
2706 class V8_EXPORT Private : public Data { | 2707 class V8_EXPORT Private : public Data { |
2707 public: | 2708 public: |
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4431 Local<Value> New(Isolate* isolate, double time)); | 4432 Local<Value> New(Isolate* isolate, double time)); |
4432 static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context, | 4433 static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context, |
4433 double time); | 4434 double time); |
4434 | 4435 |
4435 /** | 4436 /** |
4436 * A specialization of Value::NumberValue that is more efficient | 4437 * A specialization of Value::NumberValue that is more efficient |
4437 * because we know the structure of this object. | 4438 * because we know the structure of this object. |
4438 */ | 4439 */ |
4439 double ValueOf() const; | 4440 double ValueOf() const; |
4440 | 4441 |
4441 V8_INLINE static Date* Cast(v8::Value* obj); | 4442 V8_INLINE static Date* Cast(Value* obj); |
4442 | 4443 |
4443 /** | 4444 /** |
4444 * Notification that the embedder has changed the time zone, | 4445 * Notification that the embedder has changed the time zone, |
4445 * daylight savings time, or other date / time configuration | 4446 * daylight savings time, or other date / time configuration |
4446 * parameters. V8 keeps a cache of various values used for | 4447 * parameters. V8 keeps a cache of various values used for |
4447 * date / time computation. This notification will reset | 4448 * date / time computation. This notification will reset |
4448 * those cached values for the current context so that date / | 4449 * those cached values for the current context so that date / |
4449 * time configuration changes would be reflected in the Date | 4450 * time configuration changes would be reflected in the Date |
4450 * object. | 4451 * object. |
4451 * | 4452 * |
4452 * This API should not be called more than needed as it will | 4453 * This API should not be called more than needed as it will |
4453 * negatively impact the performance of date operations. | 4454 * negatively impact the performance of date operations. |
4454 */ | 4455 */ |
4455 static void DateTimeConfigurationChangeNotification(Isolate* isolate); | 4456 static void DateTimeConfigurationChangeNotification(Isolate* isolate); |
4456 | 4457 |
4457 private: | 4458 private: |
4458 static void CheckCast(v8::Value* obj); | 4459 static void CheckCast(Value* obj); |
4459 }; | 4460 }; |
4460 | 4461 |
4461 | 4462 |
4462 /** | 4463 /** |
4463 * A Number object (ECMA-262, 4.3.21). | 4464 * A Number object (ECMA-262, 4.3.21). |
4464 */ | 4465 */ |
4465 class V8_EXPORT NumberObject : public Object { | 4466 class V8_EXPORT NumberObject : public Object { |
4466 public: | 4467 public: |
4467 static Local<Value> New(Isolate* isolate, double value); | 4468 static Local<Value> New(Isolate* isolate, double value); |
4468 | 4469 |
4469 double ValueOf() const; | 4470 double ValueOf() const; |
4470 | 4471 |
4471 V8_INLINE static NumberObject* Cast(v8::Value* obj); | 4472 V8_INLINE static NumberObject* Cast(Value* obj); |
4472 | 4473 |
4473 private: | 4474 private: |
4474 static void CheckCast(v8::Value* obj); | 4475 static void CheckCast(Value* obj); |
4475 }; | 4476 }; |
4476 | 4477 |
4477 | 4478 |
4478 /** | 4479 /** |
4479 * A Boolean object (ECMA-262, 4.3.15). | 4480 * A Boolean object (ECMA-262, 4.3.15). |
4480 */ | 4481 */ |
4481 class V8_EXPORT BooleanObject : public Object { | 4482 class V8_EXPORT BooleanObject : public Object { |
4482 public: | 4483 public: |
4483 static Local<Value> New(Isolate* isolate, bool value); | 4484 static Local<Value> New(Isolate* isolate, bool value); |
4484 V8_DEPRECATED("Pass an isolate", static Local<Value> New(bool value)); | 4485 V8_DEPRECATED("Pass an isolate", static Local<Value> New(bool value)); |
4485 | 4486 |
4486 bool ValueOf() const; | 4487 bool ValueOf() const; |
4487 | 4488 |
4488 V8_INLINE static BooleanObject* Cast(v8::Value* obj); | 4489 V8_INLINE static BooleanObject* Cast(Value* obj); |
4489 | 4490 |
4490 private: | 4491 private: |
4491 static void CheckCast(v8::Value* obj); | 4492 static void CheckCast(Value* obj); |
4492 }; | 4493 }; |
4493 | 4494 |
4494 | 4495 |
4495 /** | 4496 /** |
4496 * A String object (ECMA-262, 4.3.18). | 4497 * A String object (ECMA-262, 4.3.18). |
4497 */ | 4498 */ |
4498 class V8_EXPORT StringObject : public Object { | 4499 class V8_EXPORT StringObject : public Object { |
4499 public: | 4500 public: |
4500 static Local<Value> New(Local<String> value); | 4501 static Local<Value> New(Local<String> value); |
4501 | 4502 |
4502 Local<String> ValueOf() const; | 4503 Local<String> ValueOf() const; |
4503 | 4504 |
4504 V8_INLINE static StringObject* Cast(v8::Value* obj); | 4505 V8_INLINE static StringObject* Cast(Value* obj); |
4505 | 4506 |
4506 private: | 4507 private: |
4507 static void CheckCast(v8::Value* obj); | 4508 static void CheckCast(Value* obj); |
4508 }; | 4509 }; |
4509 | 4510 |
4510 | 4511 |
4511 /** | 4512 /** |
4512 * A Symbol object (ECMA-262 edition 6). | 4513 * A Symbol object (ECMA-262 edition 6). |
4513 */ | 4514 */ |
4514 class V8_EXPORT SymbolObject : public Object { | 4515 class V8_EXPORT SymbolObject : public Object { |
4515 public: | 4516 public: |
4516 static Local<Value> New(Isolate* isolate, Local<Symbol> value); | 4517 static Local<Value> New(Isolate* isolate, Local<Symbol> value); |
4517 | 4518 |
4518 Local<Symbol> ValueOf() const; | 4519 Local<Symbol> ValueOf() const; |
4519 | 4520 |
4520 V8_INLINE static SymbolObject* Cast(v8::Value* obj); | 4521 V8_INLINE static SymbolObject* Cast(Value* obj); |
4521 | 4522 |
4522 private: | 4523 private: |
4523 static void CheckCast(v8::Value* obj); | 4524 static void CheckCast(Value* obj); |
4524 }; | 4525 }; |
4525 | 4526 |
4526 | 4527 |
4527 /** | 4528 /** |
4528 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 4529 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
4529 */ | 4530 */ |
4530 class V8_EXPORT RegExp : public Object { | 4531 class V8_EXPORT RegExp : public Object { |
4531 public: | 4532 public: |
4532 /** | 4533 /** |
4533 * Regular expression flag bits. They can be or'ed to enable a set | 4534 * Regular expression flag bits. They can be or'ed to enable a set |
(...skipping 29 matching lines...) Expand all Loading... |
4563 * Returns the value of the source property: a string representing | 4564 * Returns the value of the source property: a string representing |
4564 * the regular expression. | 4565 * the regular expression. |
4565 */ | 4566 */ |
4566 Local<String> GetSource() const; | 4567 Local<String> GetSource() const; |
4567 | 4568 |
4568 /** | 4569 /** |
4569 * Returns the flags bit field. | 4570 * Returns the flags bit field. |
4570 */ | 4571 */ |
4571 Flags GetFlags() const; | 4572 Flags GetFlags() const; |
4572 | 4573 |
4573 V8_INLINE static RegExp* Cast(v8::Value* obj); | 4574 V8_INLINE static RegExp* Cast(Value* obj); |
4574 | 4575 |
4575 private: | 4576 private: |
4576 static void CheckCast(v8::Value* obj); | 4577 static void CheckCast(Value* obj); |
4577 }; | 4578 }; |
4578 | 4579 |
4579 | 4580 |
4580 /** | 4581 /** |
4581 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 4582 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
4582 * to associate C++ data structures with JavaScript objects. | 4583 * to associate C++ data structures with JavaScript objects. |
4583 */ | 4584 */ |
4584 class V8_EXPORT External : public Value { | 4585 class V8_EXPORT External : public Value { |
4585 public: | 4586 public: |
4586 static Local<External> New(Isolate* isolate, void* value); | 4587 static Local<External> New(Isolate* isolate, void* value); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5606 class V8_EXPORT Extension { // NOLINT | 5607 class V8_EXPORT Extension { // NOLINT |
5607 public: | 5608 public: |
5608 // Note that the strings passed into this constructor must live as long | 5609 // Note that the strings passed into this constructor must live as long |
5609 // as the Extension itself. | 5610 // as the Extension itself. |
5610 Extension(const char* name, | 5611 Extension(const char* name, |
5611 const char* source = 0, | 5612 const char* source = 0, |
5612 int dep_count = 0, | 5613 int dep_count = 0, |
5613 const char** deps = 0, | 5614 const char** deps = 0, |
5614 int source_length = -1); | 5615 int source_length = -1); |
5615 virtual ~Extension() { } | 5616 virtual ~Extension() { } |
5616 virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( | 5617 virtual Local<FunctionTemplate> GetNativeFunctionTemplate( |
5617 v8::Isolate* isolate, v8::Local<v8::String> name) { | 5618 Isolate* isolate, Local<String> name) { |
5618 return v8::Local<v8::FunctionTemplate>(); | 5619 return Local<FunctionTemplate>(); |
5619 } | 5620 } |
5620 | 5621 |
5621 const char* name() const { return name_; } | 5622 const char* name() const { return name_; } |
5622 size_t source_length() const { return source_length_; } | 5623 size_t source_length() const { return source_length_; } |
5623 const String::ExternalOneByteStringResource* source() const { | 5624 const String::ExternalOneByteStringResource* source() const { |
5624 return &source_; } | 5625 return &source_; } |
5625 int dependency_count() { return dep_count_; } | 5626 int dependency_count() { return dep_count_; } |
5626 const char** dependencies() { return deps_; } | 5627 const char** dependencies() { return deps_; } |
5627 void set_auto_enable(bool value) { auto_enable_ = value; } | 5628 void set_auto_enable(bool value) { auto_enable_ = value; } |
5628 bool auto_enable() { return auto_enable_; } | 5629 bool auto_enable() { return auto_enable_; } |
(...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7894 * There are cases when the raw address of C++ TryCatch object cannot be | 7895 * There are cases when the raw address of C++ TryCatch object cannot be |
7895 * used for comparisons with addresses into the JS stack. The cases are: | 7896 * used for comparisons with addresses into the JS stack. The cases are: |
7896 * 1) ARM, ARM64 and MIPS simulators which have separate JS stack. | 7897 * 1) ARM, ARM64 and MIPS simulators which have separate JS stack. |
7897 * 2) Address sanitizer allocates local C++ object in the heap when | 7898 * 2) Address sanitizer allocates local C++ object in the heap when |
7898 * UseAfterReturn mode is enabled. | 7899 * UseAfterReturn mode is enabled. |
7899 * This method returns address that can be used for comparisons with | 7900 * This method returns address that can be used for comparisons with |
7900 * addresses into the JS stack. When neither simulator nor ASAN's | 7901 * addresses into the JS stack. When neither simulator nor ASAN's |
7901 * UseAfterReturn is enabled, then the address returned will be the address | 7902 * UseAfterReturn is enabled, then the address returned will be the address |
7902 * of the C++ try catch handler itself. | 7903 * of the C++ try catch handler itself. |
7903 */ | 7904 */ |
7904 static void* JSStackComparableAddress(v8::TryCatch* handler) { | 7905 static void* JSStackComparableAddress(TryCatch* handler) { |
7905 if (handler == NULL) return NULL; | 7906 if (handler == NULL) return NULL; |
7906 return handler->js_stack_comparable_address_; | 7907 return handler->js_stack_comparable_address_; |
7907 } | 7908 } |
7908 | 7909 |
7909 TryCatch(const TryCatch&) = delete; | 7910 TryCatch(const TryCatch&) = delete; |
7910 void operator=(const TryCatch&) = delete; | 7911 void operator=(const TryCatch&) = delete; |
7911 void* operator new(size_t size); | 7912 void* operator new(size_t size); |
7912 void operator delete(void*, size_t); | 7913 void operator delete(void*, size_t); |
7913 | 7914 |
7914 private: | 7915 private: |
7915 void ResetInternal(); | 7916 void ResetInternal(); |
7916 | 7917 |
7917 v8::internal::Isolate* isolate_; | 7918 internal::Isolate* isolate_; |
7918 v8::TryCatch* next_; | 7919 TryCatch* next_; |
7919 void* exception_; | 7920 void* exception_; |
7920 void* message_obj_; | 7921 void* message_obj_; |
7921 void* js_stack_comparable_address_; | 7922 void* js_stack_comparable_address_; |
7922 bool is_verbose_ : 1; | 7923 bool is_verbose_ : 1; |
7923 bool can_continue_ : 1; | 7924 bool can_continue_ : 1; |
7924 bool capture_message_ : 1; | 7925 bool capture_message_ : 1; |
7925 bool rethrow_ : 1; | 7926 bool rethrow_ : 1; |
7926 bool has_terminated_ : 1; | 7927 bool has_terminated_ : 1; |
7927 | 7928 |
7928 friend class v8::internal::Isolate; | 7929 friend class internal::Isolate; |
7929 }; | 7930 }; |
7930 | 7931 |
7931 | 7932 |
7932 // --- Context --- | 7933 // --- Context --- |
7933 | 7934 |
7934 | 7935 |
7935 /** | 7936 /** |
7936 * A container for extension names. | 7937 * A container for extension names. |
7937 */ | 7938 */ |
7938 class V8_EXPORT ExtensionConfiguration { | 7939 class V8_EXPORT ExtensionConfiguration { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8059 */ | 8060 */ |
8060 void Enter(); | 8061 void Enter(); |
8061 | 8062 |
8062 /** | 8063 /** |
8063 * Exit this context. Exiting the current context restores the | 8064 * Exit this context. Exiting the current context restores the |
8064 * context that was in place when entering the current context. | 8065 * context that was in place when entering the current context. |
8065 */ | 8066 */ |
8066 void Exit(); | 8067 void Exit(); |
8067 | 8068 |
8068 /** Returns an isolate associated with a current context. */ | 8069 /** Returns an isolate associated with a current context. */ |
8069 v8::Isolate* GetIsolate(); | 8070 Isolate* GetIsolate(); |
8070 | 8071 |
8071 /** | 8072 /** |
8072 * The field at kDebugIdIndex is reserved for V8 debugger implementation. | 8073 * The field at kDebugIdIndex is reserved for V8 debugger implementation. |
8073 * The value is propagated to the scripts compiled in given Context and | 8074 * The value is propagated to the scripts compiled in given Context and |
8074 * can be used for filtering scripts. | 8075 * can be used for filtering scripts. |
8075 */ | 8076 */ |
8076 enum EmbedderDataFields { kDebugIdIndex = 0 }; | 8077 enum EmbedderDataFields { kDebugIdIndex = 0 }; |
8077 | 8078 |
8078 /** | 8079 /** |
8079 * Gets the embedder data with the given index, which must have been set by a | 8080 * Gets the embedder data with the given index, which must have been set by a |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9002 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() | 9003 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData() |
9003 const { | 9004 const { |
9004 return cached_data; | 9005 return cached_data; |
9005 } | 9006 } |
9006 | 9007 |
9007 | 9008 |
9008 Local<Boolean> Boolean::New(Isolate* isolate, bool value) { | 9009 Local<Boolean> Boolean::New(Isolate* isolate, bool value) { |
9009 return value ? True(isolate) : False(isolate); | 9010 return value ? True(isolate) : False(isolate); |
9010 } | 9011 } |
9011 | 9012 |
9012 | 9013 void Template::Set(Isolate* isolate, const char* name, Local<Data> value) { |
9013 void Template::Set(Isolate* isolate, const char* name, v8::Local<Data> value) { | 9014 Set(String::NewFromUtf8(isolate, name, NewStringType::kNormal) |
9014 Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal) | |
9015 .ToLocalChecked(), | 9015 .ToLocalChecked(), |
9016 value); | 9016 value); |
9017 } | 9017 } |
9018 | 9018 |
9019 | 9019 |
9020 Local<Value> Object::GetInternalField(int index) { | 9020 Local<Value> Object::GetInternalField(int index) { |
9021 #ifndef V8_ENABLE_CHECKS | 9021 #ifndef V8_ENABLE_CHECKS |
9022 typedef internal::Object O; | 9022 typedef internal::Object O; |
9023 typedef internal::HeapObject HO; | 9023 typedef internal::HeapObject HO; |
9024 typedef internal::Internals I; | 9024 typedef internal::Internals I; |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9613 ReportExternalAllocationLimitReached(); | 9613 ReportExternalAllocationLimitReached(); |
9614 } | 9614 } |
9615 return *external_memory; | 9615 return *external_memory; |
9616 } | 9616 } |
9617 | 9617 |
9618 | 9618 |
9619 template<typename T> | 9619 template<typename T> |
9620 void Isolate::SetObjectGroupId(const Persistent<T>& object, | 9620 void Isolate::SetObjectGroupId(const Persistent<T>& object, |
9621 UniqueId id) { | 9621 UniqueId id) { |
9622 TYPE_CHECK(Value, T); | 9622 TYPE_CHECK(Value, T); |
9623 SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id); | 9623 SetObjectGroupId(reinterpret_cast<internal::Object**>(object.val_), id); |
9624 } | 9624 } |
9625 | 9625 |
9626 | 9626 |
9627 template<typename T> | 9627 template<typename T> |
9628 void Isolate::SetReferenceFromGroup(UniqueId id, | 9628 void Isolate::SetReferenceFromGroup(UniqueId id, |
9629 const Persistent<T>& object) { | 9629 const Persistent<T>& object) { |
9630 TYPE_CHECK(Value, T); | 9630 TYPE_CHECK(Value, T); |
9631 SetReferenceFromGroup(id, | 9631 SetReferenceFromGroup(id, reinterpret_cast<internal::Object**>(object.val_)); |
9632 reinterpret_cast<v8::internal::Object**>(object.val_)); | |
9633 } | 9632 } |
9634 | 9633 |
9635 | 9634 |
9636 template<typename T, typename S> | 9635 template<typename T, typename S> |
9637 void Isolate::SetReference(const Persistent<T>& parent, | 9636 void Isolate::SetReference(const Persistent<T>& parent, |
9638 const Persistent<S>& child) { | 9637 const Persistent<S>& child) { |
9639 TYPE_CHECK(Object, T); | 9638 TYPE_CHECK(Object, T); |
9640 TYPE_CHECK(Value, S); | 9639 TYPE_CHECK(Value, S); |
9641 SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_), | 9640 SetReference(reinterpret_cast<internal::Object**>(parent.val_), |
9642 reinterpret_cast<v8::internal::Object**>(child.val_)); | 9641 reinterpret_cast<internal::Object**>(child.val_)); |
9643 } | 9642 } |
9644 | 9643 |
9645 | 9644 |
9646 Local<Value> Context::GetEmbedderData(int index) { | 9645 Local<Value> Context::GetEmbedderData(int index) { |
9647 #ifndef V8_ENABLE_CHECKS | 9646 #ifndef V8_ENABLE_CHECKS |
9648 typedef internal::Object O; | 9647 typedef internal::Object O; |
9649 typedef internal::HeapObject HO; | 9648 typedef internal::HeapObject HO; |
9650 typedef internal::Internals I; | 9649 typedef internal::Internals I; |
9651 HO* context = *reinterpret_cast<HO**>(this); | 9650 HO* context = *reinterpret_cast<HO**>(this); |
9652 O** result = | 9651 O** result = |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9709 | 9708 |
9710 | 9709 |
9711 void V8::SetFatalErrorHandler(FatalErrorCallback callback) { | 9710 void V8::SetFatalErrorHandler(FatalErrorCallback callback) { |
9712 Isolate* isolate = Isolate::GetCurrent(); | 9711 Isolate* isolate = Isolate::GetCurrent(); |
9713 isolate->SetFatalErrorHandler(callback); | 9712 isolate->SetFatalErrorHandler(callback); |
9714 } | 9713 } |
9715 | 9714 |
9716 void V8::RemoveGCPrologueCallback(GCCallback callback) { | 9715 void V8::RemoveGCPrologueCallback(GCCallback callback) { |
9717 Isolate* isolate = Isolate::GetCurrent(); | 9716 Isolate* isolate = Isolate::GetCurrent(); |
9718 isolate->RemoveGCPrologueCallback( | 9717 isolate->RemoveGCPrologueCallback( |
9719 reinterpret_cast<v8::Isolate::GCCallback>(callback)); | 9718 reinterpret_cast<Isolate::GCCallback>(callback)); |
9720 } | 9719 } |
9721 | 9720 |
9722 | 9721 |
9723 void V8::RemoveGCEpilogueCallback(GCCallback callback) { | 9722 void V8::RemoveGCEpilogueCallback(GCCallback callback) { |
9724 Isolate* isolate = Isolate::GetCurrent(); | 9723 Isolate* isolate = Isolate::GetCurrent(); |
9725 isolate->RemoveGCEpilogueCallback( | 9724 isolate->RemoveGCEpilogueCallback( |
9726 reinterpret_cast<v8::Isolate::GCCallback>(callback)); | 9725 reinterpret_cast<Isolate::GCCallback>(callback)); |
9727 } | 9726 } |
9728 | 9727 |
9729 void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); } | 9728 void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); } |
9730 | 9729 |
9731 | 9730 |
9732 bool V8::IsExecutionTerminating(Isolate* isolate) { | 9731 bool V8::IsExecutionTerminating(Isolate* isolate) { |
9733 if (isolate == NULL) { | 9732 if (isolate == NULL) { |
9734 isolate = Isolate::GetCurrent(); | 9733 isolate = Isolate::GetCurrent(); |
9735 } | 9734 } |
9736 return isolate->IsExecutionTerminating(); | 9735 return isolate->IsExecutionTerminating(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9777 */ | 9776 */ |
9778 | 9777 |
9779 | 9778 |
9780 } // namespace v8 | 9779 } // namespace v8 |
9781 | 9780 |
9782 | 9781 |
9783 #undef TYPE_CHECK | 9782 #undef TYPE_CHECK |
9784 | 9783 |
9785 | 9784 |
9786 #endif // INCLUDE_V8_H_ | 9785 #endif // INCLUDE_V8_H_ |
OLD | NEW |