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

Side by Side Diff: test/cctest/test-api.cc

Issue 23534067: bulk replace Isolate::Current in tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-arm.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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 CHECK(source->IsExternal()); 519 CHECK(source->IsExternal());
520 CHECK_EQ(resource, 520 CHECK_EQ(resource,
521 static_cast<TestResource*>(source->GetExternalStringResource())); 521 static_cast<TestResource*>(source->GetExternalStringResource()));
522 String::Encoding encoding = String::UNKNOWN_ENCODING; 522 String::Encoding encoding = String::UNKNOWN_ENCODING;
523 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource), 523 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
524 source->GetExternalStringResourceBase(&encoding)); 524 source->GetExternalStringResourceBase(&encoding));
525 CHECK_EQ(String::TWO_BYTE_ENCODING, encoding); 525 CHECK_EQ(String::TWO_BYTE_ENCODING, encoding);
526 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 526 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
527 CHECK_EQ(0, dispose_count); 527 CHECK_EQ(0, dispose_count);
528 } 528 }
529 v8::internal::Isolate::Current()->compilation_cache()->Clear(); 529 CcTest::i_isolate()->compilation_cache()->Clear();
530 HEAP->CollectAllAvailableGarbage(); 530 HEAP->CollectAllAvailableGarbage();
531 CHECK_EQ(1, dispose_count); 531 CHECK_EQ(1, dispose_count);
532 } 532 }
533 533
534 534
535 THREADED_TEST(ScriptUsingAsciiStringResource) { 535 THREADED_TEST(ScriptUsingAsciiStringResource) {
536 int dispose_count = 0; 536 int dispose_count = 0;
537 const char* c_source = "1 + 2 * 3"; 537 const char* c_source = "1 + 2 * 3";
538 { 538 {
539 LocalContext env; 539 LocalContext env;
540 v8::HandleScope scope(env->GetIsolate()); 540 v8::HandleScope scope(env->GetIsolate());
541 TestAsciiResource* resource = new TestAsciiResource(i::StrDup(c_source), 541 TestAsciiResource* resource = new TestAsciiResource(i::StrDup(c_source),
542 &dispose_count); 542 &dispose_count);
543 Local<String> source = String::NewExternal(resource); 543 Local<String> source = String::NewExternal(resource);
544 CHECK(source->IsExternalAscii()); 544 CHECK(source->IsExternalAscii());
545 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource), 545 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
546 source->GetExternalAsciiStringResource()); 546 source->GetExternalAsciiStringResource());
547 String::Encoding encoding = String::UNKNOWN_ENCODING; 547 String::Encoding encoding = String::UNKNOWN_ENCODING;
548 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource), 548 CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
549 source->GetExternalStringResourceBase(&encoding)); 549 source->GetExternalStringResourceBase(&encoding));
550 CHECK_EQ(String::ASCII_ENCODING, encoding); 550 CHECK_EQ(String::ASCII_ENCODING, encoding);
551 Local<Script> script = Script::Compile(source); 551 Local<Script> script = Script::Compile(source);
552 Local<Value> value = script->Run(); 552 Local<Value> value = script->Run();
553 CHECK(value->IsNumber()); 553 CHECK(value->IsNumber());
554 CHECK_EQ(7, value->Int32Value()); 554 CHECK_EQ(7, value->Int32Value());
555 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 555 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
556 CHECK_EQ(0, dispose_count); 556 CHECK_EQ(0, dispose_count);
557 } 557 }
558 i::Isolate::Current()->compilation_cache()->Clear(); 558 CcTest::i_isolate()->compilation_cache()->Clear();
559 HEAP->CollectAllAvailableGarbage(); 559 HEAP->CollectAllAvailableGarbage();
560 CHECK_EQ(1, dispose_count); 560 CHECK_EQ(1, dispose_count);
561 } 561 }
562 562
563 563
564 THREADED_TEST(ScriptMakingExternalString) { 564 THREADED_TEST(ScriptMakingExternalString) {
565 int dispose_count = 0; 565 int dispose_count = 0;
566 uint16_t* two_byte_source = AsciiToTwoByteString("1 + 2 * 3"); 566 uint16_t* two_byte_source = AsciiToTwoByteString("1 + 2 * 3");
567 { 567 {
568 LocalContext env; 568 LocalContext env;
(...skipping 10 matching lines...) Expand all
579 bool success = source->MakeExternal(new TestResource(two_byte_source, 579 bool success = source->MakeExternal(new TestResource(two_byte_source,
580 &dispose_count)); 580 &dispose_count));
581 CHECK(success); 581 CHECK(success);
582 Local<Script> script = Script::Compile(source); 582 Local<Script> script = Script::Compile(source);
583 Local<Value> value = script->Run(); 583 Local<Value> value = script->Run();
584 CHECK(value->IsNumber()); 584 CHECK(value->IsNumber());
585 CHECK_EQ(7, value->Int32Value()); 585 CHECK_EQ(7, value->Int32Value());
586 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 586 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
587 CHECK_EQ(0, dispose_count); 587 CHECK_EQ(0, dispose_count);
588 } 588 }
589 i::Isolate::Current()->compilation_cache()->Clear(); 589 CcTest::i_isolate()->compilation_cache()->Clear();
590 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 590 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
591 CHECK_EQ(1, dispose_count); 591 CHECK_EQ(1, dispose_count);
592 } 592 }
593 593
594 594
595 THREADED_TEST(ScriptMakingExternalAsciiString) { 595 THREADED_TEST(ScriptMakingExternalAsciiString) {
596 int dispose_count = 0; 596 int dispose_count = 0;
597 const char* c_source = "1 + 2 * 3"; 597 const char* c_source = "1 + 2 * 3";
598 { 598 {
599 LocalContext env; 599 LocalContext env;
600 v8::HandleScope scope(env->GetIsolate()); 600 v8::HandleScope scope(env->GetIsolate());
601 Local<String> source = v8_str(c_source); 601 Local<String> source = v8_str(c_source);
602 // Trigger GCs so that the newly allocated string moves to old gen. 602 // Trigger GCs so that the newly allocated string moves to old gen.
603 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now 603 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
604 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now 604 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
605 bool success = source->MakeExternal( 605 bool success = source->MakeExternal(
606 new TestAsciiResource(i::StrDup(c_source), &dispose_count)); 606 new TestAsciiResource(i::StrDup(c_source), &dispose_count));
607 CHECK(success); 607 CHECK(success);
608 Local<Script> script = Script::Compile(source); 608 Local<Script> script = Script::Compile(source);
609 Local<Value> value = script->Run(); 609 Local<Value> value = script->Run();
610 CHECK(value->IsNumber()); 610 CHECK(value->IsNumber());
611 CHECK_EQ(7, value->Int32Value()); 611 CHECK_EQ(7, value->Int32Value());
612 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 612 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
613 CHECK_EQ(0, dispose_count); 613 CHECK_EQ(0, dispose_count);
614 } 614 }
615 i::Isolate::Current()->compilation_cache()->Clear(); 615 CcTest::i_isolate()->compilation_cache()->Clear();
616 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); 616 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
617 CHECK_EQ(1, dispose_count); 617 CHECK_EQ(1, dispose_count);
618 } 618 }
619 619
620 620
621 TEST(MakingExternalStringConditions) { 621 TEST(MakingExternalStringConditions) {
622 LocalContext env; 622 LocalContext env;
623 v8::HandleScope scope(env->GetIsolate()); 623 v8::HandleScope scope(env->GetIsolate());
624 624
625 // Free some space in the new space so that we can check freshness. 625 // Free some space in the new space so that we can check freshness.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 new TestAsciiResource(i::StrDup(c_slice) + 1, &dispose_count)); 730 new TestAsciiResource(i::StrDup(c_slice) + 1, &dispose_count));
731 CHECK(success); 731 CHECK(success);
732 732
733 // Trigger GCs and force evacuation. 733 // Trigger GCs and force evacuation.
734 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 734 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
735 HEAP->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); 735 HEAP->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask);
736 } 736 }
737 737
738 738
739 THREADED_TEST(UsingExternalString) { 739 THREADED_TEST(UsingExternalString) {
740 i::Factory* factory = i::Isolate::Current()->factory(); 740 i::Factory* factory = CcTest::i_isolate()->factory();
741 { 741 {
742 v8::HandleScope scope(CcTest::isolate()); 742 v8::HandleScope scope(CcTest::isolate());
743 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); 743 uint16_t* two_byte_string = AsciiToTwoByteString("test string");
744 Local<String> string = 744 Local<String> string =
745 String::NewExternal(new TestResource(two_byte_string)); 745 String::NewExternal(new TestResource(two_byte_string));
746 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); 746 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
747 // Trigger GCs so that the newly allocated string moves to old gen. 747 // Trigger GCs so that the newly allocated string moves to old gen.
748 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now 748 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
749 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now 749 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
750 i::Handle<i::String> isymbol = 750 i::Handle<i::String> isymbol =
751 factory->InternalizedStringFromString(istring); 751 factory->InternalizedStringFromString(istring);
752 CHECK(isymbol->IsInternalizedString()); 752 CHECK(isymbol->IsInternalizedString());
753 } 753 }
754 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 754 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
755 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 755 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
756 } 756 }
757 757
758 758
759 THREADED_TEST(UsingExternalAsciiString) { 759 THREADED_TEST(UsingExternalAsciiString) {
760 i::Factory* factory = i::Isolate::Current()->factory(); 760 i::Factory* factory = CcTest::i_isolate()->factory();
761 { 761 {
762 v8::HandleScope scope(CcTest::isolate()); 762 v8::HandleScope scope(CcTest::isolate());
763 const char* one_byte_string = "test string"; 763 const char* one_byte_string = "test string";
764 Local<String> string = String::NewExternal( 764 Local<String> string = String::NewExternal(
765 new TestAsciiResource(i::StrDup(one_byte_string))); 765 new TestAsciiResource(i::StrDup(one_byte_string)));
766 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); 766 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
767 // Trigger GCs so that the newly allocated string moves to old gen. 767 // Trigger GCs so that the newly allocated string moves to old gen.
768 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now 768 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
769 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now 769 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
770 i::Handle<i::String> isymbol = 770 i::Handle<i::String> isymbol =
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 LocalContext env; 853 LocalContext env;
854 v8::HandleScope scope(env->GetIsolate()); 854 v8::HandleScope scope(env->GetIsolate());
855 Local<String> source = String::NewExternal(&res_stack); 855 Local<String> source = String::NewExternal(&res_stack);
856 Local<Script> script = Script::Compile(source); 856 Local<Script> script = Script::Compile(source);
857 Local<Value> value = script->Run(); 857 Local<Value> value = script->Run();
858 CHECK(value->IsNumber()); 858 CHECK(value->IsNumber());
859 CHECK_EQ(7, value->Int32Value()); 859 CHECK_EQ(7, value->Int32Value());
860 HEAP->CollectAllAvailableGarbage(); 860 HEAP->CollectAllAvailableGarbage();
861 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count); 861 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count);
862 } 862 }
863 i::Isolate::Current()->compilation_cache()->Clear(); 863 CcTest::i_isolate()->compilation_cache()->Clear();
864 HEAP->CollectAllAvailableGarbage(); 864 HEAP->CollectAllAvailableGarbage();
865 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); 865 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
866 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count); 866 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count);
867 867
868 // Use a heap allocated external string resource allocated object. 868 // Use a heap allocated external string resource allocated object.
869 TestAsciiResourceWithDisposeControl::dispose_count = 0; 869 TestAsciiResourceWithDisposeControl::dispose_count = 0;
870 TestAsciiResourceWithDisposeControl::dispose_calls = 0; 870 TestAsciiResourceWithDisposeControl::dispose_calls = 0;
871 TestAsciiResource* res_heap = 871 TestAsciiResource* res_heap =
872 new TestAsciiResourceWithDisposeControl(i::StrDup(c_source), true); 872 new TestAsciiResourceWithDisposeControl(i::StrDup(c_source), true);
873 { 873 {
874 LocalContext env; 874 LocalContext env;
875 v8::HandleScope scope(env->GetIsolate()); 875 v8::HandleScope scope(env->GetIsolate());
876 Local<String> source = String::NewExternal(res_heap); 876 Local<String> source = String::NewExternal(res_heap);
877 Local<Script> script = Script::Compile(source); 877 Local<Script> script = Script::Compile(source);
878 Local<Value> value = script->Run(); 878 Local<Value> value = script->Run();
879 CHECK(value->IsNumber()); 879 CHECK(value->IsNumber());
880 CHECK_EQ(7, value->Int32Value()); 880 CHECK_EQ(7, value->Int32Value());
881 HEAP->CollectAllAvailableGarbage(); 881 HEAP->CollectAllAvailableGarbage();
882 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count); 882 CHECK_EQ(0, TestAsciiResourceWithDisposeControl::dispose_count);
883 } 883 }
884 i::Isolate::Current()->compilation_cache()->Clear(); 884 CcTest::i_isolate()->compilation_cache()->Clear();
885 HEAP->CollectAllAvailableGarbage(); 885 HEAP->CollectAllAvailableGarbage();
886 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls); 886 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
887 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_count); 887 CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_count);
888 } 888 }
889 889
890 890
891 THREADED_TEST(StringConcat) { 891 THREADED_TEST(StringConcat) {
892 { 892 {
893 LocalContext env; 893 LocalContext env;
894 v8::HandleScope scope(env->GetIsolate()); 894 v8::HandleScope scope(env->GetIsolate());
(...skipping 26 matching lines...) Expand all
921 921
922 source = String::Concat(source, right); 922 source = String::Concat(source, right);
923 right = String::NewExternal( 923 right = String::NewExternal(
924 new TestResource(AsciiToTwoByteString(two_byte_extern_2))); 924 new TestResource(AsciiToTwoByteString(two_byte_extern_2)));
925 source = String::Concat(source, right); 925 source = String::Concat(source, right);
926 Local<Script> script = Script::Compile(source); 926 Local<Script> script = Script::Compile(source);
927 Local<Value> value = script->Run(); 927 Local<Value> value = script->Run();
928 CHECK(value->IsNumber()); 928 CHECK(value->IsNumber());
929 CHECK_EQ(68, value->Int32Value()); 929 CHECK_EQ(68, value->Int32Value());
930 } 930 }
931 i::Isolate::Current()->compilation_cache()->Clear(); 931 CcTest::i_isolate()->compilation_cache()->Clear();
932 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 932 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
933 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 933 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
934 } 934 }
935 935
936 936
937 THREADED_TEST(GlobalProperties) { 937 THREADED_TEST(GlobalProperties) {
938 LocalContext env; 938 LocalContext env;
939 v8::HandleScope scope(env->GetIsolate()); 939 v8::HandleScope scope(env->GetIsolate());
940 v8::Handle<v8::Object> global = env->Global(); 940 v8::Handle<v8::Object> global = env->Global();
941 global->Set(v8_str("pi"), v8_num(3.1415926)); 941 global->Set(v8_str("pi"), v8_num(3.1415926));
(...skipping 3723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4665 args[1], 4665 args[1],
4666 args[2], 4666 args[2],
4667 args[3] }; 4667 args[3] };
4668 if (count % cInterval == 0) { 4668 if (count % cInterval == 0) {
4669 v8::TryCatch try_catch; 4669 v8::TryCatch try_catch;
4670 Local<Value> result = fun.As<Function>()->Call(global, 4, argv); 4670 Local<Value> result = fun.As<Function>()->Call(global, 4, argv);
4671 int expected = args[3]->Int32Value(); 4671 int expected = args[3]->Int32Value();
4672 if (try_catch.HasCaught()) { 4672 if (try_catch.HasCaught()) {
4673 CHECK_EQ(expected, count); 4673 CHECK_EQ(expected, count);
4674 CHECK(result.IsEmpty()); 4674 CHECK(result.IsEmpty());
4675 CHECK(!i::Isolate::Current()->has_scheduled_exception()); 4675 CHECK(!CcTest::i_isolate()->has_scheduled_exception());
4676 } else { 4676 } else {
4677 CHECK_NE(expected, count); 4677 CHECK_NE(expected, count);
4678 } 4678 }
4679 args.GetReturnValue().Set(result); 4679 args.GetReturnValue().Set(result);
4680 return; 4680 return;
4681 } else { 4681 } else {
4682 args.GetReturnValue().Set(fun.As<Function>()->Call(global, 4, argv)); 4682 args.GetReturnValue().Set(fun.As<Function>()->Call(global, 4, argv));
4683 return; 4683 return;
4684 } 4684 }
4685 } 4685 }
(...skipping 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after
9677 9677
9678 Local<v8::Object> o0 = t->GetFunction()->NewInstance(); 9678 Local<v8::Object> o0 = t->GetFunction()->NewInstance();
9679 Local<v8::Object> o1 = t->GetFunction()->NewInstance(); 9679 Local<v8::Object> o1 = t->GetFunction()->NewInstance();
9680 9680
9681 CHECK(o0->SetPrototype(o1)); 9681 CHECK(o0->SetPrototype(o1));
9682 // If setting the prototype leads to the cycle, SetPrototype should 9682 // If setting the prototype leads to the cycle, SetPrototype should
9683 // return false and keep VM in sane state. 9683 // return false and keep VM in sane state.
9684 v8::TryCatch try_catch; 9684 v8::TryCatch try_catch;
9685 CHECK(!o1->SetPrototype(o0)); 9685 CHECK(!o1->SetPrototype(o0));
9686 CHECK(!try_catch.HasCaught()); 9686 CHECK(!try_catch.HasCaught());
9687 ASSERT(!i::Isolate::Current()->has_pending_exception()); 9687 ASSERT(!CcTest::i_isolate()->has_pending_exception());
9688 9688
9689 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); 9689 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value());
9690 } 9690 }
9691 9691
9692 9692
9693 THREADED_TEST(FunctionRemovePrototype) { 9693 THREADED_TEST(FunctionRemovePrototype) {
9694 LocalContext context; 9694 LocalContext context;
9695 v8::HandleScope handle_scope(context->GetIsolate()); 9695 v8::HandleScope handle_scope(context->GetIsolate());
9696 9696
9697 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); 9697 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New();
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
12098 12098
12099 12099
12100 static void ThrowingCallbackWithTryCatch( 12100 static void ThrowingCallbackWithTryCatch(
12101 const v8::FunctionCallbackInfo<v8::Value>& args) { 12101 const v8::FunctionCallbackInfo<v8::Value>& args) {
12102 TryCatch try_catch; 12102 TryCatch try_catch;
12103 // Verboseness is important: it triggers message delivery which can call into 12103 // Verboseness is important: it triggers message delivery which can call into
12104 // external code. 12104 // external code.
12105 try_catch.SetVerbose(true); 12105 try_catch.SetVerbose(true);
12106 CompileRun("throw 'from JS';"); 12106 CompileRun("throw 'from JS';");
12107 CHECK(try_catch.HasCaught()); 12107 CHECK(try_catch.HasCaught());
12108 CHECK(!i::Isolate::Current()->has_pending_exception()); 12108 CHECK(!CcTest::i_isolate()->has_pending_exception());
12109 CHECK(!i::Isolate::Current()->has_scheduled_exception()); 12109 CHECK(!CcTest::i_isolate()->has_scheduled_exception());
12110 } 12110 }
12111 12111
12112 12112
12113 static int call_depth; 12113 static int call_depth;
12114 12114
12115 12115
12116 static void WithTryCatch(Handle<Message> message, Handle<Value> data) { 12116 static void WithTryCatch(Handle<Message> message, Handle<Value> data) {
12117 TryCatch try_catch; 12117 TryCatch try_catch;
12118 } 12118 }
12119 12119
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
12604 Local<Script> script = v8_compile("(function () {" 12604 Local<Script> script = v8_compile("(function () {"
12605 " unlock_for_a_moment();" 12605 " unlock_for_a_moment();"
12606 " return 42;" 12606 " return 42;"
12607 "})();"); 12607 "})();");
12608 CHECK_EQ(42, script->Run()->Int32Value()); 12608 CHECK_EQ(42, script->Run()->Int32Value());
12609 } 12609 }
12610 } 12610 }
12611 12611
12612 12612
12613 static int GetGlobalObjectsCount() { 12613 static int GetGlobalObjectsCount() {
12614 i::Isolate::Current()->heap()->EnsureHeapIsIterable(); 12614 CcTest::i_isolate()->heap()->EnsureHeapIsIterable();
12615 int count = 0; 12615 int count = 0;
12616 i::HeapIterator it(HEAP); 12616 i::HeapIterator it(HEAP);
12617 for (i::HeapObject* object = it.next(); object != NULL; object = it.next()) 12617 for (i::HeapObject* object = it.next(); object != NULL; object = it.next())
12618 if (object->IsJSGlobalObject()) count++; 12618 if (object->IsJSGlobalObject()) count++;
12619 return count; 12619 return count;
12620 } 12620 }
12621 12621
12622 12622
12623 static void CheckSurvivingGlobalObjectsCount(int expected) { 12623 static void CheckSurvivingGlobalObjectsCount(int expected) {
12624 // We need to collect all garbage twice to be sure that everything 12624 // We need to collect all garbage twice to be sure that everything
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after
14525 14525
14526 // Test that we can still flatten a string if the components it is built up 14526 // Test that we can still flatten a string if the components it is built up
14527 // from have been turned into 16 bit strings in the mean time. 14527 // from have been turned into 16 bit strings in the mean time.
14528 THREADED_TEST(MorphCompositeStringTest) { 14528 THREADED_TEST(MorphCompositeStringTest) {
14529 char utf_buffer[129]; 14529 char utf_buffer[129];
14530 const char* c_string = "Now is the time for all good men" 14530 const char* c_string = "Now is the time for all good men"
14531 " to come to the aid of the party"; 14531 " to come to the aid of the party";
14532 uint16_t* two_byte_string = AsciiToTwoByteString(c_string); 14532 uint16_t* two_byte_string = AsciiToTwoByteString(c_string);
14533 { 14533 {
14534 LocalContext env; 14534 LocalContext env;
14535 i::Factory* factory = i::Isolate::Current()->factory(); 14535 i::Factory* factory = CcTest::i_isolate()->factory();
14536 v8::HandleScope scope(env->GetIsolate()); 14536 v8::HandleScope scope(env->GetIsolate());
14537 AsciiVectorResource ascii_resource( 14537 AsciiVectorResource ascii_resource(
14538 i::Vector<const char>(c_string, i::StrLength(c_string))); 14538 i::Vector<const char>(c_string, i::StrLength(c_string)));
14539 UC16VectorResource uc16_resource( 14539 UC16VectorResource uc16_resource(
14540 i::Vector<const uint16_t>(two_byte_string, 14540 i::Vector<const uint16_t>(two_byte_string,
14541 i::StrLength(c_string))); 14541 i::StrLength(c_string)));
14542 14542
14543 Local<String> lhs(v8::Utils::ToLocal( 14543 Local<String> lhs(v8::Utils::ToLocal(
14544 factory->NewExternalStringFromAscii(&ascii_resource))); 14544 factory->NewExternalStringFromAscii(&ascii_resource)));
14545 Local<String> rhs(v8::Utils::ToLocal( 14545 Local<String> rhs(v8::Utils::ToLocal(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
14623 class RegExpStringModificationTest { 14623 class RegExpStringModificationTest {
14624 public: 14624 public:
14625 RegExpStringModificationTest() 14625 RegExpStringModificationTest()
14626 : block_(0), 14626 : block_(0),
14627 morphs_(0), 14627 morphs_(0),
14628 morphs_during_regexp_(0), 14628 morphs_during_regexp_(0),
14629 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), 14629 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)),
14630 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} 14630 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {}
14631 ~RegExpStringModificationTest() {} 14631 ~RegExpStringModificationTest() {}
14632 void RunTest() { 14632 void RunTest() {
14633 i::Factory* factory = i::Isolate::Current()->factory(); 14633 i::Factory* factory = CcTest::i_isolate()->factory();
14634 14634
14635 regexp_success_ = false; 14635 regexp_success_ = false;
14636 morph_success_ = false; 14636 morph_success_ = false;
14637 14637
14638 // Initialize the contents of two_byte_content_ to be a uc16 representation 14638 // Initialize the contents of two_byte_content_ to be a uc16 representation
14639 // of "aaaaaaaaaaaaaab". 14639 // of "aaaaaaaaaaaaaab".
14640 for (int i = 0; i < 14; i++) { 14640 for (int i = 0; i < 14; i++) {
14641 two_byte_content_[i] = 'a'; 14641 two_byte_content_[i] = 'a';
14642 } 14642 }
14643 two_byte_content_[14] = 'b'; 14643 two_byte_content_[14] = 'b';
14644 14644
14645 // Create the input string for the regexp - the one we are going to change 14645 // Create the input string for the regexp - the one we are going to change
14646 // properties of. 14646 // properties of.
14647 input_ = factory->NewExternalStringFromAscii(&ascii_resource_); 14647 input_ = factory->NewExternalStringFromAscii(&ascii_resource_);
14648 14648
14649 // Inject the input as a global variable. 14649 // Inject the input as a global variable.
14650 i::Handle<i::String> input_name = 14650 i::Handle<i::String> input_name =
14651 factory->NewStringFromAscii(i::Vector<const char>("input", 5)); 14651 factory->NewStringFromAscii(i::Vector<const char>("input", 5));
14652 i::JSReceiver::SetProperty( 14652 i::JSReceiver::SetProperty(
14653 i::handle(i::Isolate::Current()->native_context()->global_object()), 14653 i::handle(CcTest::i_isolate()->native_context()->global_object()),
14654 input_name, 14654 input_name,
14655 input_, 14655 input_,
14656 NONE, 14656 NONE,
14657 i::kNonStrictMode); 14657 i::kNonStrictMode);
14658 14658
14659 MorphThread morph_thread(this); 14659 MorphThread morph_thread(this);
14660 morph_thread.Start(); 14660 morph_thread.Start();
14661 v8::Locker::StartPreemption(1); 14661 v8::Locker::StartPreemption(1);
14662 LongRunningRegExp(); 14662 LongRunningRegExp();
14663 { 14663 {
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
15038 ApiTestFuzzer::Fuzz(); 15038 ApiTestFuzzer::Fuzz();
15039 CHECK(Context::GetCurrent() == calling_context0); 15039 CHECK(Context::GetCurrent() == calling_context0);
15040 CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0); 15040 CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0);
15041 CHECK(Context::GetCalling() == calling_context1); 15041 CHECK(Context::GetCalling() == calling_context1);
15042 CHECK(Context::GetEntered() == calling_context2); 15042 CHECK(Context::GetEntered() == calling_context2);
15043 args.GetReturnValue().Set(42); 15043 args.GetReturnValue().Set(42);
15044 } 15044 }
15045 15045
15046 15046
15047 THREADED_TEST(GetCurrentContextWhenNotInContext) { 15047 THREADED_TEST(GetCurrentContextWhenNotInContext) {
15048 i::Isolate* isolate = i::Isolate::Current(); 15048 i::Isolate* isolate = CcTest::i_isolate();
15049 CHECK(isolate != NULL); 15049 CHECK(isolate != NULL);
15050 CHECK(isolate->context() == NULL); 15050 CHECK(isolate->context() == NULL);
15051 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); 15051 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
15052 v8::HandleScope scope(v8_isolate); 15052 v8::HandleScope scope(v8_isolate);
15053 // The following should not crash, but return an empty handle. 15053 // The following should not crash, but return an empty handle.
15054 v8::Local<v8::Context> current = v8_isolate->GetCurrentContext(); 15054 v8::Local<v8::Context> current = v8_isolate->GetCurrentContext();
15055 CHECK(current.IsEmpty()); 15055 CHECK(current.IsEmpty());
15056 } 15056 }
15057 15057
15058 15058
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
15155 int expected, 15155 int expected,
15156 i::Handle<i::Object> obj, 15156 i::Handle<i::Object> obj,
15157 int offset) { 15157 int offset) {
15158 i::Object* element = obj->GetElement(isolate, offset)->ToObjectChecked(); 15158 i::Object* element = obj->GetElement(isolate, offset)->ToObjectChecked();
15159 CHECK_EQ(expected, i::Smi::cast(element)->value()); 15159 CHECK_EQ(expected, i::Smi::cast(element)->value());
15160 } 15160 }
15161 15161
15162 15162
15163 THREADED_TEST(PixelArray) { 15163 THREADED_TEST(PixelArray) {
15164 LocalContext context; 15164 LocalContext context;
15165 i::Isolate* isolate = i::Isolate::Current(); 15165 i::Isolate* isolate = CcTest::i_isolate();
15166 i::Factory* factory = isolate->factory(); 15166 i::Factory* factory = isolate->factory();
15167 v8::HandleScope scope(context->GetIsolate()); 15167 v8::HandleScope scope(context->GetIsolate());
15168 const int kElementCount = 260; 15168 const int kElementCount = 260;
15169 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); 15169 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
15170 i::Handle<i::ExternalPixelArray> pixels = 15170 i::Handle<i::ExternalPixelArray> pixels =
15171 i::Handle<i::ExternalPixelArray>::cast( 15171 i::Handle<i::ExternalPixelArray>::cast(
15172 factory->NewExternalArray(kElementCount, 15172 factory->NewExternalArray(kElementCount,
15173 v8::kExternalPixelArray, 15173 v8::kExternalPixelArray,
15174 pixel_data)); 15174 pixel_data));
15175 // Force GC to trigger verification. 15175 // Force GC to trigger verification.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
15569 static void NotHandledIndexedPropertySetter( 15569 static void NotHandledIndexedPropertySetter(
15570 uint32_t index, 15570 uint32_t index,
15571 Local<Value> value, 15571 Local<Value> value,
15572 const v8::PropertyCallbackInfo<v8::Value>& info) { 15572 const v8::PropertyCallbackInfo<v8::Value>& info) {
15573 ApiTestFuzzer::Fuzz(); 15573 ApiTestFuzzer::Fuzz();
15574 } 15574 }
15575 15575
15576 15576
15577 THREADED_TEST(PixelArrayWithInterceptor) { 15577 THREADED_TEST(PixelArrayWithInterceptor) {
15578 LocalContext context; 15578 LocalContext context;
15579 i::Factory* factory = i::Isolate::Current()->factory(); 15579 i::Factory* factory = CcTest::i_isolate()->factory();
15580 v8::HandleScope scope(context->GetIsolate()); 15580 v8::HandleScope scope(context->GetIsolate());
15581 const int kElementCount = 260; 15581 const int kElementCount = 260;
15582 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); 15582 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
15583 i::Handle<i::ExternalPixelArray> pixels = 15583 i::Handle<i::ExternalPixelArray> pixels =
15584 i::Handle<i::ExternalPixelArray>::cast( 15584 i::Handle<i::ExternalPixelArray>::cast(
15585 factory->NewExternalArray(kElementCount, 15585 factory->NewExternalArray(kElementCount,
15586 v8::kExternalPixelArray, 15586 v8::kExternalPixelArray,
15587 pixel_data)); 15587 pixel_data));
15588 for (int i = 0; i < kElementCount; i++) { 15588 for (int i = 0; i < kElementCount; i++) {
15589 pixels->set(i, i % 256); 15589 pixels->set(i, i % 256);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
15935 result = CompileRun("ext_array[1] = 23;"); 15935 result = CompileRun("ext_array[1] = 23;");
15936 CHECK_EQ(23, result->Int32Value()); 15936 CHECK_EQ(23, result->Int32Value());
15937 } 15937 }
15938 15938
15939 15939
15940 template <class ExternalArrayClass, class ElementType> 15940 template <class ExternalArrayClass, class ElementType>
15941 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, 15941 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type,
15942 int64_t low, 15942 int64_t low,
15943 int64_t high) { 15943 int64_t high) {
15944 LocalContext context; 15944 LocalContext context;
15945 i::Isolate* isolate = i::Isolate::Current(); 15945 i::Isolate* isolate = CcTest::i_isolate();
15946 i::Factory* factory = isolate->factory(); 15946 i::Factory* factory = isolate->factory();
15947 v8::HandleScope scope(context->GetIsolate()); 15947 v8::HandleScope scope(context->GetIsolate());
15948 const int kElementCount = 40; 15948 const int kElementCount = 40;
15949 int element_size = ExternalArrayElementSize(array_type); 15949 int element_size = ExternalArrayElementSize(array_type);
15950 ElementType* array_data = 15950 ElementType* array_data =
15951 static_cast<ElementType*>(malloc(kElementCount * element_size)); 15951 static_cast<ElementType*>(malloc(kElementCount * element_size));
15952 i::Handle<ExternalArrayClass> array = 15952 i::Handle<ExternalArrayClass> array =
15953 i::Handle<ExternalArrayClass>::cast( 15953 i::Handle<ExternalArrayClass>::cast(
15954 factory->NewExternalArray(kElementCount, array_type, array_data)); 15954 factory->NewExternalArray(kElementCount, array_type, array_data));
15955 // Force GC to trigger verification. 15955 // Force GC to trigger verification.
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
16937 16937
16938 i::ScopedVector<char> code(1024); 16938 i::ScopedVector<char> code(1024);
16939 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); 16939 i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
16940 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); 16940 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
16941 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url"); 16941 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url");
16942 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); 16942 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined());
16943 } 16943 }
16944 16944
16945 16945
16946 static void CreateGarbageInOldSpace() { 16946 static void CreateGarbageInOldSpace() {
16947 i::Factory* factory = i::Isolate::Current()->factory(); 16947 i::Factory* factory = CcTest::i_isolate()->factory();
16948 v8::HandleScope scope(CcTest::isolate()); 16948 v8::HandleScope scope(CcTest::isolate());
16949 i::AlwaysAllocateScope always_allocate; 16949 i::AlwaysAllocateScope always_allocate;
16950 for (int i = 0; i < 1000; i++) { 16950 for (int i = 0; i < 1000; i++) {
16951 factory->NewFixedArray(1000, i::TENURED); 16951 factory->NewFixedArray(1000, i::TENURED);
16952 } 16952 }
16953 } 16953 }
16954 16954
16955 16955
16956 // Test that idle notification can be handled and eventually returns true. 16956 // Test that idle notification can be handled and eventually returns true.
16957 TEST(IdleNotification) { 16957 TEST(IdleNotification) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
17044 } 17044 }
17045 intptr_t final_size = HEAP->SizeOfObjects(); 17045 intptr_t final_size = HEAP->SizeOfObjects();
17046 CHECK_LT(final_size, initial_size + 1); 17046 CHECK_LT(final_size, initial_size + 1);
17047 } 17047 }
17048 17048
17049 static uint32_t* stack_limit; 17049 static uint32_t* stack_limit;
17050 17050
17051 static void GetStackLimitCallback( 17051 static void GetStackLimitCallback(
17052 const v8::FunctionCallbackInfo<v8::Value>& args) { 17052 const v8::FunctionCallbackInfo<v8::Value>& args) {
17053 stack_limit = reinterpret_cast<uint32_t*>( 17053 stack_limit = reinterpret_cast<uint32_t*>(
17054 i::Isolate::Current()->stack_guard()->real_climit()); 17054 CcTest::i_isolate()->stack_guard()->real_climit());
17055 } 17055 }
17056 17056
17057 17057
17058 // Uses the address of a local variable to determine the stack top now. 17058 // Uses the address of a local variable to determine the stack top now.
17059 // Given a size, returns an address that is that far from the current 17059 // Given a size, returns an address that is that far from the current
17060 // top of stack. 17060 // top of stack.
17061 static uint32_t* ComputeStackLimit(uint32_t size) { 17061 static uint32_t* ComputeStackLimit(uint32_t size) {
17062 uint32_t* answer = &size - (size / sizeof(size)); 17062 uint32_t* answer = &size - (size / sizeof(size));
17063 // If the size is very large and the stack is very near the bottom of 17063 // If the size is very large and the stack is very near the bottom of
17064 // memory then the calculation above may wrap around and give an address 17064 // memory then the calculation above may wrap around and give an address
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after
19294 THREADED_TEST(Regress1516) { 19294 THREADED_TEST(Regress1516) {
19295 LocalContext context; 19295 LocalContext context;
19296 v8::HandleScope scope(context->GetIsolate()); 19296 v8::HandleScope scope(context->GetIsolate());
19297 19297
19298 { v8::HandleScope temp_scope(context->GetIsolate()); 19298 { v8::HandleScope temp_scope(context->GetIsolate());
19299 CompileRun("({'a': 0})"); 19299 CompileRun("({'a': 0})");
19300 } 19300 }
19301 19301
19302 int elements; 19302 int elements;
19303 { i::MapCache* map_cache = 19303 { i::MapCache* map_cache =
19304 i::MapCache::cast(i::Isolate::Current()->context()->map_cache()); 19304 i::MapCache::cast(CcTest::i_isolate()->context()->map_cache());
19305 elements = map_cache->NumberOfElements(); 19305 elements = map_cache->NumberOfElements();
19306 CHECK_LE(1, elements); 19306 CHECK_LE(1, elements);
19307 } 19307 }
19308 19308
19309 i::Isolate::Current()->heap()->CollectAllGarbage( 19309 CcTest::i_isolate()->heap()->CollectAllGarbage(
19310 i::Heap::kAbortIncrementalMarkingMask); 19310 i::Heap::kAbortIncrementalMarkingMask);
19311 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); 19311 { i::Object* raw_map_cache = CcTest::i_isolate()->context()->map_cache();
19312 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { 19312 if (raw_map_cache != CcTest::i_isolate()->heap()->undefined_value()) {
19313 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); 19313 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
19314 CHECK_GT(elements, map_cache->NumberOfElements()); 19314 CHECK_GT(elements, map_cache->NumberOfElements());
19315 } 19315 }
19316 } 19316 }
19317 } 19317 }
19318 19318
19319 19319
19320 static bool BlockProtoNamedSecurityTestCallback(Local<v8::Object> global, 19320 static bool BlockProtoNamedSecurityTestCallback(Local<v8::Object> global,
19321 Local<Value> name, 19321 Local<Value> name,
19322 v8::AccessType type, 19322 v8::AccessType type,
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
19709 } 19709 }
19710 19710
19711 19711
19712 TEST(PrimaryStubCache) { 19712 TEST(PrimaryStubCache) {
19713 StubCacheHelper(false); 19713 StubCacheHelper(false);
19714 } 19714 }
19715 19715
19716 19716
19717 TEST(StaticGetters) { 19717 TEST(StaticGetters) {
19718 LocalContext context; 19718 LocalContext context;
19719 i::Factory* factory = i::Isolate::Current()->factory(); 19719 i::Factory* factory = CcTest::i_isolate()->factory();
19720 v8::Isolate* isolate = CcTest::isolate(); 19720 v8::Isolate* isolate = CcTest::isolate();
19721 v8::HandleScope scope(isolate); 19721 v8::HandleScope scope(isolate);
19722 i::Handle<i::Object> undefined_value = factory->undefined_value(); 19722 i::Handle<i::Object> undefined_value = factory->undefined_value();
19723 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); 19723 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value);
19724 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); 19724 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value);
19725 i::Handle<i::Object> null_value = factory->null_value(); 19725 i::Handle<i::Object> null_value = factory->null_value();
19726 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); 19726 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value);
19727 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); 19727 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value);
19728 i::Handle<i::Object> true_value = factory->true_value(); 19728 i::Handle<i::Object> true_value = factory->true_value();
19729 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); 19729 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value);
(...skipping 18 matching lines...) Expand all
19748 CHECK_EQ(data2, isolate->GetData()); 19748 CHECK_EQ(data2, isolate->GetData());
19749 CHECK_EQ(data2, i_isolate->GetData()); 19749 CHECK_EQ(data2, i_isolate->GetData());
19750 i_isolate->TearDown(); 19750 i_isolate->TearDown();
19751 CHECK_EQ(data2, isolate->GetData()); 19751 CHECK_EQ(data2, isolate->GetData());
19752 CHECK_EQ(data2, i_isolate->GetData()); 19752 CHECK_EQ(data2, i_isolate->GetData());
19753 } 19753 }
19754 19754
19755 19755
19756 TEST(StringEmpty) { 19756 TEST(StringEmpty) {
19757 LocalContext context; 19757 LocalContext context;
19758 i::Factory* factory = i::Isolate::Current()->factory(); 19758 i::Factory* factory = CcTest::i_isolate()->factory();
19759 v8::Isolate* isolate = CcTest::isolate(); 19759 v8::Isolate* isolate = CcTest::isolate();
19760 v8::HandleScope scope(isolate); 19760 v8::HandleScope scope(isolate);
19761 i::Handle<i::Object> empty_string = factory->empty_string(); 19761 i::Handle<i::Object> empty_string = factory->empty_string();
19762 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string); 19762 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string);
19763 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string); 19763 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string);
19764 } 19764 }
19765 19765
19766 19766
19767 static int instance_checked_getter_count = 0; 19767 static int instance_checked_getter_count = 0;
19768 static void InstanceCheckedGetter( 19768 static void InstanceCheckedGetter(
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
20590 Local<Object> data2 = v8::Object::New(); 20590 Local<Object> data2 = v8::Object::New();
20591 function_new_expected_env = data2; 20591 function_new_expected_env = data2;
20592 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); 20592 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
20593 CHECK(!func2->IsNull()); 20593 CHECK(!func2->IsNull());
20594 CHECK_NE(func, func2); 20594 CHECK_NE(func, func2);
20595 env->Global()->Set(v8_str("func2"), func2); 20595 env->Global()->Set(v8_str("func2"), func2);
20596 Local<Value> result2 = CompileRun("func2();"); 20596 Local<Value> result2 = CompileRun("func2();");
20597 CHECK_EQ(v8::Integer::New(17, isolate), result2); 20597 CHECK_EQ(v8::Integer::New(17, isolate), result2);
20598 } 20598 }
20599 20599
OLDNEW
« no previous file with comments | « test/cctest/test-alloc.cc ('k') | test/cctest/test-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698