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

Side by Side Diff: src/d8.cc

Issue 62283010: Remove preemption thread and API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« include/v8.h ('K') | « src/d8.h ('k') | src/execution.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 options.stress_deopt = false; 1367 options.stress_deopt = false;
1368 } else if (strcmp(argv[i], "--shell") == 0) { 1368 } else if (strcmp(argv[i], "--shell") == 0) {
1369 options.interactive_shell = true; 1369 options.interactive_shell = true;
1370 argv[i] = NULL; 1370 argv[i] = NULL;
1371 } else if (strcmp(argv[i], "--test") == 0) { 1371 } else if (strcmp(argv[i], "--test") == 0) {
1372 options.test_shell = true; 1372 options.test_shell = true;
1373 argv[i] = NULL; 1373 argv[i] = NULL;
1374 } else if (strcmp(argv[i], "--send-idle-notification") == 0) { 1374 } else if (strcmp(argv[i], "--send-idle-notification") == 0) {
1375 options.send_idle_notification = true; 1375 options.send_idle_notification = true;
1376 argv[i] = NULL; 1376 argv[i] = NULL;
1377 } else if (strcmp(argv[i], "--preemption") == 0) {
1378 #ifdef V8_SHARED
1379 printf("D8 with shared library does not support multi-threading\n");
1380 return false;
1381 #else
1382 options.use_preemption = true;
1383 argv[i] = NULL;
1384 #endif // V8_SHARED
1385 } else if (strcmp(argv[i], "--nopreemption") == 0) {
1386 #ifdef V8_SHARED
1387 printf("D8 with shared library does not support multi-threading\n");
1388 return false;
1389 #else
1390 options.use_preemption = false;
1391 argv[i] = NULL;
1392 #endif // V8_SHARED
1393 } else if (strcmp(argv[i], "--preemption-interval") == 0) {
1394 #ifdef V8_SHARED
1395 printf("D8 with shared library does not support multi-threading\n");
1396 return false;
1397 #else
1398 if (++i < argc) {
1399 argv[i-1] = NULL;
1400 char* end = NULL;
1401 options.preemption_interval = strtol(argv[i], &end, 10); // NOLINT
1402 if (options.preemption_interval <= 0
1403 || *end != '\0'
1404 || errno == ERANGE) {
1405 printf("Invalid value for --preemption-interval '%s'\n", argv[i]);
1406 return false;
1407 }
1408 argv[i] = NULL;
1409 } else {
1410 printf("Missing value for --preemption-interval\n");
1411 return false;
1412 }
1413 #endif // V8_SHARED
1414 } else if (strcmp(argv[i], "-f") == 0) { 1377 } else if (strcmp(argv[i], "-f") == 0) {
1415 // Ignore any -f flags for compatibility with other stand-alone 1378 // Ignore any -f flags for compatibility with other stand-alone
1416 // JavaScript engines. 1379 // JavaScript engines.
1417 continue; 1380 continue;
1418 } else if (strcmp(argv[i], "--isolate") == 0) { 1381 } else if (strcmp(argv[i], "--isolate") == 0) {
1419 #ifdef V8_SHARED 1382 #ifdef V8_SHARED
1420 printf("D8 with shared library does not support multi-threading\n"); 1383 printf("D8 with shared library does not support multi-threading\n");
1421 return false; 1384 return false;
1422 #endif // V8_SHARED 1385 #endif // V8_SHARED
1423 options.num_isolates++; 1386 options.num_isolates++;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 options.isolate_sources[0].Execute(isolate); 1505 options.isolate_sources[0].Execute(isolate);
1543 } 1506 }
1544 } 1507 }
1545 if (!options.last_run) { 1508 if (!options.last_run) {
1546 if (options.send_idle_notification) { 1509 if (options.send_idle_notification) {
1547 const int kLongIdlePauseInMs = 1000; 1510 const int kLongIdlePauseInMs = 1000;
1548 V8::ContextDisposedNotification(); 1511 V8::ContextDisposedNotification();
1549 V8::IdleNotification(kLongIdlePauseInMs); 1512 V8::IdleNotification(kLongIdlePauseInMs);
1550 } 1513 }
1551 } 1514 }
1552
1553 #ifndef V8_SHARED
1554 // Start preemption if threads have been created and preemption is enabled.
1555 if (threads.length() > 0
1556 && options.use_preemption) {
1557 Locker::StartPreemption(isolate, options.preemption_interval);
1558 }
1559 #endif // V8_SHARED
1560 } 1515 }
1561 1516
1562 #ifndef V8_SHARED 1517 #ifndef V8_SHARED
1563 for (int i = 1; i < options.num_isolates; ++i) { 1518 for (int i = 1; i < options.num_isolates; ++i) {
1564 options.isolate_sources[i].WaitForThread(); 1519 options.isolate_sources[i].WaitForThread();
1565 } 1520 }
1566 1521
1567 for (int i = 0; i < threads.length(); i++) { 1522 for (int i = 0; i < threads.length(); i++) {
1568 i::Thread* thread = threads[i]; 1523 i::Thread* thread = threads[i];
1569 thread->Join(); 1524 thread->Join();
1570 delete thread; 1525 delete thread;
1571 } 1526 }
1572
1573 if (threads.length() > 0 && options.use_preemption) {
1574 Locker lock(isolate);
1575 Locker::StopPreemption(isolate);
1576 }
1577 #endif // V8_SHARED 1527 #endif // V8_SHARED
1578 return 0; 1528 return 0;
1579 } 1529 }
1580 1530
1581 1531
1582 #ifdef V8_SHARED 1532 #ifdef V8_SHARED
1583 static void SetStandaloneFlagsViaCommandLine() { 1533 static void SetStandaloneFlagsViaCommandLine() {
1584 int fake_argc = 2; 1534 int fake_argc = 2;
1585 char **fake_argv = new char*[2]; 1535 char **fake_argv = new char*[2];
1586 fake_argv[0] = NULL; 1536 fake_argv[0] = NULL;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 } 1711 }
1762 1712
1763 } // namespace v8 1713 } // namespace v8
1764 1714
1765 1715
1766 #ifndef GOOGLE3 1716 #ifndef GOOGLE3
1767 int main(int argc, char* argv[]) { 1717 int main(int argc, char* argv[]) {
1768 return v8::Shell::Main(argc, argv); 1718 return v8::Shell::Main(argc, argv);
1769 } 1719 }
1770 #endif 1720 #endif
OLDNEW
« include/v8.h ('K') | « src/d8.h ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698