| 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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 | 1067 |
| 1068 /** | 1068 /** |
| 1069 * A compiled JavaScript script, tied to a Context which was active when the | 1069 * A compiled JavaScript script, tied to a Context which was active when the |
| 1070 * script was compiled. | 1070 * script was compiled. |
| 1071 */ | 1071 */ |
| 1072 class V8_EXPORT Script { | 1072 class V8_EXPORT Script { |
| 1073 public: | 1073 public: |
| 1074 /** | 1074 /** |
| 1075 * A shorthand for ScriptCompiler::Compile(). | 1075 * A shorthand for ScriptCompiler::Compile(). |
| 1076 */ | 1076 */ |
| 1077 // TODO(dcarney): deprecate. | 1077 static V8_DEPRECATE_SOON( |
| 1078 static Local<Script> Compile(Handle<String> source, | 1078 "Use maybe version", |
| 1079 ScriptOrigin* origin = nullptr); | 1079 Local<Script> Compile(Handle<String> source, |
| 1080 ScriptOrigin* origin = nullptr)); |
| 1080 static MaybeLocal<Script> Compile(Local<Context> context, | 1081 static MaybeLocal<Script> Compile(Local<Context> context, |
| 1081 Handle<String> source, | 1082 Handle<String> source, |
| 1082 ScriptOrigin* origin = nullptr); | 1083 ScriptOrigin* origin = nullptr); |
| 1083 | 1084 |
| 1084 // TODO(dcarney): deprecate. | 1085 static Local<Script> V8_DEPRECATE_SOON("Use maybe version", |
| 1085 static Local<Script> Compile(Handle<String> source, | 1086 Compile(Handle<String> source, |
| 1086 Handle<String> file_name); | 1087 Handle<String> file_name)); |
| 1087 | 1088 |
| 1088 /** | 1089 /** |
| 1089 * Runs the script returning the resulting value. It will be run in the | 1090 * Runs the script returning the resulting value. It will be run in the |
| 1090 * context in which it was created (ScriptCompiler::CompileBound or | 1091 * context in which it was created (ScriptCompiler::CompileBound or |
| 1091 * UnboundScript::BindToCurrentContext()). | 1092 * UnboundScript::BindToCurrentContext()). |
| 1092 */ | 1093 */ |
| 1093 // TODO(dcarney): deprecate | 1094 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Run()); |
| 1094 Local<Value> Run(); | |
| 1095 MaybeLocal<Value> Run(Local<Context> context); | 1095 MaybeLocal<Value> Run(Local<Context> context); |
| 1096 | 1096 |
| 1097 /** | 1097 /** |
| 1098 * Returns the corresponding context-unbound script. | 1098 * Returns the corresponding context-unbound script. |
| 1099 */ | 1099 */ |
| 1100 Local<UnboundScript> GetUnboundScript(); | 1100 Local<UnboundScript> GetUnboundScript(); |
| 1101 | 1101 |
| 1102 V8_DEPRECATED("Use GetUnboundScript()->GetId()", | 1102 V8_DEPRECATED("Use GetUnboundScript()->GetId()", |
| 1103 int GetId()) { | 1103 int GetId()) { |
| 1104 return GetUnboundScript()->GetId(); | 1104 return GetUnboundScript()->GetId(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 * consumed later to speed up compilation of identical source scripts. | 1273 * consumed later to speed up compilation of identical source scripts. |
| 1274 * | 1274 * |
| 1275 * Note that when producing cached data, the source must point to NULL for | 1275 * Note that when producing cached data, the source must point to NULL for |
| 1276 * cached data. When consuming cached data, the cached data must have been | 1276 * cached data. When consuming cached data, the cached data must have been |
| 1277 * produced by the same version of V8. | 1277 * produced by the same version of V8. |
| 1278 * | 1278 * |
| 1279 * \param source Script source code. | 1279 * \param source Script source code. |
| 1280 * \return Compiled script object (context independent; for running it must be | 1280 * \return Compiled script object (context independent; for running it must be |
| 1281 * bound to a context). | 1281 * bound to a context). |
| 1282 */ | 1282 */ |
| 1283 // TODO(dcarney): deprecate | 1283 static V8_DEPRECATE_SOON("Use maybe version", |
| 1284 static Local<UnboundScript> CompileUnbound( | 1284 Local<UnboundScript> CompileUnbound( |
| 1285 Isolate* isolate, Source* source, | 1285 Isolate* isolate, Source* source, |
| 1286 CompileOptions options = kNoCompileOptions); | 1286 CompileOptions options = kNoCompileOptions)); |
| 1287 static MaybeLocal<UnboundScript> CompileUnboundScript( | 1287 static MaybeLocal<UnboundScript> CompileUnboundScript( |
| 1288 Isolate* isolate, Source* source, | 1288 Isolate* isolate, Source* source, |
| 1289 CompileOptions options = kNoCompileOptions); | 1289 CompileOptions options = kNoCompileOptions); |
| 1290 | 1290 |
| 1291 /** | 1291 /** |
| 1292 * Compiles the specified script (bound to current context). | 1292 * Compiles the specified script (bound to current context). |
| 1293 * | 1293 * |
| 1294 * \param source Script source code. | 1294 * \param source Script source code. |
| 1295 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | 1295 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() |
| 1296 * using pre_data speeds compilation if it's done multiple times. | 1296 * using pre_data speeds compilation if it's done multiple times. |
| 1297 * Owned by caller, no references are kept when this function returns. | 1297 * Owned by caller, no references are kept when this function returns. |
| 1298 * \return Compiled script object, bound to the context that was active | 1298 * \return Compiled script object, bound to the context that was active |
| 1299 * when this function was called. When run it will always use this | 1299 * when this function was called. When run it will always use this |
| 1300 * context. | 1300 * context. |
| 1301 */ | 1301 */ |
| 1302 // TODO(dcarney): deprecate | 1302 static V8_DEPRECATE_SOON( |
| 1303 static Local<Script> Compile( | 1303 "Use maybe version", |
| 1304 Isolate* isolate, Source* source, | 1304 Local<Script> Compile(Isolate* isolate, Source* source, |
| 1305 CompileOptions options = kNoCompileOptions); | 1305 CompileOptions options = kNoCompileOptions)); |
| 1306 static MaybeLocal<Script> Compile(Local<Context> context, Source* source, | 1306 static MaybeLocal<Script> Compile(Local<Context> context, Source* source, |
| 1307 CompileOptions options = kNoCompileOptions); | 1307 CompileOptions options = kNoCompileOptions); |
| 1308 | 1308 |
| 1309 /** | 1309 /** |
| 1310 * Returns a task which streams script data into V8, or NULL if the script | 1310 * Returns a task which streams script data into V8, or NULL if the script |
| 1311 * cannot be streamed. The user is responsible for running the task on a | 1311 * cannot be streamed. The user is responsible for running the task on a |
| 1312 * background thread and deleting it. When ran, the task starts parsing the | 1312 * background thread and deleting it. When ran, the task starts parsing the |
| 1313 * script, and it will request data from the StreamedSource as needed. When | 1313 * script, and it will request data from the StreamedSource as needed. When |
| 1314 * ScriptStreamingTask::Run exits, all data has been streamed and the script | 1314 * ScriptStreamingTask::Run exits, all data has been streamed and the script |
| 1315 * can be compiled (see Compile below). | 1315 * can be compiled (see Compile below). |
| 1316 * | 1316 * |
| 1317 * This API allows to start the streaming with as little data as possible, and | 1317 * This API allows to start the streaming with as little data as possible, and |
| 1318 * the remaining data (for example, the ScriptOrigin) is passed to Compile. | 1318 * the remaining data (for example, the ScriptOrigin) is passed to Compile. |
| 1319 */ | 1319 */ |
| 1320 static ScriptStreamingTask* StartStreamingScript( | 1320 static ScriptStreamingTask* StartStreamingScript( |
| 1321 Isolate* isolate, StreamedSource* source, | 1321 Isolate* isolate, StreamedSource* source, |
| 1322 CompileOptions options = kNoCompileOptions); | 1322 CompileOptions options = kNoCompileOptions); |
| 1323 | 1323 |
| 1324 /** | 1324 /** |
| 1325 * Compiles a streamed script (bound to current context). | 1325 * Compiles a streamed script (bound to current context). |
| 1326 * | 1326 * |
| 1327 * This can only be called after the streaming has finished | 1327 * This can only be called after the streaming has finished |
| 1328 * (ScriptStreamingTask has been run). V8 doesn't construct the source string | 1328 * (ScriptStreamingTask has been run). V8 doesn't construct the source string |
| 1329 * during streaming, so the embedder needs to pass the full source here. | 1329 * during streaming, so the embedder needs to pass the full source here. |
| 1330 */ | 1330 */ |
| 1331 // TODO(dcarney): deprecate | 1331 static V8_DEPRECATE_SOON( |
| 1332 static Local<Script> Compile(Isolate* isolate, StreamedSource* source, | 1332 "Use maybe version", |
| 1333 Handle<String> full_source_string, | 1333 Local<Script> Compile(Isolate* isolate, StreamedSource* source, |
| 1334 const ScriptOrigin& origin); | 1334 Handle<String> full_source_string, |
| 1335 const ScriptOrigin& origin)); |
| 1335 static MaybeLocal<Script> Compile(Local<Context> context, | 1336 static MaybeLocal<Script> Compile(Local<Context> context, |
| 1336 StreamedSource* source, | 1337 StreamedSource* source, |
| 1337 Handle<String> full_source_string, | 1338 Handle<String> full_source_string, |
| 1338 const ScriptOrigin& origin); | 1339 const ScriptOrigin& origin); |
| 1339 | 1340 |
| 1340 /** | 1341 /** |
| 1341 * Return a version tag for CachedData for the current V8 version & flags. | 1342 * Return a version tag for CachedData for the current V8 version & flags. |
| 1342 * | 1343 * |
| 1343 * This value is meant only for determining whether a previously generated | 1344 * This value is meant only for determining whether a previously generated |
| 1344 * CachedData instance is still valid; the tag has no other meaing. | 1345 * CachedData instance is still valid; the tag has no other meaing. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1358 static uint32_t CachedDataVersionTag(); | 1359 static uint32_t CachedDataVersionTag(); |
| 1359 | 1360 |
| 1360 /** | 1361 /** |
| 1361 * Compile an ES6 module. | 1362 * Compile an ES6 module. |
| 1362 * | 1363 * |
| 1363 * This is an experimental feature. | 1364 * This is an experimental feature. |
| 1364 * | 1365 * |
| 1365 * TODO(adamk): Script is likely the wrong return value for this; | 1366 * TODO(adamk): Script is likely the wrong return value for this; |
| 1366 * should return some new Module type. | 1367 * should return some new Module type. |
| 1367 */ | 1368 */ |
| 1368 // TODO(dcarney): deprecate. | 1369 static V8_DEPRECATE_SOON( |
| 1369 static Local<Script> CompileModule( | 1370 "Use maybe version", |
| 1370 Isolate* isolate, Source* source, | 1371 Local<Script> CompileModule(Isolate* isolate, Source* source, |
| 1371 CompileOptions options = kNoCompileOptions); | 1372 CompileOptions options = kNoCompileOptions)); |
| 1372 static MaybeLocal<Script> CompileModule( | 1373 static MaybeLocal<Script> CompileModule( |
| 1373 Local<Context> context, Source* source, | 1374 Local<Context> context, Source* source, |
| 1374 CompileOptions options = kNoCompileOptions); | 1375 CompileOptions options = kNoCompileOptions); |
| 1375 | 1376 |
| 1376 /** | 1377 /** |
| 1377 * Compile a function for a given context. This is equivalent to running | 1378 * Compile a function for a given context. This is equivalent to running |
| 1378 * | 1379 * |
| 1379 * with (obj) { | 1380 * with (obj) { |
| 1380 * return function(args) { ... } | 1381 * return function(args) { ... } |
| 1381 * } | 1382 * } |
| 1382 * | 1383 * |
| 1383 * It is possible to specify multiple context extensions (obj in the above | 1384 * It is possible to specify multiple context extensions (obj in the above |
| 1384 * example). | 1385 * example). |
| 1385 */ | 1386 */ |
| 1386 // TODO(dcarney): deprecate. | 1387 static V8_DEPRECATE_SOON("Use maybe version", |
| 1387 static Local<Function> CompileFunctionInContext( | 1388 Local<Function> CompileFunctionInContext( |
| 1388 Isolate* isolate, Source* source, Local<Context> context, | 1389 Isolate* isolate, Source* source, |
| 1389 size_t arguments_count, Local<String> arguments[], | 1390 Local<Context> context, size_t arguments_count, |
| 1390 size_t context_extension_count, Local<Object> context_extensions[]); | 1391 Local<String> arguments[], |
| 1392 size_t context_extension_count, |
| 1393 Local<Object> context_extensions[])); |
| 1391 static MaybeLocal<Function> CompileFunctionInContext( | 1394 static MaybeLocal<Function> CompileFunctionInContext( |
| 1392 Local<Context> context, Source* source, size_t arguments_count, | 1395 Local<Context> context, Source* source, size_t arguments_count, |
| 1393 Local<String> arguments[], size_t context_extension_count, | 1396 Local<String> arguments[], size_t context_extension_count, |
| 1394 Local<Object> context_extensions[]); | 1397 Local<Object> context_extensions[]); |
| 1395 | 1398 |
| 1396 private: | 1399 private: |
| 1397 static MaybeLocal<UnboundScript> CompileUnboundInternal( | 1400 static MaybeLocal<UnboundScript> CompileUnboundInternal( |
| 1398 Isolate* isolate, Source* source, CompileOptions options, bool is_module); | 1401 Isolate* isolate, Source* source, CompileOptions options, bool is_module); |
| 1399 }; | 1402 }; |
| 1400 | 1403 |
| 1401 | 1404 |
| 1402 /** | 1405 /** |
| 1403 * An error message. | 1406 * An error message. |
| 1404 */ | 1407 */ |
| 1405 class V8_EXPORT Message { | 1408 class V8_EXPORT Message { |
| 1406 public: | 1409 public: |
| 1407 Local<String> Get() const; | 1410 Local<String> Get() const; |
| 1408 | 1411 |
| 1409 // TODO(dcarney): deprecate | 1412 V8_DEPRECATE_SOON("Use maybe version", Local<String> GetSourceLine()) const; |
| 1410 Local<String> GetSourceLine() const; | |
| 1411 MaybeLocal<String> GetSourceLine(Local<Context> context) const; | 1413 MaybeLocal<String> GetSourceLine(Local<Context> context) const; |
| 1412 | 1414 |
| 1413 /** | 1415 /** |
| 1414 * Returns the origin for the script from where the function causing the | 1416 * Returns the origin for the script from where the function causing the |
| 1415 * error originates. | 1417 * error originates. |
| 1416 */ | 1418 */ |
| 1417 ScriptOrigin GetScriptOrigin() const; | 1419 ScriptOrigin GetScriptOrigin() const; |
| 1418 | 1420 |
| 1419 /** | 1421 /** |
| 1420 * Returns the resource name for the script from where the function causing | 1422 * Returns the resource name for the script from where the function causing |
| 1421 * the error originates. | 1423 * the error originates. |
| 1422 */ | 1424 */ |
| 1423 Handle<Value> GetScriptResourceName() const; | 1425 Handle<Value> GetScriptResourceName() const; |
| 1424 | 1426 |
| 1425 /** | 1427 /** |
| 1426 * Exception stack trace. By default stack traces are not captured for | 1428 * Exception stack trace. By default stack traces are not captured for |
| 1427 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows | 1429 * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows |
| 1428 * to change this option. | 1430 * to change this option. |
| 1429 */ | 1431 */ |
| 1430 Handle<StackTrace> GetStackTrace() const; | 1432 Handle<StackTrace> GetStackTrace() const; |
| 1431 | 1433 |
| 1432 /** | 1434 /** |
| 1433 * Returns the number, 1-based, of the line where the error occurred. | 1435 * Returns the number, 1-based, of the line where the error occurred. |
| 1434 */ | 1436 */ |
| 1435 // TODO(dcarney): deprecate | 1437 V8_DEPRECATE_SOON("Use maybe version", int GetLineNumber()) const; |
| 1436 int GetLineNumber() const; | |
| 1437 Maybe<int> GetLineNumber(Local<Context> context) const; | 1438 Maybe<int> GetLineNumber(Local<Context> context) const; |
| 1438 | 1439 |
| 1439 /** | 1440 /** |
| 1440 * Returns the index within the script of the first character where | 1441 * Returns the index within the script of the first character where |
| 1441 * the error occurred. | 1442 * the error occurred. |
| 1442 */ | 1443 */ |
| 1443 int GetStartPosition() const; | 1444 int GetStartPosition() const; |
| 1444 | 1445 |
| 1445 /** | 1446 /** |
| 1446 * Returns the index within the script of the last character where | 1447 * Returns the index within the script of the last character where |
| 1447 * the error occurred. | 1448 * the error occurred. |
| 1448 */ | 1449 */ |
| 1449 int GetEndPosition() const; | 1450 int GetEndPosition() const; |
| 1450 | 1451 |
| 1451 /** | 1452 /** |
| 1452 * Returns the index within the line of the first character where | 1453 * Returns the index within the line of the first character where |
| 1453 * the error occurred. | 1454 * the error occurred. |
| 1454 */ | 1455 */ |
| 1455 // TODO(dcarney): deprecate | 1456 V8_DEPRECATE_SOON("Use maybe version", int GetStartColumn()) const; |
| 1456 int GetStartColumn() const; | |
| 1457 Maybe<int> GetStartColumn(Local<Context> context) const; | 1457 Maybe<int> GetStartColumn(Local<Context> context) const; |
| 1458 | 1458 |
| 1459 /** | 1459 /** |
| 1460 * Returns the index within the line of the last character where | 1460 * Returns the index within the line of the last character where |
| 1461 * the error occurred. | 1461 * the error occurred. |
| 1462 */ | 1462 */ |
| 1463 // TODO(dcarney): deprecate | 1463 V8_DEPRECATE_SOON("Use maybe version", int GetEndColumn()) const; |
| 1464 int GetEndColumn() const; | |
| 1465 Maybe<int> GetEndColumn(Local<Context> context) const; | 1464 Maybe<int> GetEndColumn(Local<Context> context) const; |
| 1466 | 1465 |
| 1467 /** | 1466 /** |
| 1468 * Passes on the value set by the embedder when it fed the script from which | 1467 * Passes on the value set by the embedder when it fed the script from which |
| 1469 * this Message was generated to V8. | 1468 * this Message was generated to V8. |
| 1470 */ | 1469 */ |
| 1471 bool IsSharedCrossOrigin() const; | 1470 bool IsSharedCrossOrigin() const; |
| 1472 | 1471 |
| 1473 // TODO(1245381): Print to a string instead of on a FILE. | 1472 // TODO(1245381): Print to a string instead of on a FILE. |
| 1474 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); | 1473 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 */ | 1621 */ |
| 1623 class V8_EXPORT JSON { | 1622 class V8_EXPORT JSON { |
| 1624 public: | 1623 public: |
| 1625 /** | 1624 /** |
| 1626 * Tries to parse the string |json_string| and returns it as value if | 1625 * Tries to parse the string |json_string| and returns it as value if |
| 1627 * successful. | 1626 * successful. |
| 1628 * | 1627 * |
| 1629 * \param json_string The string to parse. | 1628 * \param json_string The string to parse. |
| 1630 * \return The corresponding value if successfully parsed. | 1629 * \return The corresponding value if successfully parsed. |
| 1631 */ | 1630 */ |
| 1632 // TODO(dcarney): deprecate | 1631 static V8_DEPRECATE_SOON("Use maybe version", |
| 1633 static Local<Value> Parse(Local<String> json_string); | 1632 Local<Value> Parse(Local<String> json_string)); |
| 1634 static MaybeLocal<Value> Parse(Isolate* isolate, Local<String> json_string); | 1633 static MaybeLocal<Value> Parse(Isolate* isolate, Local<String> json_string); |
| 1635 }; | 1634 }; |
| 1636 | 1635 |
| 1637 | 1636 |
| 1638 /** | 1637 /** |
| 1639 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap | 1638 * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap |
| 1640 * but can be created without entering a v8::Context and hence shouldn't | 1639 * but can be created without entering a v8::Context and hence shouldn't |
| 1641 * escape to JavaScript. | 1640 * escape to JavaScript. |
| 1642 */ | 1641 */ |
| 1643 class V8_EXPORT NativeWeakMap : public Data { | 1642 class V8_EXPORT NativeWeakMap : public Data { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 | 1912 |
| 1914 MaybeLocal<Boolean> ToBoolean(Local<Context> context) const; | 1913 MaybeLocal<Boolean> ToBoolean(Local<Context> context) const; |
| 1915 MaybeLocal<Number> ToNumber(Local<Context> context) const; | 1914 MaybeLocal<Number> ToNumber(Local<Context> context) const; |
| 1916 MaybeLocal<String> ToString(Local<Context> context) const; | 1915 MaybeLocal<String> ToString(Local<Context> context) const; |
| 1917 MaybeLocal<String> ToDetailString(Local<Context> context) const; | 1916 MaybeLocal<String> ToDetailString(Local<Context> context) const; |
| 1918 MaybeLocal<Object> ToObject(Local<Context> context) const; | 1917 MaybeLocal<Object> ToObject(Local<Context> context) const; |
| 1919 MaybeLocal<Integer> ToInteger(Local<Context> context) const; | 1918 MaybeLocal<Integer> ToInteger(Local<Context> context) const; |
| 1920 MaybeLocal<Uint32> ToUint32(Local<Context> context) const; | 1919 MaybeLocal<Uint32> ToUint32(Local<Context> context) const; |
| 1921 MaybeLocal<Int32> ToInt32(Local<Context> context) const; | 1920 MaybeLocal<Int32> ToInt32(Local<Context> context) const; |
| 1922 | 1921 |
| 1923 // TODO(dcarney): deprecate all these. | 1922 V8_DEPRECATE_SOON("Use maybe version", |
| 1924 Local<Boolean> ToBoolean(Isolate* isolate) const; | 1923 Local<Boolean> ToBoolean(Isolate* isolate)) const; |
| 1925 Local<Number> ToNumber(Isolate* isolate) const; | 1924 V8_DEPRECATE_SOON("Use maybe version", |
| 1926 Local<String> ToString(Isolate* isolate) const; | 1925 Local<Number> ToNumber(Isolate* isolate)) const; |
| 1927 Local<String> ToDetailString(Isolate* isolate) const; | 1926 V8_DEPRECATE_SOON("Use maybe version", |
| 1928 Local<Object> ToObject(Isolate* isolate) const; | 1927 Local<String> ToString(Isolate* isolate)) const; |
| 1929 Local<Integer> ToInteger(Isolate* isolate) const; | 1928 V8_DEPRECATE_SOON("Use maybe version", |
| 1930 Local<Uint32> ToUint32(Isolate* isolate) const; | 1929 Local<String> ToDetailString(Isolate* isolate)) const; |
| 1931 Local<Int32> ToInt32(Isolate* isolate) const; | 1930 V8_DEPRECATE_SOON("Use maybe version", |
| 1931 Local<Object> ToObject(Isolate* isolate)) const; |
| 1932 V8_DEPRECATE_SOON("Use maybe version", |
| 1933 Local<Integer> ToInteger(Isolate* isolate)) const; |
| 1934 V8_DEPRECATE_SOON("Use maybe version", |
| 1935 Local<Uint32> ToUint32(Isolate* isolate)) const; |
| 1936 V8_DEPRECATE_SOON("Use maybe version", |
| 1937 Local<Int32> ToInt32(Isolate* isolate)) const; |
| 1932 | 1938 |
| 1933 // TODO(dcarney): deprecate all these as well. | 1939 inline V8_DEPRECATE_SOON("Use maybe version", |
| 1934 inline Local<Boolean> ToBoolean() const; | 1940 Local<Boolean> ToBoolean()) const; |
| 1935 inline Local<Number> ToNumber() const; | 1941 inline V8_DEPRECATE_SOON("Use maybe version", Local<Number> ToNumber()) const; |
| 1936 inline Local<String> ToString() const; | 1942 inline V8_DEPRECATE_SOON("Use maybe version", Local<String> ToString()) const; |
| 1937 inline Local<String> ToDetailString() const; | 1943 inline V8_DEPRECATE_SOON("Use maybe version", |
| 1938 inline Local<Object> ToObject() const; | 1944 Local<String> ToDetailString()) const; |
| 1939 inline Local<Integer> ToInteger() const; | 1945 inline V8_DEPRECATE_SOON("Use maybe version", Local<Object> ToObject()) const; |
| 1940 inline Local<Uint32> ToUint32() const; | 1946 inline V8_DEPRECATE_SOON("Use maybe version", |
| 1941 inline Local<Int32> ToInt32() const; | 1947 Local<Integer> ToInteger()) const; |
| 1948 inline V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToUint32()) const; |
| 1949 inline V8_DEPRECATE_SOON("Use maybe version", Local<Int32> ToInt32()) const; |
| 1942 | 1950 |
| 1943 /** | 1951 /** |
| 1944 * Attempts to convert a string to an array index. | 1952 * Attempts to convert a string to an array index. |
| 1945 * Returns an empty handle if the conversion fails. | 1953 * Returns an empty handle if the conversion fails. |
| 1946 */ | 1954 */ |
| 1947 // TODO(dcarney): deprecate. | 1955 V8_DEPRECATE_SOON("Use maybe version", Local<Uint32> ToArrayIndex()) const; |
| 1948 Local<Uint32> ToArrayIndex() const; | |
| 1949 MaybeLocal<Uint32> ToArrayIndex(Local<Context> context) const; | 1956 MaybeLocal<Uint32> ToArrayIndex(Local<Context> context) const; |
| 1950 | 1957 |
| 1951 Maybe<bool> BooleanValue(Local<Context> context) const; | 1958 Maybe<bool> BooleanValue(Local<Context> context) const; |
| 1952 Maybe<double> NumberValue(Local<Context> context) const; | 1959 Maybe<double> NumberValue(Local<Context> context) const; |
| 1953 Maybe<int64_t> IntegerValue(Local<Context> context) const; | 1960 Maybe<int64_t> IntegerValue(Local<Context> context) const; |
| 1954 Maybe<uint32_t> Uint32Value(Local<Context> context) const; | 1961 Maybe<uint32_t> Uint32Value(Local<Context> context) const; |
| 1955 Maybe<int32_t> Int32Value(Local<Context> context) const; | 1962 Maybe<int32_t> Int32Value(Local<Context> context) const; |
| 1956 | 1963 |
| 1957 // TODO(dcarney): deprecate all these. | 1964 V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue()) const; |
| 1958 bool BooleanValue() const; | 1965 V8_DEPRECATE_SOON("Use maybe version", double NumberValue()) const; |
| 1959 double NumberValue() const; | 1966 V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue()) const; |
| 1960 int64_t IntegerValue() const; | 1967 V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value()) const; |
| 1961 uint32_t Uint32Value() const; | 1968 V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value()) const; |
| 1962 int32_t Int32Value() const; | |
| 1963 | 1969 |
| 1964 /** JS == */ | 1970 /** JS == */ |
| 1965 // TODO(dcarney): deprecate. | 1971 V8_DEPRECATE_SOON("Use maybe version", bool Equals(Handle<Value> that)) const; |
| 1966 bool Equals(Handle<Value> that) const; | |
| 1967 Maybe<bool> Equals(Local<Context> context, Handle<Value> that) const; | 1972 Maybe<bool> Equals(Local<Context> context, Handle<Value> that) const; |
| 1968 bool StrictEquals(Handle<Value> that) const; | 1973 bool StrictEquals(Handle<Value> that) const; |
| 1969 bool SameValue(Handle<Value> that) const; | 1974 bool SameValue(Handle<Value> that) const; |
| 1970 | 1975 |
| 1971 template <class T> V8_INLINE static Value* Cast(T* value); | 1976 template <class T> V8_INLINE static Value* Cast(T* value); |
| 1972 | 1977 |
| 1973 private: | 1978 private: |
| 1974 V8_INLINE bool QuickIsUndefined() const; | 1979 V8_INLINE bool QuickIsUndefined() const; |
| 1975 V8_INLINE bool QuickIsNull() const; | 1980 V8_INLINE bool QuickIsNull() const; |
| 1976 V8_INLINE bool QuickIsString() const; | 1981 V8_INLINE bool QuickIsString() const; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2532 ALL_CAN_WRITE = 1 << 1, | 2537 ALL_CAN_WRITE = 1 << 1, |
| 2533 PROHIBITS_OVERWRITING = 1 << 2 | 2538 PROHIBITS_OVERWRITING = 1 << 2 |
| 2534 }; | 2539 }; |
| 2535 | 2540 |
| 2536 | 2541 |
| 2537 /** | 2542 /** |
| 2538 * A JavaScript object (ECMA-262, 4.3.3) | 2543 * A JavaScript object (ECMA-262, 4.3.3) |
| 2539 */ | 2544 */ |
| 2540 class V8_EXPORT Object : public Value { | 2545 class V8_EXPORT Object : public Value { |
| 2541 public: | 2546 public: |
| 2542 // TODO(dcarney): deprecate | 2547 V8_DEPRECATE_SOON("Use maybe version", |
| 2543 bool Set(Handle<Value> key, Handle<Value> value); | 2548 bool Set(Handle<Value> key, Handle<Value> value)); |
| 2544 Maybe<bool> Set(Local<Context> context, Local<Value> key, Local<Value> value); | 2549 Maybe<bool> Set(Local<Context> context, Local<Value> key, Local<Value> value); |
| 2545 | 2550 |
| 2546 // TODO(dcarney): deprecate | 2551 V8_DEPRECATE_SOON("Use maybe version", |
| 2547 bool Set(uint32_t index, Handle<Value> value); | 2552 bool Set(uint32_t index, Handle<Value> value)); |
| 2548 Maybe<bool> Set(Local<Context> context, uint32_t index, Local<Value> value); | 2553 Maybe<bool> Set(Local<Context> context, uint32_t index, Local<Value> value); |
| 2549 | 2554 |
| 2550 // Sets an own property on this object bypassing interceptors and | 2555 // Sets an own property on this object bypassing interceptors and |
| 2551 // overriding accessors or read-only properties. | 2556 // overriding accessors or read-only properties. |
| 2552 // | 2557 // |
| 2553 // Note that if the object has an interceptor the property will be set | 2558 // Note that if the object has an interceptor the property will be set |
| 2554 // locally, but since the interceptor takes precedence the local property | 2559 // locally, but since the interceptor takes precedence the local property |
| 2555 // will only be returned if the interceptor doesn't return a value. | 2560 // will only be returned if the interceptor doesn't return a value. |
| 2556 // | 2561 // |
| 2557 // Note also that this only works for named properties. | 2562 // Note also that this only works for named properties. |
| 2558 // TODO(dcarney): deprecate | 2563 V8_DEPRECATE_SOON("Use maybe version", |
| 2559 bool ForceSet(Handle<Value> key, | 2564 bool ForceSet(Handle<Value> key, Handle<Value> value, |
| 2560 Handle<Value> value, | 2565 PropertyAttribute attribs = None)); |
| 2561 PropertyAttribute attribs = None); | |
| 2562 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key, | 2566 Maybe<bool> ForceSet(Local<Context> context, Local<Value> key, |
| 2563 Local<Value> value, PropertyAttribute attribs = None); | 2567 Local<Value> value, PropertyAttribute attribs = None); |
| 2564 | 2568 |
| 2565 // TODO(dcarney): deprecate | 2569 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Handle<Value> key)); |
| 2566 Local<Value> Get(Handle<Value> key); | |
| 2567 MaybeLocal<Value> Get(Local<Context> context, Local<Value> key); | 2570 MaybeLocal<Value> Get(Local<Context> context, Local<Value> key); |
| 2568 | 2571 |
| 2569 // TODO(dcarney): deprecate | 2572 V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index)); |
| 2570 Local<Value> Get(uint32_t index); | |
| 2571 MaybeLocal<Value> Get(Local<Context> context, uint32_t index); | 2573 MaybeLocal<Value> Get(Local<Context> context, uint32_t index); |
| 2572 | 2574 |
| 2573 /** | 2575 /** |
| 2574 * Gets the property attributes of a property which can be None or | 2576 * Gets the property attributes of a property which can be None or |
| 2575 * any combination of ReadOnly, DontEnum and DontDelete. Returns | 2577 * any combination of ReadOnly, DontEnum and DontDelete. Returns |
| 2576 * None when the property doesn't exist. | 2578 * None when the property doesn't exist. |
| 2577 */ | 2579 */ |
| 2578 // TODO(dcarney): deprecate | 2580 V8_DEPRECATE_SOON("Use maybe version", |
| 2579 PropertyAttribute GetPropertyAttributes(Handle<Value> key); | 2581 PropertyAttribute GetPropertyAttributes(Handle<Value> key)); |
| 2580 Maybe<PropertyAttribute> GetPropertyAttributes(Local<Context> context, | 2582 Maybe<PropertyAttribute> GetPropertyAttributes(Local<Context> context, |
| 2581 Local<Value> key); | 2583 Local<Value> key); |
| 2582 | 2584 |
| 2583 /** | 2585 /** |
| 2584 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. | 2586 * Returns Object.getOwnPropertyDescriptor as per ES5 section 15.2.3.3. |
| 2585 */ | 2587 */ |
| 2586 // TODO(dcarney): deprecate | 2588 V8_DEPRECATE_SOON("Use maybe version", |
| 2587 Local<Value> GetOwnPropertyDescriptor(Local<String> key); | 2589 Local<Value> GetOwnPropertyDescriptor(Local<String> key)); |
| 2588 MaybeLocal<Value> GetOwnPropertyDescriptor(Local<Context> context, | 2590 MaybeLocal<Value> GetOwnPropertyDescriptor(Local<Context> context, |
| 2589 Local<String> key); | 2591 Local<String> key); |
| 2590 | 2592 |
| 2591 // TODO(dcarney): deprecate | 2593 V8_DEPRECATE_SOON("Use maybe version", bool Has(Handle<Value> key)); |
| 2592 bool Has(Handle<Value> key); | |
| 2593 Maybe<bool> Has(Local<Context> context, Local<Value> key); | 2594 Maybe<bool> Has(Local<Context> context, Local<Value> key); |
| 2594 | 2595 |
| 2595 // TODO(dcarney): deprecate | 2596 V8_DEPRECATE_SOON("Use maybe version", bool Delete(Handle<Value> key)); |
| 2596 bool Delete(Handle<Value> key); | |
| 2597 Maybe<bool> Delete(Local<Context> context, Local<Value> key); | 2597 Maybe<bool> Delete(Local<Context> context, Local<Value> key); |
| 2598 | 2598 |
| 2599 // TODO(dcarney): deprecate | 2599 V8_DEPRECATE_SOON("Use maybe version", bool Has(uint32_t index)); |
| 2600 bool Has(uint32_t index); | |
| 2601 Maybe<bool> Has(Local<Context> context, uint32_t index); | 2600 Maybe<bool> Has(Local<Context> context, uint32_t index); |
| 2602 | 2601 |
| 2603 // TODO(dcarney): deprecate | 2602 V8_DEPRECATE_SOON("Use maybe version", bool Delete(uint32_t index)); |
| 2604 bool Delete(uint32_t index); | |
| 2605 Maybe<bool> Delete(Local<Context> context, uint32_t index); | 2603 Maybe<bool> Delete(Local<Context> context, uint32_t index); |
| 2606 | 2604 |
| 2607 // TODO(dcarney): deprecate | 2605 V8_DEPRECATE_SOON("Use maybe version", |
| 2608 bool SetAccessor(Handle<String> name, | 2606 bool SetAccessor(Handle<String> name, |
| 2609 AccessorGetterCallback getter, | 2607 AccessorGetterCallback getter, |
| 2610 AccessorSetterCallback setter = 0, | 2608 AccessorSetterCallback setter = 0, |
| 2611 Handle<Value> data = Handle<Value>(), | 2609 Handle<Value> data = Handle<Value>(), |
| 2612 AccessControl settings = DEFAULT, | 2610 AccessControl settings = DEFAULT, |
| 2613 PropertyAttribute attribute = None); | 2611 PropertyAttribute attribute = None)); |
| 2614 // TODO(dcarney): deprecate | 2612 V8_DEPRECATE_SOON("Use maybe version", |
| 2615 bool SetAccessor(Handle<Name> name, AccessorNameGetterCallback getter, | 2613 bool SetAccessor(Handle<Name> name, |
| 2616 AccessorNameSetterCallback setter = 0, | 2614 AccessorNameGetterCallback getter, |
| 2617 Handle<Value> data = Handle<Value>(), | 2615 AccessorNameSetterCallback setter = 0, |
| 2618 AccessControl settings = DEFAULT, | 2616 Handle<Value> data = Handle<Value>(), |
| 2619 PropertyAttribute attribute = None); | 2617 AccessControl settings = DEFAULT, |
| 2618 PropertyAttribute attribute = None)); |
| 2620 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name, | 2619 Maybe<bool> SetAccessor(Local<Context> context, Local<Name> name, |
| 2621 AccessorNameGetterCallback getter, | 2620 AccessorNameGetterCallback getter, |
| 2622 AccessorNameSetterCallback setter = 0, | 2621 AccessorNameSetterCallback setter = 0, |
| 2623 MaybeLocal<Value> data = MaybeLocal<Value>(), | 2622 MaybeLocal<Value> data = MaybeLocal<Value>(), |
| 2624 AccessControl settings = DEFAULT, | 2623 AccessControl settings = DEFAULT, |
| 2625 PropertyAttribute attribute = None); | 2624 PropertyAttribute attribute = None); |
| 2626 | 2625 |
| 2627 void SetAccessorProperty(Local<Name> name, | 2626 void SetAccessorProperty(Local<Name> name, |
| 2628 Local<Function> getter, | 2627 Local<Function> getter, |
| 2629 Handle<Function> setter = Handle<Function>(), | 2628 Handle<Function> setter = Handle<Function>(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2641 bool SetPrivate(Handle<Private> key, Handle<Value> value); | 2640 bool SetPrivate(Handle<Private> key, Handle<Value> value); |
| 2642 bool DeletePrivate(Handle<Private> key); | 2641 bool DeletePrivate(Handle<Private> key); |
| 2643 Local<Value> GetPrivate(Handle<Private> key); | 2642 Local<Value> GetPrivate(Handle<Private> key); |
| 2644 | 2643 |
| 2645 /** | 2644 /** |
| 2646 * Returns an array containing the names of the enumerable properties | 2645 * Returns an array containing the names of the enumerable properties |
| 2647 * of this object, including properties from prototype objects. The | 2646 * of this object, including properties from prototype objects. The |
| 2648 * array returned by this method contains the same values as would | 2647 * array returned by this method contains the same values as would |
| 2649 * be enumerated by a for-in statement over this object. | 2648 * be enumerated by a for-in statement over this object. |
| 2650 */ | 2649 */ |
| 2651 // TODO(dcarney): deprecate | 2650 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetPropertyNames()); |
| 2652 Local<Array> GetPropertyNames(); | |
| 2653 MaybeLocal<Array> GetPropertyNames(Local<Context> context); | 2651 MaybeLocal<Array> GetPropertyNames(Local<Context> context); |
| 2654 | 2652 |
| 2655 /** | 2653 /** |
| 2656 * This function has the same functionality as GetPropertyNames but | 2654 * This function has the same functionality as GetPropertyNames but |
| 2657 * the returned array doesn't contain the names of properties from | 2655 * the returned array doesn't contain the names of properties from |
| 2658 * prototype objects. | 2656 * prototype objects. |
| 2659 */ | 2657 */ |
| 2660 // TODO(dcarney): deprecate | 2658 V8_DEPRECATE_SOON("Use maybe version", Local<Array> GetOwnPropertyNames()); |
| 2661 Local<Array> GetOwnPropertyNames(); | |
| 2662 MaybeLocal<Array> GetOwnPropertyNames(Local<Context> context); | 2659 MaybeLocal<Array> GetOwnPropertyNames(Local<Context> context); |
| 2663 | 2660 |
| 2664 /** | 2661 /** |
| 2665 * Get the prototype object. This does not skip objects marked to | 2662 * Get the prototype object. This does not skip objects marked to |
| 2666 * be skipped by __proto__ and it does not consult the security | 2663 * be skipped by __proto__ and it does not consult the security |
| 2667 * handler. | 2664 * handler. |
| 2668 */ | 2665 */ |
| 2669 Local<Value> GetPrototype(); | 2666 Local<Value> GetPrototype(); |
| 2670 | 2667 |
| 2671 /** | 2668 /** |
| 2672 * Set the prototype object. This does not skip objects marked to | 2669 * Set the prototype object. This does not skip objects marked to |
| 2673 * be skipped by __proto__ and it does not consult the security | 2670 * be skipped by __proto__ and it does not consult the security |
| 2674 * handler. | 2671 * handler. |
| 2675 */ | 2672 */ |
| 2676 // TODO(dcarney): deprecate | 2673 V8_DEPRECATE_SOON("Use maybe version", |
| 2677 bool SetPrototype(Handle<Value> prototype); | 2674 bool SetPrototype(Handle<Value> prototype)); |
| 2678 Maybe<bool> SetPrototype(Local<Context> context, Local<Value> prototype); | 2675 Maybe<bool> SetPrototype(Local<Context> context, Local<Value> prototype); |
| 2679 | 2676 |
| 2680 /** | 2677 /** |
| 2681 * Finds an instance of the given function template in the prototype | 2678 * Finds an instance of the given function template in the prototype |
| 2682 * chain. | 2679 * chain. |
| 2683 */ | 2680 */ |
| 2684 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); | 2681 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); |
| 2685 | 2682 |
| 2686 /** | 2683 /** |
| 2687 * Call builtin Object.prototype.toString on this object. | 2684 * Call builtin Object.prototype.toString on this object. |
| 2688 * This is different from Value::ToString() that may call | 2685 * This is different from Value::ToString() that may call |
| 2689 * user-defined toString function. This one does not. | 2686 * user-defined toString function. This one does not. |
| 2690 */ | 2687 */ |
| 2691 // TODO(dcarney): deprecate | 2688 V8_DEPRECATE_SOON("Use maybe version", Local<String> ObjectProtoToString()); |
| 2692 Local<String> ObjectProtoToString(); | |
| 2693 MaybeLocal<String> ObjectProtoToString(Local<Context> context); | 2689 MaybeLocal<String> ObjectProtoToString(Local<Context> context); |
| 2694 | 2690 |
| 2695 /** | 2691 /** |
| 2696 * Returns the name of the function invoked as a constructor for this object. | 2692 * Returns the name of the function invoked as a constructor for this object. |
| 2697 */ | 2693 */ |
| 2698 Local<String> GetConstructorName(); | 2694 Local<String> GetConstructorName(); |
| 2699 | 2695 |
| 2700 /** Gets the number of internal fields for this Object. */ | 2696 /** Gets the number of internal fields for this Object. */ |
| 2701 int InternalFieldCount(); | 2697 int InternalFieldCount(); |
| 2702 | 2698 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2726 } | 2722 } |
| 2727 | 2723 |
| 2728 /** | 2724 /** |
| 2729 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 2725 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
| 2730 * a field, GetAlignedPointerFromInternalField must be used, everything else | 2726 * a field, GetAlignedPointerFromInternalField must be used, everything else |
| 2731 * leads to undefined behavior. | 2727 * leads to undefined behavior. |
| 2732 */ | 2728 */ |
| 2733 void SetAlignedPointerInInternalField(int index, void* value); | 2729 void SetAlignedPointerInInternalField(int index, void* value); |
| 2734 | 2730 |
| 2735 // Testers for local properties. | 2731 // Testers for local properties. |
| 2736 // TODO(dcarney): deprecate | 2732 V8_DEPRECATE_SOON("Use maybe version", |
| 2737 bool HasOwnProperty(Handle<String> key); | 2733 bool HasOwnProperty(Handle<String> key)); |
| 2738 Maybe<bool> HasOwnProperty(Local<Context> context, Local<Name> key); | 2734 Maybe<bool> HasOwnProperty(Local<Context> context, Local<Name> key); |
| 2739 // TODO(dcarney): deprecate | 2735 V8_DEPRECATE_SOON("Use maybe version", |
| 2740 bool HasRealNamedProperty(Handle<String> key); | 2736 bool HasRealNamedProperty(Handle<String> key)); |
| 2741 Maybe<bool> HasRealNamedProperty(Local<Context> context, Local<Name> key); | 2737 Maybe<bool> HasRealNamedProperty(Local<Context> context, Local<Name> key); |
| 2742 // TODO(dcarney): deprecate | 2738 V8_DEPRECATE_SOON("Use maybe version", |
| 2743 bool HasRealIndexedProperty(uint32_t index); | 2739 bool HasRealIndexedProperty(uint32_t index)); |
| 2744 Maybe<bool> HasRealIndexedProperty(Local<Context> context, uint32_t index); | 2740 Maybe<bool> HasRealIndexedProperty(Local<Context> context, uint32_t index); |
| 2745 // TODO(dcarney): deprecate | 2741 V8_DEPRECATE_SOON("Use maybe version", |
| 2746 bool HasRealNamedCallbackProperty(Handle<String> key); | 2742 bool HasRealNamedCallbackProperty(Handle<String> key)); |
| 2747 Maybe<bool> HasRealNamedCallbackProperty(Local<Context> context, | 2743 Maybe<bool> HasRealNamedCallbackProperty(Local<Context> context, |
| 2748 Local<Name> key); | 2744 Local<Name> key); |
| 2749 | 2745 |
| 2750 /** | 2746 /** |
| 2751 * If result.IsEmpty() no real property was located in the prototype chain. | 2747 * If result.IsEmpty() no real property was located in the prototype chain. |
| 2752 * This means interceptors in the prototype chain are not called. | 2748 * This means interceptors in the prototype chain are not called. |
| 2753 */ | 2749 */ |
| 2754 // TODO(dcarney): deprecate | 2750 V8_DEPRECATE_SOON( |
| 2755 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); | 2751 "Use maybe version", |
| 2752 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key)); |
| 2756 MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(Local<Context> context, | 2753 MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(Local<Context> context, |
| 2757 Local<Name> key); | 2754 Local<Name> key); |
| 2758 | 2755 |
| 2759 /** | 2756 /** |
| 2760 * Gets the property attributes of a real property in the prototype chain, | 2757 * Gets the property attributes of a real property in the prototype chain, |
| 2761 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. | 2758 * which can be None or any combination of ReadOnly, DontEnum and DontDelete. |
| 2762 * Interceptors in the prototype chain are not called. | 2759 * Interceptors in the prototype chain are not called. |
| 2763 */ | 2760 */ |
| 2764 // TODO(dcarney): deprecate | 2761 V8_DEPRECATE_SOON( |
| 2765 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( | 2762 "Use maybe version", |
| 2766 Handle<String> key); | 2763 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( |
| 2764 Handle<String> key)); |
| 2767 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( | 2765 Maybe<PropertyAttribute> GetRealNamedPropertyAttributesInPrototypeChain( |
| 2768 Local<Context> context, Local<Name> key); | 2766 Local<Context> context, Local<Name> key); |
| 2769 | 2767 |
| 2770 /** | 2768 /** |
| 2771 * If result.IsEmpty() no real property was located on the object or | 2769 * If result.IsEmpty() no real property was located on the object or |
| 2772 * in the prototype chain. | 2770 * in the prototype chain. |
| 2773 * This means interceptors in the prototype chain are not called. | 2771 * This means interceptors in the prototype chain are not called. |
| 2774 */ | 2772 */ |
| 2775 // TODO(dcarney): deprecate | 2773 V8_DEPRECATE_SOON("Use maybe version", |
| 2776 Local<Value> GetRealNamedProperty(Handle<String> key); | 2774 Local<Value> GetRealNamedProperty(Handle<String> key)); |
| 2777 MaybeLocal<Value> GetRealNamedProperty(Local<Context> context, | 2775 MaybeLocal<Value> GetRealNamedProperty(Local<Context> context, |
| 2778 Local<Name> key); | 2776 Local<Name> key); |
| 2779 | 2777 |
| 2780 /** | 2778 /** |
| 2781 * Gets the property attributes of a real property which can be | 2779 * Gets the property attributes of a real property which can be |
| 2782 * None or any combination of ReadOnly, DontEnum and DontDelete. | 2780 * None or any combination of ReadOnly, DontEnum and DontDelete. |
| 2783 * Interceptors in the prototype chain are not called. | 2781 * Interceptors in the prototype chain are not called. |
| 2784 */ | 2782 */ |
| 2785 // TODO(dcarney): deprecate | 2783 V8_DEPRECATE_SOON("Use maybe version", |
| 2786 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(Handle<String> key); | 2784 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( |
| 2785 Handle<String> key)); |
| 2787 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( | 2786 Maybe<PropertyAttribute> GetRealNamedPropertyAttributes( |
| 2788 Local<Context> context, Local<Name> key); | 2787 Local<Context> context, Local<Name> key); |
| 2789 | 2788 |
| 2790 /** Tests for a named lookup interceptor.*/ | 2789 /** Tests for a named lookup interceptor.*/ |
| 2791 bool HasNamedLookupInterceptor(); | 2790 bool HasNamedLookupInterceptor(); |
| 2792 | 2791 |
| 2793 /** Tests for an index lookup interceptor.*/ | 2792 /** Tests for an index lookup interceptor.*/ |
| 2794 bool HasIndexedLookupInterceptor(); | 2793 bool HasIndexedLookupInterceptor(); |
| 2795 | 2794 |
| 2796 /** | 2795 /** |
| 2797 * Turns on access check on the object if the object is an instance of | 2796 * Turns on access check on the object if the object is an instance of |
| 2798 * a template that has access check callbacks. If an object has no | 2797 * a template that has access check callbacks. If an object has no |
| 2799 * access check info, the object cannot be accessed by anyone. | 2798 * access check info, the object cannot be accessed by anyone. |
| 2800 */ | 2799 */ |
| 2801 // TODO(dcarney): deprecate | 2800 V8_DEPRECATE_SOON("No alternative", void TurnOnAccessCheck()); |
| 2802 void TurnOnAccessCheck(); | |
| 2803 | 2801 |
| 2804 /** | 2802 /** |
| 2805 * Returns the identity hash for this object. The current implementation | 2803 * Returns the identity hash for this object. The current implementation |
| 2806 * uses a hidden property on the object to store the identity hash. | 2804 * uses a hidden property on the object to store the identity hash. |
| 2807 * | 2805 * |
| 2808 * The return value will never be 0. Also, it is not guaranteed to be | 2806 * The return value will never be 0. Also, it is not guaranteed to be |
| 2809 * unique. | 2807 * unique. |
| 2810 */ | 2808 */ |
| 2811 int GetIdentityHash(); | 2809 int GetIdentityHash(); |
| 2812 | 2810 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2882 * ObjectTemplate::SetCallAsFunctionHandler method. | 2880 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 2883 * Note: This method behaves like the Function::NewInstance method. | 2881 * Note: This method behaves like the Function::NewInstance method. |
| 2884 */ | 2882 */ |
| 2885 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); | 2883 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); |
| 2886 MaybeLocal<Value> CallAsConstructor(Local<Context> context, int argc, | 2884 MaybeLocal<Value> CallAsConstructor(Local<Context> context, int argc, |
| 2887 Local<Value> argv[]); | 2885 Local<Value> argv[]); |
| 2888 | 2886 |
| 2889 /** | 2887 /** |
| 2890 * Return the isolate to which the Object belongs to. | 2888 * Return the isolate to which the Object belongs to. |
| 2891 */ | 2889 */ |
| 2892 // TODO(dcarney): deprecate - this is an implementation detail. | 2890 V8_DEPRECATE_SOON("Keep track of isolate correctly", Isolate* GetIsolate()); |
| 2893 Isolate* GetIsolate(); | |
| 2894 | 2891 |
| 2895 static Local<Object> New(Isolate* isolate); | 2892 static Local<Object> New(Isolate* isolate); |
| 2896 | 2893 |
| 2897 V8_INLINE static Object* Cast(Value* obj); | 2894 V8_INLINE static Object* Cast(Value* obj); |
| 2898 | 2895 |
| 2899 private: | 2896 private: |
| 2900 Object(); | 2897 Object(); |
| 2901 static void CheckCast(Value* obj); | 2898 static void CheckCast(Value* obj); |
| 2902 Local<Value> SlowGetInternalField(int index); | 2899 Local<Value> SlowGetInternalField(int index); |
| 2903 void* SlowGetAlignedPointerFromInternalField(int index); | 2900 void* SlowGetAlignedPointerFromInternalField(int index); |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4161 /** | 4158 /** |
| 4162 * An ObjectTemplate is used to create objects at runtime. | 4159 * An ObjectTemplate is used to create objects at runtime. |
| 4163 * | 4160 * |
| 4164 * Properties added to an ObjectTemplate are added to each object | 4161 * Properties added to an ObjectTemplate are added to each object |
| 4165 * created from the ObjectTemplate. | 4162 * created from the ObjectTemplate. |
| 4166 */ | 4163 */ |
| 4167 class V8_EXPORT ObjectTemplate : public Template { | 4164 class V8_EXPORT ObjectTemplate : public Template { |
| 4168 public: | 4165 public: |
| 4169 /** Creates an ObjectTemplate. */ | 4166 /** Creates an ObjectTemplate. */ |
| 4170 static Local<ObjectTemplate> New(Isolate* isolate); | 4167 static Local<ObjectTemplate> New(Isolate* isolate); |
| 4171 // Will be deprecated soon. | 4168 static V8_DEPRECATE_SOON("Use isolate version", Local<ObjectTemplate> New()); |
| 4172 static Local<ObjectTemplate> New(); | |
| 4173 | 4169 |
| 4174 /** Creates a new instance of this template.*/ | 4170 /** Creates a new instance of this template.*/ |
| 4175 Local<Object> NewInstance(); | 4171 Local<Object> NewInstance(); |
| 4176 | 4172 |
| 4177 /** | 4173 /** |
| 4178 * Sets an accessor on the object template. | 4174 * Sets an accessor on the object template. |
| 4179 * | 4175 * |
| 4180 * Whenever the property with the given name is accessed on objects | 4176 * Whenever the property with the given name is accessed on objects |
| 4181 * created from this ObjectTemplate the getter and setter callbacks | 4177 * created from this ObjectTemplate the getter and setter callbacks |
| 4182 * are called instead of getting and setting the property directly | 4178 * are called instead of getting and setting the property directly |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5511 typedef uintptr_t (*ReturnAddressLocationResolver)( | 5507 typedef uintptr_t (*ReturnAddressLocationResolver)( |
| 5512 uintptr_t return_addr_location); | 5508 uintptr_t return_addr_location); |
| 5513 | 5509 |
| 5514 | 5510 |
| 5515 /** | 5511 /** |
| 5516 * Container class for static utility functions. | 5512 * Container class for static utility functions. |
| 5517 */ | 5513 */ |
| 5518 class V8_EXPORT V8 { | 5514 class V8_EXPORT V8 { |
| 5519 public: | 5515 public: |
| 5520 /** Set the callback to invoke in case of fatal errors. */ | 5516 /** Set the callback to invoke in case of fatal errors. */ |
| 5521 // TODO(dcarney): deprecate this. | 5517 V8_INLINE static V8_DEPRECATE_SOON( |
| 5522 V8_INLINE static void SetFatalErrorHandler(FatalErrorCallback that); | 5518 "Use isolate version", |
| 5519 void SetFatalErrorHandler(FatalErrorCallback that)); |
| 5523 | 5520 |
| 5524 /** | 5521 /** |
| 5525 * Set the callback to invoke to check if code generation from | 5522 * Set the callback to invoke to check if code generation from |
| 5526 * strings should be allowed. | 5523 * strings should be allowed. |
| 5527 */ | 5524 */ |
| 5528 // TODO(dcarney): deprecate this. | 5525 V8_INLINE static V8_DEPRECATE_SOON( |
| 5529 V8_INLINE static void SetAllowCodeGenerationFromStringsCallback( | 5526 "Use isolate version", void SetAllowCodeGenerationFromStringsCallback( |
| 5530 AllowCodeGenerationFromStringsCallback that); | 5527 AllowCodeGenerationFromStringsCallback that)); |
| 5531 | 5528 |
| 5532 /** | 5529 /** |
| 5533 * Set allocator to use for ArrayBuffer memory. | 5530 * Set allocator to use for ArrayBuffer memory. |
| 5534 * The allocator should be set only once. The allocator should be set | 5531 * The allocator should be set only once. The allocator should be set |
| 5535 * before any code tha uses ArrayBuffers is executed. | 5532 * before any code tha uses ArrayBuffers is executed. |
| 5536 * This allocator is used in all isolates. | 5533 * This allocator is used in all isolates. |
| 5537 */ | 5534 */ |
| 5538 static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator); | 5535 static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator); |
| 5539 | 5536 |
| 5540 /** | 5537 /** |
| 5541 * Check if V8 is dead and therefore unusable. This is the case after | 5538 * Check if V8 is dead and therefore unusable. This is the case after |
| 5542 * fatal errors such as out-of-memory situations. | 5539 * fatal errors such as out-of-memory situations. |
| 5543 */ | 5540 */ |
| 5544 // TODO(dcarney): deprecate this. | 5541 V8_INLINE static V8_DEPRECATE_SOON("no alternative", bool IsDead()); |
| 5545 V8_INLINE static bool IsDead(); | |
| 5546 | 5542 |
| 5547 /** | 5543 /** |
| 5548 * Hand startup data to V8, in case the embedder has chosen to build | 5544 * Hand startup data to V8, in case the embedder has chosen to build |
| 5549 * V8 with external startup data. | 5545 * V8 with external startup data. |
| 5550 * | 5546 * |
| 5551 * Note: | 5547 * Note: |
| 5552 * - By default the startup data is linked into the V8 library, in which | 5548 * - By default the startup data is linked into the V8 library, in which |
| 5553 * case this function is not meaningful. | 5549 * case this function is not meaningful. |
| 5554 * - If this needs to be called, it needs to be called before V8 | 5550 * - If this needs to be called, it needs to be called before V8 |
| 5555 * tries to make use of its built-ins. | 5551 * tries to make use of its built-ins. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5571 | 5567 |
| 5572 /** | 5568 /** |
| 5573 * Adds a message listener. | 5569 * Adds a message listener. |
| 5574 * | 5570 * |
| 5575 * The same message listener can be added more than once and in that | 5571 * The same message listener can be added more than once and in that |
| 5576 * case it will be called more than once for each message. | 5572 * case it will be called more than once for each message. |
| 5577 * | 5573 * |
| 5578 * If data is specified, it will be passed to the callback when it is called. | 5574 * If data is specified, it will be passed to the callback when it is called. |
| 5579 * Otherwise, the exception object will be passed to the callback instead. | 5575 * Otherwise, the exception object will be passed to the callback instead. |
| 5580 */ | 5576 */ |
| 5581 // TODO(dcarney): deprecate this. | 5577 V8_INLINE static V8_DEPRECATE_SOON( |
| 5582 V8_INLINE static bool AddMessageListener( | 5578 "Use isolate version", |
| 5583 MessageCallback that, Handle<Value> data = Handle<Value>()); | 5579 bool AddMessageListener(MessageCallback that, |
| 5580 Handle<Value> data = Handle<Value>())); |
| 5584 | 5581 |
| 5585 /** | 5582 /** |
| 5586 * Remove all message listeners from the specified callback function. | 5583 * Remove all message listeners from the specified callback function. |
| 5587 */ | 5584 */ |
| 5588 // TODO(dcarney): deprecate this. | 5585 V8_INLINE static V8_DEPRECATE_SOON( |
| 5589 V8_INLINE static void RemoveMessageListeners(MessageCallback that); | 5586 "Use isolate version", void RemoveMessageListeners(MessageCallback that)); |
| 5590 | 5587 |
| 5591 /** | 5588 /** |
| 5592 * Tells V8 to capture current stack trace when uncaught exception occurs | 5589 * Tells V8 to capture current stack trace when uncaught exception occurs |
| 5593 * and report it to the message listeners. The option is off by default. | 5590 * and report it to the message listeners. The option is off by default. |
| 5594 */ | 5591 */ |
| 5595 // TODO(dcarney): deprecate this. | 5592 V8_INLINE static V8_DEPRECATE_SOON( |
| 5596 V8_INLINE static void SetCaptureStackTraceForUncaughtExceptions( | 5593 "Use isolate version", |
| 5597 bool capture, int frame_limit = 10, | 5594 void SetCaptureStackTraceForUncaughtExceptions( |
| 5598 StackTrace::StackTraceOptions options = StackTrace::kOverview); | 5595 bool capture, int frame_limit = 10, |
| 5596 StackTrace::StackTraceOptions options = StackTrace::kOverview)); |
| 5599 | 5597 |
| 5600 /** | 5598 /** |
| 5601 * Sets V8 flags from a string. | 5599 * Sets V8 flags from a string. |
| 5602 */ | 5600 */ |
| 5603 static void SetFlagsFromString(const char* str, int length); | 5601 static void SetFlagsFromString(const char* str, int length); |
| 5604 | 5602 |
| 5605 /** | 5603 /** |
| 5606 * Sets V8 flags from the command line. | 5604 * Sets V8 flags from the command line. |
| 5607 */ | 5605 */ |
| 5608 static void SetFlagsFromCommandLine(int* argc, | 5606 static void SetFlagsFromCommandLine(int* argc, |
| 5609 char** argv, | 5607 char** argv, |
| 5610 bool remove_flags); | 5608 bool remove_flags); |
| 5611 | 5609 |
| 5612 /** Get the version string. */ | 5610 /** Get the version string. */ |
| 5613 static const char* GetVersion(); | 5611 static const char* GetVersion(); |
| 5614 | 5612 |
| 5615 /** Callback function for reporting failed access checks.*/ | 5613 /** Callback function for reporting failed access checks.*/ |
| 5616 // TODO(dcarney): deprecate this. | 5614 V8_INLINE static V8_DEPRECATE_SOON( |
| 5617 V8_INLINE static void SetFailedAccessCheckCallbackFunction( | 5615 "Use isolate version", |
| 5618 FailedAccessCheckCallback); | 5616 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)); |
| 5619 | 5617 |
| 5620 /** | 5618 /** |
| 5621 * Enables the host application to receive a notification before a | 5619 * Enables the host application to receive a notification before a |
| 5622 * garbage collection. Allocations are not allowed in the | 5620 * garbage collection. Allocations are not allowed in the |
| 5623 * callback function, you therefore cannot manipulate objects (set | 5621 * callback function, you therefore cannot manipulate objects (set |
| 5624 * or delete properties for example) since it is possible such | 5622 * or delete properties for example) since it is possible such |
| 5625 * operations will result in the allocation of objects. It is possible | 5623 * operations will result in the allocation of objects. It is possible |
| 5626 * to specify the GCType filter for your callback. But it is not possible to | 5624 * to specify the GCType filter for your callback. But it is not possible to |
| 5627 * register the same callback function two times with different | 5625 * register the same callback function two times with different |
| 5628 * GCType filters. | 5626 * GCType filters. |
| 5629 */ | 5627 */ |
| 5630 // TODO(dcarney): deprecate this. | 5628 static V8_DEPRECATE_SOON( |
| 5631 static void AddGCPrologueCallback( | 5629 "Use isolate version", |
| 5632 GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | 5630 void AddGCPrologueCallback(GCPrologueCallback callback, |
| 5631 GCType gc_type_filter = kGCTypeAll)); |
| 5633 | 5632 |
| 5634 /** | 5633 /** |
| 5635 * This function removes callback which was installed by | 5634 * This function removes callback which was installed by |
| 5636 * AddGCPrologueCallback function. | 5635 * AddGCPrologueCallback function. |
| 5637 */ | 5636 */ |
| 5638 // TODO(dcarney): deprecate this. | 5637 V8_INLINE static V8_DEPRECATE_SOON( |
| 5639 V8_INLINE static void RemoveGCPrologueCallback(GCPrologueCallback callback); | 5638 "Use isolate version", |
| 5639 void RemoveGCPrologueCallback(GCPrologueCallback callback)); |
| 5640 | 5640 |
| 5641 /** | 5641 /** |
| 5642 * Enables the host application to receive a notification after a | 5642 * Enables the host application to receive a notification after a |
| 5643 * garbage collection. Allocations are not allowed in the | 5643 * garbage collection. Allocations are not allowed in the |
| 5644 * callback function, you therefore cannot manipulate objects (set | 5644 * callback function, you therefore cannot manipulate objects (set |
| 5645 * or delete properties for example) since it is possible such | 5645 * or delete properties for example) since it is possible such |
| 5646 * operations will result in the allocation of objects. It is possible | 5646 * operations will result in the allocation of objects. It is possible |
| 5647 * to specify the GCType filter for your callback. But it is not possible to | 5647 * to specify the GCType filter for your callback. But it is not possible to |
| 5648 * register the same callback function two times with different | 5648 * register the same callback function two times with different |
| 5649 * GCType filters. | 5649 * GCType filters. |
| 5650 */ | 5650 */ |
| 5651 // TODO(dcarney): deprecate this. | 5651 static V8_DEPRECATE_SOON( |
| 5652 static void AddGCEpilogueCallback( | 5652 "Use isolate version", |
| 5653 GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | 5653 void AddGCEpilogueCallback(GCEpilogueCallback callback, |
| 5654 GCType gc_type_filter = kGCTypeAll)); |
| 5654 | 5655 |
| 5655 /** | 5656 /** |
| 5656 * This function removes callback which was installed by | 5657 * This function removes callback which was installed by |
| 5657 * AddGCEpilogueCallback function. | 5658 * AddGCEpilogueCallback function. |
| 5658 */ | 5659 */ |
| 5659 // TODO(dcarney): deprecate this. | 5660 V8_INLINE static V8_DEPRECATE_SOON( |
| 5660 V8_INLINE static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | 5661 "Use isolate version", |
| 5662 void RemoveGCEpilogueCallback(GCEpilogueCallback callback)); |
| 5661 | 5663 |
| 5662 /** | 5664 /** |
| 5663 * Enables the host application to provide a mechanism to be notified | 5665 * Enables the host application to provide a mechanism to be notified |
| 5664 * and perform custom logging when V8 Allocates Executable Memory. | 5666 * and perform custom logging when V8 Allocates Executable Memory. |
| 5665 */ | 5667 */ |
| 5666 // TODO(dcarney): deprecate this. | 5668 V8_INLINE static V8_DEPRECATE_SOON( |
| 5667 V8_INLINE static void AddMemoryAllocationCallback( | 5669 "Use isolate version", |
| 5668 MemoryAllocationCallback callback, ObjectSpace space, | 5670 void AddMemoryAllocationCallback(MemoryAllocationCallback callback, |
| 5669 AllocationAction action); | 5671 ObjectSpace space, |
| 5672 AllocationAction action)); |
| 5670 | 5673 |
| 5671 /** | 5674 /** |
| 5672 * Removes callback that was installed by AddMemoryAllocationCallback. | 5675 * Removes callback that was installed by AddMemoryAllocationCallback. |
| 5673 */ | 5676 */ |
| 5674 // TODO(dcarney): deprecate this. | 5677 V8_INLINE static V8_DEPRECATE_SOON( |
| 5675 V8_INLINE static void RemoveMemoryAllocationCallback( | 5678 "Use isolate version", |
| 5676 MemoryAllocationCallback callback); | 5679 void RemoveMemoryAllocationCallback(MemoryAllocationCallback callback)); |
| 5677 | 5680 |
| 5678 /** | 5681 /** |
| 5679 * Initializes V8. This function needs to be called before the first Isolate | 5682 * Initializes V8. This function needs to be called before the first Isolate |
| 5680 * is created. It always returns true. | 5683 * is created. It always returns true. |
| 5681 */ | 5684 */ |
| 5682 static bool Initialize(); | 5685 static bool Initialize(); |
| 5683 | 5686 |
| 5684 /** | 5687 /** |
| 5685 * Allows the host application to provide a callback which can be used | 5688 * Allows the host application to provide a callback which can be used |
| 5686 * as a source of entropy for random number generators. | 5689 * as a source of entropy for random number generators. |
| 5687 */ | 5690 */ |
| 5688 static void SetEntropySource(EntropySource source); | 5691 static void SetEntropySource(EntropySource source); |
| 5689 | 5692 |
| 5690 /** | 5693 /** |
| 5691 * Allows the host application to provide a callback that allows v8 to | 5694 * Allows the host application to provide a callback that allows v8 to |
| 5692 * cooperate with a profiler that rewrites return addresses on stack. | 5695 * cooperate with a profiler that rewrites return addresses on stack. |
| 5693 */ | 5696 */ |
| 5694 static void SetReturnAddressLocationResolver( | 5697 static void SetReturnAddressLocationResolver( |
| 5695 ReturnAddressLocationResolver return_address_resolver); | 5698 ReturnAddressLocationResolver return_address_resolver); |
| 5696 | 5699 |
| 5697 /** | 5700 /** |
| 5698 * Forcefully terminate the current thread of JavaScript execution | 5701 * Forcefully terminate the current thread of JavaScript execution |
| 5699 * in the given isolate. | 5702 * in the given isolate. |
| 5700 * | 5703 * |
| 5701 * This method can be used by any thread even if that thread has not | 5704 * This method can be used by any thread even if that thread has not |
| 5702 * acquired the V8 lock with a Locker object. | 5705 * acquired the V8 lock with a Locker object. |
| 5703 * | 5706 * |
| 5704 * \param isolate The isolate in which to terminate the current JS execution. | 5707 * \param isolate The isolate in which to terminate the current JS execution. |
| 5705 */ | 5708 */ |
| 5706 // TODO(dcarney): deprecate this. | 5709 V8_INLINE static V8_DEPRECATE_SOON("Use isolate version", |
| 5707 V8_INLINE static void TerminateExecution(Isolate* isolate); | 5710 void TerminateExecution(Isolate* isolate)); |
| 5708 | 5711 |
| 5709 /** | 5712 /** |
| 5710 * Is V8 terminating JavaScript execution. | 5713 * Is V8 terminating JavaScript execution. |
| 5711 * | 5714 * |
| 5712 * Returns true if JavaScript execution is currently terminating | 5715 * Returns true if JavaScript execution is currently terminating |
| 5713 * because of a call to TerminateExecution. In that case there are | 5716 * because of a call to TerminateExecution. In that case there are |
| 5714 * still JavaScript frames on the stack and the termination | 5717 * still JavaScript frames on the stack and the termination |
| 5715 * exception is still active. | 5718 * exception is still active. |
| 5716 * | 5719 * |
| 5717 * \param isolate The isolate in which to check. | 5720 * \param isolate The isolate in which to check. |
| 5718 */ | 5721 */ |
| 5719 // TODO(dcarney): deprecate this. | 5722 V8_INLINE static V8_DEPRECATE_SOON( |
| 5720 V8_INLINE static bool IsExecutionTerminating(Isolate* isolate = NULL); | 5723 "Use isolate version", |
| 5724 bool IsExecutionTerminating(Isolate* isolate = NULL)); |
| 5721 | 5725 |
| 5722 /** | 5726 /** |
| 5723 * Resume execution capability in the given isolate, whose execution | 5727 * Resume execution capability in the given isolate, whose execution |
| 5724 * was previously forcefully terminated using TerminateExecution(). | 5728 * was previously forcefully terminated using TerminateExecution(). |
| 5725 * | 5729 * |
| 5726 * When execution is forcefully terminated using TerminateExecution(), | 5730 * When execution is forcefully terminated using TerminateExecution(), |
| 5727 * the isolate can not resume execution until all JavaScript frames | 5731 * the isolate can not resume execution until all JavaScript frames |
| 5728 * have propagated the uncatchable exception which is generated. This | 5732 * have propagated the uncatchable exception which is generated. This |
| 5729 * method allows the program embedding the engine to handle the | 5733 * method allows the program embedding the engine to handle the |
| 5730 * termination event and resume execution capability, even if | 5734 * termination event and resume execution capability, even if |
| 5731 * JavaScript frames remain on the stack. | 5735 * JavaScript frames remain on the stack. |
| 5732 * | 5736 * |
| 5733 * This method can be used by any thread even if that thread has not | 5737 * This method can be used by any thread even if that thread has not |
| 5734 * acquired the V8 lock with a Locker object. | 5738 * acquired the V8 lock with a Locker object. |
| 5735 * | 5739 * |
| 5736 * \param isolate The isolate in which to resume execution capability. | 5740 * \param isolate The isolate in which to resume execution capability. |
| 5737 */ | 5741 */ |
| 5738 // TODO(dcarney): deprecate this. | 5742 V8_INLINE static V8_DEPRECATE_SOON( |
| 5739 V8_INLINE static void CancelTerminateExecution(Isolate* isolate); | 5743 "Use isolate version", void CancelTerminateExecution(Isolate* isolate)); |
| 5740 | 5744 |
| 5741 /** | 5745 /** |
| 5742 * Releases any resources used by v8 and stops any utility threads | 5746 * Releases any resources used by v8 and stops any utility threads |
| 5743 * that may be running. Note that disposing v8 is permanent, it | 5747 * that may be running. Note that disposing v8 is permanent, it |
| 5744 * cannot be reinitialized. | 5748 * cannot be reinitialized. |
| 5745 * | 5749 * |
| 5746 * It should generally not be necessary to dispose v8 before exiting | 5750 * It should generally not be necessary to dispose v8 before exiting |
| 5747 * a process, this should happen automatically. It is only necessary | 5751 * a process, this should happen automatically. It is only necessary |
| 5748 * to use if the process needs the resources taken up by v8. | 5752 * to use if the process needs the resources taken up by v8. |
| 5749 */ | 5753 */ |
| 5750 static bool Dispose(); | 5754 static bool Dispose(); |
| 5751 | 5755 |
| 5752 /** | 5756 /** |
| 5753 * Iterates through all external resources referenced from current isolate | 5757 * Iterates through all external resources referenced from current isolate |
| 5754 * heap. GC is not invoked prior to iterating, therefore there is no | 5758 * heap. GC is not invoked prior to iterating, therefore there is no |
| 5755 * guarantee that visited objects are still alive. | 5759 * guarantee that visited objects are still alive. |
| 5756 */ | 5760 */ |
| 5757 // TODO(dcarney): deprecate this. | 5761 V8_INLINE static V8_DEPRECATE_SOON( |
| 5758 V8_INLINE static void VisitExternalResources( | 5762 "Use isoalte version", |
| 5759 ExternalResourceVisitor* visitor); | 5763 void VisitExternalResources(ExternalResourceVisitor* visitor)); |
| 5760 | 5764 |
| 5761 /** | 5765 /** |
| 5762 * Iterates through all the persistent handles in the current isolate's heap | 5766 * Iterates through all the persistent handles in the current isolate's heap |
| 5763 * that have class_ids. | 5767 * that have class_ids. |
| 5764 */ | 5768 */ |
| 5765 // TODO(dcarney): deprecate this. | 5769 V8_INLINE static V8_DEPRECATE_SOON( |
| 5766 V8_INLINE static void VisitHandlesWithClassIds( | 5770 "Use isolate version", |
| 5767 PersistentHandleVisitor* visitor); | 5771 void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor)); |
| 5768 | 5772 |
| 5769 /** | 5773 /** |
| 5770 * Iterates through all the persistent handles in isolate's heap that have | 5774 * Iterates through all the persistent handles in isolate's heap that have |
| 5771 * class_ids. | 5775 * class_ids. |
| 5772 */ | 5776 */ |
| 5773 // TODO(dcarney): deprecate this. | 5777 V8_INLINE static V8_DEPRECATE_SOON( |
| 5774 V8_INLINE static void VisitHandlesWithClassIds( | 5778 "Use isolate version", |
| 5775 Isolate* isolate, PersistentHandleVisitor* visitor); | 5779 void VisitHandlesWithClassIds(Isolate* isolate, |
| 5780 PersistentHandleVisitor* visitor)); |
| 5776 | 5781 |
| 5777 /** | 5782 /** |
| 5778 * Iterates through all the persistent handles in the current isolate's heap | 5783 * Iterates through all the persistent handles in the current isolate's heap |
| 5779 * that have class_ids and are candidates to be marked as partially dependent | 5784 * that have class_ids and are candidates to be marked as partially dependent |
| 5780 * handles. This will visit handles to young objects created since the last | 5785 * handles. This will visit handles to young objects created since the last |
| 5781 * garbage collection but is free to visit an arbitrary superset of these | 5786 * garbage collection but is free to visit an arbitrary superset of these |
| 5782 * objects. | 5787 * objects. |
| 5783 */ | 5788 */ |
| 5784 // TODO(dcarney): deprecate this. | 5789 V8_INLINE static V8_DEPRECATE_SOON( |
| 5785 V8_INLINE static void VisitHandlesForPartialDependence( | 5790 "Use isolate version", |
| 5786 Isolate* isolate, PersistentHandleVisitor* visitor); | 5791 void VisitHandlesForPartialDependence(Isolate* isolate, |
| 5792 PersistentHandleVisitor* visitor)); |
| 5787 | 5793 |
| 5788 /** | 5794 /** |
| 5789 * Initialize the ICU library bundled with V8. The embedder should only | 5795 * Initialize the ICU library bundled with V8. The embedder should only |
| 5790 * invoke this method when using the bundled ICU. Returns true on success. | 5796 * invoke this method when using the bundled ICU. Returns true on success. |
| 5791 * | 5797 * |
| 5792 * If V8 was compiled with the ICU data in an external file, the location | 5798 * If V8 was compiled with the ICU data in an external file, the location |
| 5793 * of the data file has to be provided. | 5799 * of the data file has to be provided. |
| 5794 */ | 5800 */ |
| 5795 static bool InitializeICU(const char* icu_data_file = NULL); | 5801 static bool InitializeICU(const char* icu_data_file = NULL); |
| 5796 | 5802 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5902 /** | 5908 /** |
| 5903 * An external exception handler. | 5909 * An external exception handler. |
| 5904 */ | 5910 */ |
| 5905 class V8_EXPORT TryCatch { | 5911 class V8_EXPORT TryCatch { |
| 5906 public: | 5912 public: |
| 5907 /** | 5913 /** |
| 5908 * Creates a new try/catch block and registers it with v8. Note that | 5914 * Creates a new try/catch block and registers it with v8. Note that |
| 5909 * all TryCatch blocks should be stack allocated because the memory | 5915 * all TryCatch blocks should be stack allocated because the memory |
| 5910 * location itself is compared against JavaScript try/catch blocks. | 5916 * location itself is compared against JavaScript try/catch blocks. |
| 5911 */ | 5917 */ |
| 5912 // TODO(dcarney): deprecate. | 5918 V8_DEPRECATE_SOON("Use isolate version", TryCatch()); |
| 5913 TryCatch(); | |
| 5914 | 5919 |
| 5915 /** | 5920 /** |
| 5916 * Creates a new try/catch block and registers it with v8. Note that | 5921 * Creates a new try/catch block and registers it with v8. Note that |
| 5917 * all TryCatch blocks should be stack allocated because the memory | 5922 * all TryCatch blocks should be stack allocated because the memory |
| 5918 * location itself is compared against JavaScript try/catch blocks. | 5923 * location itself is compared against JavaScript try/catch blocks. |
| 5919 */ | 5924 */ |
| 5920 TryCatch(Isolate* isolate); | 5925 TryCatch(Isolate* isolate); |
| 5921 | 5926 |
| 5922 /** | 5927 /** |
| 5923 * Unregisters and deletes this try/catch block. | 5928 * Unregisters and deletes this try/catch block. |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7775 */ | 7780 */ |
| 7776 | 7781 |
| 7777 | 7782 |
| 7778 } // namespace v8 | 7783 } // namespace v8 |
| 7779 | 7784 |
| 7780 | 7785 |
| 7781 #undef TYPE_CHECK | 7786 #undef TYPE_CHECK |
| 7782 | 7787 |
| 7783 | 7788 |
| 7784 #endif // V8_H_ | 7789 #endif // V8_H_ |
| OLD | NEW |