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

Side by Side Diff: src/d8.cc

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 months 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
« no previous file with comments | « src/d8.h ('k') | src/debug.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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 return false; 1399 return false;
1400 #endif // V8_SHARED 1400 #endif // V8_SHARED
1401 options.num_isolates++; 1401 options.num_isolates++;
1402 } else if (strcmp(argv[i], "-p") == 0) { 1402 } else if (strcmp(argv[i], "-p") == 0) {
1403 #ifdef V8_SHARED 1403 #ifdef V8_SHARED
1404 printf("D8 with shared library does not support multi-threading\n"); 1404 printf("D8 with shared library does not support multi-threading\n");
1405 return false; 1405 return false;
1406 #else 1406 #else
1407 options.num_parallel_files++; 1407 options.num_parallel_files++;
1408 #endif // V8_SHARED 1408 #endif // V8_SHARED
1409 } else if (strcmp(argv[i], "--dump-heap-constants") == 0) {
1410 #ifdef V8_SHARED
1411 printf("D8 with shared library does not support constant dumping\n");
1412 return false;
1413 #else
1414 options.dump_heap_constants = true;
1415 argv[i] = NULL;
1416 #endif
1417 } 1409 }
1418 #ifdef V8_SHARED 1410 #ifdef V8_SHARED
1419 else if (strcmp(argv[i], "--dump-counters") == 0) { 1411 else if (strcmp(argv[i], "--dump-counters") == 0) {
1420 printf("D8 with shared library does not include counters\n"); 1412 printf("D8 with shared library does not include counters\n");
1421 return false; 1413 return false;
1422 } else if (strcmp(argv[i], "--debugger") == 0) { 1414 } else if (strcmp(argv[i], "--debugger") == 0) {
1423 printf("Javascript debugger not included\n"); 1415 printf("Javascript debugger not included\n");
1424 return false; 1416 return false;
1425 } 1417 }
1426 #endif // V8_SHARED 1418 #endif // V8_SHARED
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 fake_argv[0] = NULL; 1553 fake_argv[0] = NULL;
1562 fake_argv[1] = strdup("--harmony-typed-arrays"); 1554 fake_argv[1] = strdup("--harmony-typed-arrays");
1563 fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg"); 1555 fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg");
1564 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); 1556 v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false);
1565 free(fake_argv[1]); 1557 free(fake_argv[1]);
1566 delete[] fake_argv; 1558 delete[] fake_argv;
1567 } 1559 }
1568 #endif 1560 #endif
1569 1561
1570 1562
1571 #ifndef V8_SHARED
1572 static void DumpHeapConstants(i::Isolate* isolate) {
1573 i::Heap* heap = isolate->heap();
1574
1575 // Dump the INSTANCE_TYPES table to the console.
1576 printf("# List of known V8 instance types.\n");
1577 #define DUMP_TYPE(T) printf(" %d: \"%s\",\n", i::T, #T);
1578 printf("INSTANCE_TYPES = {\n");
1579 INSTANCE_TYPE_LIST(DUMP_TYPE)
1580 printf("}\n");
1581 #undef DUMP_TYPE
1582
1583 // Dump the KNOWN_MAP table to the console.
1584 printf("\n# List of known V8 maps.\n");
1585 #define ROOT_LIST_CASE(type, name, camel_name) \
1586 if (n == NULL && o == heap->name()) n = #camel_name;
1587 #define STRUCT_LIST_CASE(upper_name, camel_name, name) \
1588 if (n == NULL && o == heap->name##_map()) n = #camel_name "Map";
1589 i::HeapObjectIterator it(heap->map_space());
1590 printf("KNOWN_MAPS = {\n");
1591 for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
1592 i::Map* m = i::Map::cast(o);
1593 const char* n = NULL;
1594 intptr_t p = reinterpret_cast<intptr_t>(m) & 0xfffff;
1595 int t = m->instance_type();
1596 ROOT_LIST(ROOT_LIST_CASE)
1597 STRUCT_LIST(STRUCT_LIST_CASE)
1598 if (n == NULL) continue;
1599 printf(" 0x%05" V8PRIxPTR ": (%d, \"%s\"),\n", p, t, n);
1600 }
1601 printf("}\n");
1602 #undef STRUCT_LIST_CASE
1603 #undef ROOT_LIST_CASE
1604
1605 // Dump the KNOWN_OBJECTS table to the console.
1606 printf("\n# List of known V8 objects.\n");
1607 #define ROOT_LIST_CASE(type, name, camel_name) \
1608 if (n == NULL && o == heap->name()) n = #camel_name;
1609 i::OldSpaces spit(heap);
1610 printf("KNOWN_OBJECTS = {\n");
1611 for (i::PagedSpace* s = spit.next(); s != NULL; s = spit.next()) {
1612 i::HeapObjectIterator it(s);
1613 const char* sname = AllocationSpaceName(s->identity());
1614 for (i::Object* o = it.Next(); o != NULL; o = it.Next()) {
1615 const char* n = NULL;
1616 intptr_t p = reinterpret_cast<intptr_t>(o) & 0xfffff;
1617 ROOT_LIST(ROOT_LIST_CASE)
1618 if (n == NULL) continue;
1619 printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n);
1620 }
1621 }
1622 printf("}\n");
1623 #undef ROOT_LIST_CASE
1624 }
1625 #endif // V8_SHARED
1626
1627
1628 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 1563 class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
1629 public: 1564 public:
1630 virtual void* Allocate(size_t length) { 1565 virtual void* Allocate(size_t length) {
1631 void* result = malloc(length); 1566 void* result = malloc(length);
1632 memset(result, 0, length); 1567 memset(result, 0, length);
1633 return result; 1568 return result;
1634 } 1569 }
1635 virtual void* AllocateUninitialized(size_t length) { 1570 virtual void* AllocateUninitialized(size_t length) {
1636 return malloc(length); 1571 return malloc(length);
1637 } 1572 }
(...skipping 23 matching lines...) Expand all
1661 Isolate* isolate = Isolate::GetCurrent(); 1596 Isolate* isolate = Isolate::GetCurrent();
1662 DumbLineEditor dumb_line_editor(isolate); 1597 DumbLineEditor dumb_line_editor(isolate);
1663 { 1598 {
1664 Initialize(isolate); 1599 Initialize(isolate);
1665 #ifdef ENABLE_VTUNE_JIT_INTERFACE 1600 #ifdef ENABLE_VTUNE_JIT_INTERFACE
1666 vTune::InitializeVtuneForV8(); 1601 vTune::InitializeVtuneForV8();
1667 #endif 1602 #endif
1668 PerIsolateData data(isolate); 1603 PerIsolateData data(isolate);
1669 InitializeDebugger(isolate); 1604 InitializeDebugger(isolate);
1670 1605
1671 #ifndef V8_SHARED
1672 if (options.dump_heap_constants) {
1673 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate));
1674 return 0;
1675 }
1676 #endif
1677
1678 if (options.stress_opt || options.stress_deopt) { 1606 if (options.stress_opt || options.stress_deopt) {
1679 Testing::SetStressRunType(options.stress_opt 1607 Testing::SetStressRunType(options.stress_opt
1680 ? Testing::kStressTypeOpt 1608 ? Testing::kStressTypeOpt
1681 : Testing::kStressTypeDeopt); 1609 : Testing::kStressTypeDeopt);
1682 int stress_runs = Testing::GetStressRuns(); 1610 int stress_runs = Testing::GetStressRuns();
1683 for (int i = 0; i < stress_runs && result == 0; i++) { 1611 for (int i = 0; i < stress_runs && result == 0; i++) {
1684 printf("============ Stress %d/%d ============\n", i + 1, stress_runs); 1612 printf("============ Stress %d/%d ============\n", i + 1, stress_runs);
1685 Testing::PrepareStressRun(i); 1613 Testing::PrepareStressRun(i);
1686 options.last_run = (i == stress_runs - 1); 1614 options.last_run = (i == stress_runs - 1);
1687 result = RunMain(isolate, argc, argv); 1615 result = RunMain(isolate, argc, argv);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 } 1660 }
1733 1661
1734 } // namespace v8 1662 } // namespace v8
1735 1663
1736 1664
1737 #ifndef GOOGLE3 1665 #ifndef GOOGLE3
1738 int main(int argc, char* argv[]) { 1666 int main(int argc, char* argv[]) {
1739 return v8::Shell::Main(argc, argv); 1667 return v8::Shell::Main(argc, argv);
1740 } 1668 }
1741 #endif 1669 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698