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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1078 | 1078 |
1079 // TODO(dcarney): deprecate. | 1079 // TODO(dcarney): deprecate. |
1080 static Local<Script> Compile(Handle<String> source, | 1080 static Local<Script> Compile(Handle<String> source, |
1081 Handle<String> file_name); | 1081 Handle<String> file_name); |
1082 | 1082 |
1083 /** | 1083 /** |
1084 * Runs the script returning the resulting value. It will be run in the | 1084 * Runs the script returning the resulting value. It will be run in the |
1085 * context in which it was created (ScriptCompiler::CompileBound or | 1085 * context in which it was created (ScriptCompiler::CompileBound or |
1086 * UnboundScript::BindToCurrentContext()). | 1086 * UnboundScript::BindToCurrentContext()). |
1087 */ | 1087 */ |
1088 // TODO(dcarney): deprecate | |
1088 Local<Value> Run(); | 1089 Local<Value> Run(); |
1090 MaybeLocal<Value> Run(Local<Context> context); | |
adamk
2015/04/06 22:21:02
What is the |context| argument here? Why isn't the
| |
1089 | 1091 |
1090 /** | 1092 /** |
1091 * Returns the corresponding context-unbound script. | 1093 * Returns the corresponding context-unbound script. |
1092 */ | 1094 */ |
1093 Local<UnboundScript> GetUnboundScript(); | 1095 Local<UnboundScript> GetUnboundScript(); |
1094 | 1096 |
1095 V8_DEPRECATED("Use GetUnboundScript()->GetId()", | 1097 V8_DEPRECATED("Use GetUnboundScript()->GetId()", |
1096 int GetId()) { | 1098 int GetId()) { |
1097 return GetUnboundScript()->GetId(); | 1099 return GetUnboundScript()->GetId(); |
1098 } | 1100 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1391 Isolate* isolate, Source* source, CompileOptions options, bool is_module); | 1393 Isolate* isolate, Source* source, CompileOptions options, bool is_module); |
1392 }; | 1394 }; |
1393 | 1395 |
1394 | 1396 |
1395 /** | 1397 /** |
1396 * An error message. | 1398 * An error message. |
1397 */ | 1399 */ |
1398 class V8_EXPORT Message { | 1400 class V8_EXPORT Message { |
1399 public: | 1401 public: |
1400 Local<String> Get() const; | 1402 Local<String> Get() const; |
1403 | |
1404 // TODO(dcarney): deprecate | |
1401 Local<String> GetSourceLine() const; | 1405 Local<String> GetSourceLine() const; |
1406 MaybeLocal<String> GetSourceLine(Local<Context> context) const; | |
1402 | 1407 |
1403 /** | 1408 /** |
1404 * Returns the origin for the script from where the function causing the | 1409 * Returns the origin for the script from where the function causing the |
1405 * error originates. | 1410 * error originates. |
1406 */ | 1411 */ |
1407 ScriptOrigin GetScriptOrigin() const; | 1412 ScriptOrigin GetScriptOrigin() const; |
1408 | 1413 |
1409 /** | 1414 /** |
1410 * Returns the resource name for the script from where the function causing | 1415 * Returns the resource name for the script from where the function causing |
1411 * the error originates. | 1416 * the error originates. |
1412 */ | 1417 */ |
1413 Handle<Value> GetScriptResourceName() const; | 1418 Handle<Value> GetScriptResourceName() const; |
1414 | 1419 |
1415 /** | 1420 /** |
1416 * Exception stack trace. By default stack traces are not captured for | 1421 * Exception stack trace. By default stack traces are not captured for |
1417 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows | 1422 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows |
1418 * to change this option. | 1423 * to change this option. |
1419 */ | 1424 */ |
1420 Handle<StackTrace> GetStackTrace() const; | 1425 Handle<StackTrace> GetStackTrace() const; |
1421 | 1426 |
1422 /** | 1427 /** |
1423 * Returns the number, 1-based, of the line where the error occurred. | 1428 * Returns the number, 1-based, of the line where the error occurred. |
1424 */ | 1429 */ |
1430 // TODO(dcarney): deprecate | |
1425 int GetLineNumber() const; | 1431 int GetLineNumber() const; |
1432 Maybe<int> GetLineNumber(Local<Context> context) const; | |
1426 | 1433 |
1427 /** | 1434 /** |
1428 * Returns the index within the script of the first character where | 1435 * Returns the index within the script of the first character where |
1429 * the error occurred. | 1436 * the error occurred. |
1430 */ | 1437 */ |
1431 int GetStartPosition() const; | 1438 int GetStartPosition() const; |
1432 | 1439 |
1433 /** | 1440 /** |
1434 * Returns the index within the script of the last character where | 1441 * Returns the index within the script of the last character where |
1435 * the error occurred. | 1442 * the error occurred. |
1436 */ | 1443 */ |
1437 int GetEndPosition() const; | 1444 int GetEndPosition() const; |
1438 | 1445 |
1439 /** | 1446 /** |
1440 * Returns the index within the line of the first character where | 1447 * Returns the index within the line of the first character where |
1441 * the error occurred. | 1448 * the error occurred. |
1442 */ | 1449 */ |
1450 // TODO(dcarney): deprecate | |
1443 int GetStartColumn() const; | 1451 int GetStartColumn() const; |
1452 Maybe<int> GetStartColumn(Local<Context> context) const; | |
1444 | 1453 |
1445 /** | 1454 /** |
1446 * Returns the index within the line of the last character where | 1455 * Returns the index within the line of the last character where |
1447 * the error occurred. | 1456 * the error occurred. |
1448 */ | 1457 */ |
1458 // TODO(dcarney): deprecate | |
1449 int GetEndColumn() const; | 1459 int GetEndColumn() const; |
1460 Maybe<int> GetEndColumn(Local<Context> context) const; | |
1450 | 1461 |
1451 /** | 1462 /** |
1452 * Passes on the value set by the embedder when it fed the script from which | 1463 * Passes on the value set by the embedder when it fed the script from which |
1453 * this Message was generated to V8. | 1464 * this Message was generated to V8. |
1454 */ | 1465 */ |
1455 bool IsSharedCrossOrigin() const; | 1466 bool IsSharedCrossOrigin() const; |
1456 | 1467 |
1457 // TODO(1245381): Print to a string instead of on a FILE. | 1468 // TODO(1245381): Print to a string instead of on a FILE. |
1458 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); | 1469 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); |
1459 | 1470 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1606 */ | 1617 */ |
1607 class V8_EXPORT JSON { | 1618 class V8_EXPORT JSON { |
1608 public: | 1619 public: |
1609 /** | 1620 /** |
1610 * Tries to parse the string |json_string| and returns it as value if | 1621 * Tries to parse the string |json_string| and returns it as value if |
1611 * successful. | 1622 * successful. |
1612 * | 1623 * |
1613 * \param json_string The string to parse. | 1624 * \param json_string The string to parse. |
1614 * \return The corresponding value if successfully parsed. | 1625 * \return The corresponding value if successfully parsed. |
1615 */ | 1626 */ |
1627 // TODO(dcarney): deprecate | |
1616 static Local<Value> Parse(Local<String> json_string); | 1628 static Local<Value> Parse(Local<String> json_string); |
1629 static MaybeLocal<Value> Parse(Isolate* isolate, Local<String> json_string); | |
1617 }; | 1630 }; |
1618 | 1631 |
1619 | 1632 |
1620 /** | 1633 /** |
1621 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap | 1634 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap |
1622 * but can be created without entering a v8::Context and hence shouldn't | 1635 * but can be created without entering a v8::Context and hence shouldn't |
1623 * escape to JavaScript. | 1636 * escape to JavaScript. |
1624 */ | 1637 */ |
1625 class V8_EXPORT NativeWeakMap : public Data { | 1638 class V8_EXPORT NativeWeakMap : public Data { |
1626 public: | 1639 public: |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1919 inline Local<String> ToDetailString() const; | 1932 inline Local<String> ToDetailString() const; |
1920 inline Local<Object> ToObject() const; | 1933 inline Local<Object> ToObject() const; |
1921 inline Local<Integer> ToInteger() const; | 1934 inline Local<Integer> ToInteger() const; |
1922 inline Local<Uint32> ToUint32() const; | 1935 inline Local<Uint32> ToUint32() const; |
1923 inline Local<Int32> ToInt32() const; | 1936 inline Local<Int32> ToInt32() const; |
1924 | 1937 |
1925 /** | 1938 /** |
1926 * Attempts to convert a string to an array index. | 1939 * Attempts to convert a string to an array index. |
1927 * Returns an empty handle if the conversion fails. | 1940 * Returns an empty handle if the conversion fails. |
1928 */ | 1941 */ |
1942 // TODO(dcarney): deprecate. | |
1929 Local<Uint32> ToArrayIndex() const; | 1943 Local<Uint32> ToArrayIndex() const; |
1944 MaybeLocal<Uint32> ToArrayIndex(Local<Context> context) const; | |
1930 | 1945 |
1931 Maybe<bool> BooleanValue(Local<Context> context) const; | 1946 Maybe<bool> BooleanValue(Local<Context> context) const; |
1932 Maybe<double> NumberValue(Local<Context> context) const; | 1947 Maybe<double> NumberValue(Local<Context> context) const; |
1933 Maybe<int64_t> IntegerValue(Local<Context> context) const; | 1948 Maybe<int64_t> IntegerValue(Local<Context> context) const; |
1934 Maybe<uint32_t> Uint32Value(Local<Context> context) const; | 1949 Maybe<uint32_t> Uint32Value(Local<Context> context) const; |
1935 Maybe<int32_t> Int32Value(Local<Context> context) const; | 1950 Maybe<int32_t> Int32Value(Local<Context> context) const; |
1936 | 1951 |
1937 // TODO(dcarney): deprecate all these. | 1952 // TODO(dcarney): deprecate all these. |
1938 bool BooleanValue() const; | 1953 bool BooleanValue() const; |
1939 double NumberValue() const; | 1954 double NumberValue() const; |
1940 int64_t IntegerValue() const; | 1955 int64_t IntegerValue() const; |
1941 uint32_t Uint32Value() const; | 1956 uint32_t Uint32Value() const; |
1942 int32_t Int32Value() const; | 1957 int32_t Int32Value() const; |
1943 | 1958 |
1944 /** JS == */ | 1959 /** JS == */ |
1960 // TODO(dcarney): deprecate. | |
1945 bool Equals(Handle<Value> that) const; | 1961 bool Equals(Handle<Value> that) const; |
1962 Maybe<bool> Equals(Local<Context> context, Handle<Value> that) const; | |
1946 bool StrictEquals(Handle<Value> that) const; | 1963 bool StrictEquals(Handle<Value> that) const; |
1947 bool SameValue(Handle<Value> that) const; | 1964 bool SameValue(Handle<Value> that) const; |
1948 | 1965 |
1949 template <class T> V8_INLINE static Value* Cast(T* value); | 1966 template <class T> V8_INLINE static Value* Cast(T* value); |
1950 | 1967 |
1951 private: | 1968 private: |
1952 V8_INLINE bool QuickIsUndefined() const; | 1969 V8_INLINE bool QuickIsUndefined() const; |
1953 V8_INLINE bool QuickIsNull() const; | 1970 V8_INLINE bool QuickIsNull() const; |
1954 V8_INLINE bool QuickIsString() const; | 1971 V8_INLINE bool QuickIsString() const; |
1955 bool FullIsUndefined() const; | 1972 bool FullIsUndefined() const; |
(...skipping 5797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7753 */ | 7770 */ |
7754 | 7771 |
7755 | 7772 |
7756 } // namespace v8 | 7773 } // namespace v8 |
7757 | 7774 |
7758 | 7775 |
7759 #undef TYPE_CHECK | 7776 #undef TYPE_CHECK |
7760 | 7777 |
7761 | 7778 |
7762 #endif // V8_H_ | 7779 #endif // V8_H_ |
OLD | NEW |