Changeset 115579 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Apr 28, 2012, 1:51:27 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r115523 r115579 81 81 using namespace WTF; 82 82 83 static void cleanupGlobalData(JSGlobalData*);84 83 static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer); 85 84 … … 418 417 } 419 418 420 EncodedJSValue JSC_HOST_CALL functionQuit(ExecState* exec) 421 { 422 // Technically, destroying the heap in the middle of JS execution is a no-no, 423 // but we want to maintain compatibility with the Mozilla test suite, so 424 // we pretend that execution has terminated to avoid ASSERTs, then tear down the heap. 425 exec->globalData().dynamicGlobalObject = 0; 426 427 cleanupGlobalData(&exec->globalData()); 419 EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*) 420 { 428 421 exit(EXIT_SUCCESS); 429 422 … … 447 440 #endif 448 441 449 int jscmain(int argc, char** argv , JSGlobalData*);442 int jscmain(int argc, char** argv); 450 443 451 444 int main(int argc, char** argv) … … 492 485 // Structured Exception Handling 493 486 int res = 0; 494 JSGlobalData* globalData = JSGlobalData::create(ThreadStackTypeLarge, LargeHeap).leakRef();495 487 TRY 496 res = jscmain(argc, argv , globalData);488 res = jscmain(argc, argv); 497 489 EXCEPT(res = 3) 498 499 cleanupGlobalData(globalData);500 490 return res; 501 }502 503 static void cleanupGlobalData(JSGlobalData* globalData)504 {505 JSLock lock(SilenceAssertionsOnly);506 globalData->clearBuiltinStructures();507 globalData->heap.destroy();508 globalData->deref();509 491 } 510 492 … … 614 596 } 615 597 616 static NO_RETURN void printUsageStatement( JSGlobalData* globalData,bool help = false)598 static NO_RETURN void printUsageStatement(bool help = false) 617 599 { 618 600 fprintf(stderr, "Usage: jsc [options] [files] [-- arguments]\n"); … … 626 608 #endif 627 609 628 cleanupGlobalData(globalData);629 610 exit(help ? EXIT_SUCCESS : EXIT_FAILURE); 630 611 } 631 612 632 static void parseArguments(int argc, char** argv, CommandLine& options , JSGlobalData* globalData)613 static void parseArguments(int argc, char** argv, CommandLine& options) 633 614 { 634 615 int i = 1; … … 637 618 if (!strcmp(arg, "-f")) { 638 619 if (++i == argc) 639 printUsageStatement( globalData);620 printUsageStatement(); 640 621 options.scripts.append(Script(true, argv[i])); 641 622 continue; … … 643 624 if (!strcmp(arg, "-e")) { 644 625 if (++i == argc) 645 printUsageStatement( globalData);626 printUsageStatement(); 646 627 options.scripts.append(Script(false, argv[i])); 647 628 continue; … … 669 650 } 670 651 if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) 671 printUsageStatement( globalData,true);652 printUsageStatement(true); 672 653 options.scripts.append(Script(true, argv[i])); 673 654 } … … 680 661 } 681 662 682 int jscmain(int argc, char** argv , JSGlobalData* globalData)663 int jscmain(int argc, char** argv) 683 664 { 684 665 JSLock lock(SilenceAssertionsOnly); 685 666 667 RefPtr<JSGlobalData> globalData = JSGlobalData::create(ThreadStackTypeLarge, LargeHeap); 668 686 669 CommandLine options; 687 parseArguments(argc, argv, options , globalData);670 parseArguments(argc, argv, options); 688 671 689 672 GlobalObject* globalObject = GlobalObject::create(*globalData, GlobalObject::createStructure(*globalData, jsNull()), options.arguments);
Note:
See TracChangeset
for help on using the changeset viewer.