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. |
11 * | 11 * |
12 * For other documentation see http://code.google.com/apis/v8/ | 12 * For other documentation see http://code.google.com/apis/v8/ |
13 */ | 13 */ |
14 | 14 |
15 #ifndef V8_H_ | 15 #ifndef INCLUDE_V8_H_ |
16 #define V8_H_ | 16 #define INCLUDE_V8_H_ |
17 | 17 |
18 #include <stddef.h> | 18 #include <stddef.h> |
19 #include <stdint.h> | 19 #include <stdint.h> |
20 #include <stdio.h> | 20 #include <stdio.h> |
21 | 21 |
| 22 #include <string> |
| 23 |
22 #include "v8-version.h" // NOLINT(build/include) | 24 #include "v8-version.h" // NOLINT(build/include) |
23 #include "v8config.h" // NOLINT(build/include) | 25 #include "v8config.h" // NOLINT(build/include) |
24 | 26 |
25 // We reserve the V8_* prefix for macros defined in V8 public API and | 27 // We reserve the V8_* prefix for macros defined in V8 public API and |
26 // assume there are no name conflicts with the embedder's code. | 28 // assume there are no name conflicts with the embedder's code. |
27 | 29 |
28 #ifdef V8_OS_WIN | 30 #ifdef V8_OS_WIN |
29 | 31 |
30 // Setup for Windows DLL export/import. When building the V8 DLL the | 32 // Setup for Windows DLL export/import. When building the V8 DLL the |
31 // BUILDING_V8_SHARED needs to be defined. When building a program which uses | 33 // BUILDING_V8_SHARED needs to be defined. When building a program which uses |
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 * A JavaScript symbol (ECMA-262 edition 6) | 2451 * A JavaScript symbol (ECMA-262 edition 6) |
2450 * | 2452 * |
2451 * This is an experimental feature. Use at your own risk. | 2453 * This is an experimental feature. Use at your own risk. |
2452 */ | 2454 */ |
2453 class V8_EXPORT Symbol : public Name { | 2455 class V8_EXPORT Symbol : public Name { |
2454 public: | 2456 public: |
2455 // Returns the print name string of the symbol, or undefined if none. | 2457 // Returns the print name string of the symbol, or undefined if none. |
2456 Local<Value> Name() const; | 2458 Local<Value> Name() const; |
2457 | 2459 |
2458 // Create a symbol. If name is not empty, it will be used as the description. | 2460 // Create a symbol. If name is not empty, it will be used as the description. |
2459 static Local<Symbol> New( | 2461 static Local<Symbol> New(Isolate* isolate, |
2460 Isolate *isolate, Local<String> name = Local<String>()); | 2462 Local<String> name = Local<String>()); |
2461 | 2463 |
2462 // Access global symbol registry. | 2464 // Access global symbol registry. |
2463 // Note that symbols created this way are never collected, so | 2465 // Note that symbols created this way are never collected, so |
2464 // they should only be used for statically fixed properties. | 2466 // they should only be used for statically fixed properties. |
2465 // Also, there is only one global name space for the names used as keys. | 2467 // Also, there is only one global name space for the names used as keys. |
2466 // To minimize the potential for clashes, use qualified names as keys. | 2468 // To minimize the potential for clashes, use qualified names as keys. |
2467 static Local<Symbol> For(Isolate *isolate, Local<String> name); | 2469 static Local<Symbol> For(Isolate *isolate, Local<String> name); |
2468 | 2470 |
2469 // Retrieve a global symbol. Similar to |For|, but using a separate | 2471 // Retrieve a global symbol. Similar to |For|, but using a separate |
2470 // registry that is not accessible by (and cannot clash with) JavaScript code. | 2472 // registry that is not accessible by (and cannot clash with) JavaScript code. |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 Resolver(); | 3342 Resolver(); |
3341 static void CheckCast(Value* obj); | 3343 static void CheckCast(Value* obj); |
3342 }; | 3344 }; |
3343 | 3345 |
3344 /** | 3346 /** |
3345 * Register a resolution/rejection handler with a promise. | 3347 * Register a resolution/rejection handler with a promise. |
3346 * The handler is given the respective resolution/rejection value as | 3348 * The handler is given the respective resolution/rejection value as |
3347 * an argument. If the promise is already resolved/rejected, the handler is | 3349 * an argument. If the promise is already resolved/rejected, the handler is |
3348 * invoked at the end of turn. | 3350 * invoked at the end of turn. |
3349 */ | 3351 */ |
3350 V8_DEPRECATE_SOON("Use maybe version", | 3352 V8_DEPRECATE_SOON("Use maybe version of Then", |
3351 Local<Promise> Chain(Local<Function> handler)); | 3353 Local<Promise> Chain(Local<Function> handler)); |
3352 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(Local<Context> context, | 3354 V8_DEPRECATE_SOON("Use Then", |
3353 Local<Function> handler); | 3355 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain( |
| 3356 Local<Context> context, Local<Function> handler)); |
3354 | 3357 |
3355 V8_DEPRECATE_SOON("Use maybe version", | 3358 V8_DEPRECATE_SOON("Use maybe version", |
3356 Local<Promise> Catch(Local<Function> handler)); | 3359 Local<Promise> Catch(Local<Function> handler)); |
3357 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context, | 3360 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context, |
3358 Local<Function> handler); | 3361 Local<Function> handler); |
3359 | 3362 |
3360 V8_DEPRECATE_SOON("Use maybe version", | 3363 V8_DEPRECATE_SOON("Use maybe version", |
3361 Local<Promise> Then(Local<Function> handler)); | 3364 Local<Promise> Then(Local<Function> handler)); |
3362 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context, | 3365 V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context, |
3363 Local<Function> handler); | 3366 Local<Function> handler); |
(...skipping 3800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7164 | 7167 |
7165 V8_INLINE static void UpdateNodeState(internal::Object** obj, | 7168 V8_INLINE static void UpdateNodeState(internal::Object** obj, |
7166 uint8_t value) { | 7169 uint8_t value) { |
7167 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | 7170 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; |
7168 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); | 7171 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); |
7169 } | 7172 } |
7170 | 7173 |
7171 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, | 7174 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, |
7172 uint32_t slot, | 7175 uint32_t slot, |
7173 void* data) { | 7176 void* data) { |
7174 uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) + | 7177 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
7175 kIsolateEmbedderDataOffset + slot * kApiPointerSize; | 7178 kIsolateEmbedderDataOffset + slot * kApiPointerSize; |
7176 *reinterpret_cast<void**>(addr) = data; | 7179 *reinterpret_cast<void**>(addr) = data; |
7177 } | 7180 } |
7178 | 7181 |
7179 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, | 7182 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, |
7180 uint32_t slot) { | 7183 uint32_t slot) { |
7181 const uint8_t* addr = reinterpret_cast<const uint8_t*>(isolate) + | 7184 const uint8_t* addr = reinterpret_cast<const uint8_t*>(isolate) + |
7182 kIsolateEmbedderDataOffset + slot * kApiPointerSize; | 7185 kIsolateEmbedderDataOffset + slot * kApiPointerSize; |
7183 return *reinterpret_cast<void* const*>(addr); | 7186 return *reinterpret_cast<void* const*>(addr); |
7184 } | 7187 } |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8467 * \example process.cc | 8470 * \example process.cc |
8468 */ | 8471 */ |
8469 | 8472 |
8470 | 8473 |
8471 } // namespace v8 | 8474 } // namespace v8 |
8472 | 8475 |
8473 | 8476 |
8474 #undef TYPE_CHECK | 8477 #undef TYPE_CHECK |
8475 | 8478 |
8476 | 8479 |
8477 #endif // V8_H_ | 8480 #endif // INCLUDE_V8_H_ |
OLD | NEW |