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

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

Issue 24508006: remove uses of static oddball accessors using GetCurrent in advance of removal from api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 7 years, 2 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-accessors.cc ('k') | test/cctest/test-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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 Local<Context> local_env; 197 Local<Context> local_env;
198 { 198 {
199 LocalContext env; 199 LocalContext env;
200 local_env = env.local(); 200 local_env = env.local();
201 } 201 }
202 202
203 // Local context should still be live. 203 // Local context should still be live.
204 CHECK(!local_env.IsEmpty()); 204 CHECK(!local_env.IsEmpty());
205 local_env->Enter(); 205 local_env->Enter();
206 206
207 v8::Handle<v8::Primitive> undef = v8::Undefined(); 207 v8::Handle<v8::Primitive> undef = v8::Undefined(CcTest::isolate());
208 CHECK(!undef.IsEmpty()); 208 CHECK(!undef.IsEmpty());
209 CHECK(undef->IsUndefined()); 209 CHECK(undef->IsUndefined());
210 210
211 const char* c_source = "1 + 2 + 3"; 211 const char* c_source = "1 + 2 + 3";
212 Local<String> source = String::New(c_source); 212 Local<String> source = String::New(c_source);
213 Local<Script> script = Script::Compile(source); 213 Local<Script> script = Script::Compile(source);
214 CHECK_EQ(6, script->Run()->Int32Value()); 214 CHECK_EQ(6, script->Run()->Int32Value());
215 215
216 local_env->Exit(); 216 local_env->Exit();
217 } 217 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 CHECK(value7->IsTrue()); 384 CHECK(value7->IsTrue());
385 385
386 v8::Handle<Value> value8 = CompileRun( 386 v8::Handle<Value> value8 = CompileRun(
387 "Fun2(new Cons1(), new Cons2()) == '[object Cons1],[object Cons2]'"); 387 "Fun2(new Cons1(), new Cons2()) == '[object Cons1],[object Cons2]'");
388 CHECK(value8->IsTrue()); 388 CHECK(value8->IsTrue());
389 } 389 }
390 390
391 391
392 THREADED_TEST(HulIgennem) { 392 THREADED_TEST(HulIgennem) {
393 LocalContext env; 393 LocalContext env;
394 v8::HandleScope scope(env->GetIsolate()); 394 v8::Isolate* isolate = env->GetIsolate();
395 v8::Handle<v8::Primitive> undef = v8::Undefined(); 395 v8::HandleScope scope(isolate);
396 v8::Handle<v8::Primitive> undef = v8::Undefined(isolate);
396 Local<String> undef_str = undef->ToString(); 397 Local<String> undef_str = undef->ToString();
397 char* value = i::NewArray<char>(undef_str->Utf8Length() + 1); 398 char* value = i::NewArray<char>(undef_str->Utf8Length() + 1);
398 undef_str->WriteUtf8(value); 399 undef_str->WriteUtf8(value);
399 CHECK_EQ(0, strcmp(value, "undefined")); 400 CHECK_EQ(0, strcmp(value, "undefined"));
400 i::DeleteArray(value); 401 i::DeleteArray(value);
401 } 402 }
402 403
403 404
404 THREADED_TEST(Access) { 405 THREADED_TEST(Access) {
405 LocalContext env; 406 LocalContext env;
406 v8::HandleScope scope(env->GetIsolate()); 407 v8::Isolate* isolate = env->GetIsolate();
408 v8::HandleScope scope(isolate);
407 Local<v8::Object> obj = v8::Object::New(); 409 Local<v8::Object> obj = v8::Object::New();
408 Local<Value> foo_before = obj->Get(v8_str("foo")); 410 Local<Value> foo_before = obj->Get(v8_str("foo"));
409 CHECK(foo_before->IsUndefined()); 411 CHECK(foo_before->IsUndefined());
410 Local<String> bar_str = v8_str("bar"); 412 Local<String> bar_str = v8_str("bar");
411 obj->Set(v8_str("foo"), bar_str); 413 obj->Set(v8_str("foo"), bar_str);
412 Local<Value> foo_after = obj->Get(v8_str("foo")); 414 Local<Value> foo_after = obj->Get(v8_str("foo"));
413 CHECK(!foo_after->IsUndefined()); 415 CHECK(!foo_after->IsUndefined());
414 CHECK(foo_after->IsString()); 416 CHECK(foo_after->IsString());
415 CHECK_EQ(bar_str, foo_after); 417 CHECK_EQ(bar_str, foo_after);
416 } 418 }
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 LocalContext env; 1684 LocalContext env;
1683 v8::HandleScope scope(env->GetIsolate()); 1685 v8::HandleScope scope(env->GetIsolate());
1684 double PI = 3.1415926; 1686 double PI = 3.1415926;
1685 Local<v8::Number> pi_obj = v8::Number::New(PI); 1687 Local<v8::Number> pi_obj = v8::Number::New(PI);
1686 CHECK_EQ(PI, pi_obj->NumberValue()); 1688 CHECK_EQ(PI, pi_obj->NumberValue());
1687 } 1689 }
1688 1690
1689 1691
1690 THREADED_TEST(ToNumber) { 1692 THREADED_TEST(ToNumber) {
1691 LocalContext env; 1693 LocalContext env;
1692 v8::HandleScope scope(env->GetIsolate()); 1694 v8::Isolate* isolate = CcTest::isolate();
1695 v8::HandleScope scope(isolate);
1693 Local<String> str = v8_str("3.1415926"); 1696 Local<String> str = v8_str("3.1415926");
1694 CHECK_EQ(3.1415926, str->NumberValue()); 1697 CHECK_EQ(3.1415926, str->NumberValue());
1695 v8::Handle<v8::Boolean> t = v8::True(); 1698 v8::Handle<v8::Boolean> t = v8::True(isolate);
1696 CHECK_EQ(1.0, t->NumberValue()); 1699 CHECK_EQ(1.0, t->NumberValue());
1697 v8::Handle<v8::Boolean> f = v8::False(); 1700 v8::Handle<v8::Boolean> f = v8::False(isolate);
1698 CHECK_EQ(0.0, f->NumberValue()); 1701 CHECK_EQ(0.0, f->NumberValue());
1699 } 1702 }
1700 1703
1701 1704
1702 THREADED_TEST(Date) { 1705 THREADED_TEST(Date) {
1703 LocalContext env; 1706 LocalContext env;
1704 v8::HandleScope scope(env->GetIsolate()); 1707 v8::HandleScope scope(env->GetIsolate());
1705 double PI = 3.1415926; 1708 double PI = 3.1415926;
1706 Local<Value> date = v8::Date::New(PI); 1709 Local<Value> date = v8::Date::New(PI);
1707 CHECK_EQ(3.0, date->NumberValue()); 1710 CHECK_EQ(3.0, date->NumberValue());
1708 date.As<v8::Date>()->Set(v8_str("property"), v8::Integer::New(42)); 1711 date.As<v8::Date>()->Set(v8_str("property"), v8::Integer::New(42));
1709 CHECK_EQ(42, date.As<v8::Date>()->Get(v8_str("property"))->Int32Value()); 1712 CHECK_EQ(42, date.As<v8::Date>()->Get(v8_str("property"))->Int32Value());
1710 } 1713 }
1711 1714
1712 1715
1713 THREADED_TEST(Boolean) { 1716 THREADED_TEST(Boolean) {
1714 LocalContext env; 1717 LocalContext env;
1715 v8::HandleScope scope(env->GetIsolate()); 1718 v8::HandleScope scope(env->GetIsolate());
1716 v8::Handle<v8::Boolean> t = v8::True(); 1719 v8::Handle<v8::Boolean> t = v8::True(CcTest::isolate());
1717 CHECK(t->Value()); 1720 CHECK(t->Value());
1718 v8::Handle<v8::Boolean> f = v8::False(); 1721 v8::Handle<v8::Boolean> f = v8::False(CcTest::isolate());
1719 CHECK(!f->Value()); 1722 CHECK(!f->Value());
1720 v8::Handle<v8::Primitive> u = v8::Undefined(); 1723 v8::Handle<v8::Primitive> u = v8::Undefined(CcTest::isolate());
1721 CHECK(!u->BooleanValue()); 1724 CHECK(!u->BooleanValue());
1722 v8::Handle<v8::Primitive> n = v8::Null(); 1725 v8::Handle<v8::Primitive> n = v8::Null(CcTest::isolate());
1723 CHECK(!n->BooleanValue()); 1726 CHECK(!n->BooleanValue());
1724 v8::Handle<String> str1 = v8_str(""); 1727 v8::Handle<String> str1 = v8_str("");
1725 CHECK(!str1->BooleanValue()); 1728 CHECK(!str1->BooleanValue());
1726 v8::Handle<String> str2 = v8_str("x"); 1729 v8::Handle<String> str2 = v8_str("x");
1727 CHECK(str2->BooleanValue()); 1730 CHECK(str2->BooleanValue());
1728 CHECK(!v8::Number::New(0)->BooleanValue()); 1731 CHECK(!v8::Number::New(0)->BooleanValue());
1729 CHECK(v8::Number::New(-1)->BooleanValue()); 1732 CHECK(v8::Number::New(-1)->BooleanValue());
1730 CHECK(v8::Number::New(1)->BooleanValue()); 1733 CHECK(v8::Number::New(1)->BooleanValue());
1731 CHECK(v8::Number::New(42)->BooleanValue()); 1734 CHECK(v8::Number::New(42)->BooleanValue());
1732 CHECK(!v8_compile("NaN")->Run()->BooleanValue()); 1735 CHECK(!v8_compile("NaN")->Run()->BooleanValue());
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 static void check_message_3(v8::Handle<v8::Message> message, 3758 static void check_message_3(v8::Handle<v8::Message> message,
3756 v8::Handle<Value> data) { 3759 v8::Handle<Value> data) {
3757 CHECK(message->IsSharedCrossOrigin()); 3760 CHECK(message->IsSharedCrossOrigin());
3758 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); 3761 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue());
3759 message_received = true; 3762 message_received = true;
3760 } 3763 }
3761 3764
3762 3765
3763 TEST(MessageHandler3) { 3766 TEST(MessageHandler3) {
3764 message_received = false; 3767 message_received = false;
3765 v8::HandleScope scope(CcTest::isolate()); 3768 v8::Isolate* isolate = CcTest::isolate();
3769 v8::HandleScope scope(isolate);
3766 CHECK(!message_received); 3770 CHECK(!message_received);
3767 v8::V8::AddMessageListener(check_message_3); 3771 v8::V8::AddMessageListener(check_message_3);
3768 LocalContext context; 3772 LocalContext context;
3769 v8::ScriptOrigin origin = 3773 v8::ScriptOrigin origin =
3770 v8::ScriptOrigin(v8_str("6.75"), 3774 v8::ScriptOrigin(v8_str("6.75"),
3771 v8::Integer::New(1), 3775 v8::Integer::New(1, isolate),
3772 v8::Integer::New(2), 3776 v8::Integer::New(2, isolate),
3773 v8::True()); 3777 v8::True(isolate));
3774 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), 3778 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
3775 &origin); 3779 &origin);
3776 script->Run(); 3780 script->Run();
3777 CHECK(message_received); 3781 CHECK(message_received);
3778 // clear out the message listener 3782 // clear out the message listener
3779 v8::V8::RemoveMessageListeners(check_message_3); 3783 v8::V8::RemoveMessageListeners(check_message_3);
3780 } 3784 }
3781 3785
3782 3786
3783 static void check_message_4(v8::Handle<v8::Message> message, 3787 static void check_message_4(v8::Handle<v8::Message> message,
3784 v8::Handle<Value> data) { 3788 v8::Handle<Value> data) {
3785 CHECK(!message->IsSharedCrossOrigin()); 3789 CHECK(!message->IsSharedCrossOrigin());
3786 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); 3790 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue());
3787 message_received = true; 3791 message_received = true;
3788 } 3792 }
3789 3793
3790 3794
3791 TEST(MessageHandler4) { 3795 TEST(MessageHandler4) {
3792 message_received = false; 3796 message_received = false;
3793 v8::HandleScope scope(CcTest::isolate()); 3797 v8::Isolate* isolate = CcTest::isolate();
3798 v8::HandleScope scope(isolate);
3794 CHECK(!message_received); 3799 CHECK(!message_received);
3795 v8::V8::AddMessageListener(check_message_4); 3800 v8::V8::AddMessageListener(check_message_4);
3796 LocalContext context; 3801 LocalContext context;
3797 v8::ScriptOrigin origin = 3802 v8::ScriptOrigin origin =
3798 v8::ScriptOrigin(v8_str("6.75"), 3803 v8::ScriptOrigin(v8_str("6.75"),
3799 v8::Integer::New(1), 3804 v8::Integer::New(1, isolate),
3800 v8::Integer::New(2), 3805 v8::Integer::New(2, isolate),
3801 v8::False()); 3806 v8::False(isolate));
3802 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), 3807 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
3803 &origin); 3808 &origin);
3804 script->Run(); 3809 script->Run();
3805 CHECK(message_received); 3810 CHECK(message_received);
3806 // clear out the message listener 3811 // clear out the message listener
3807 v8::V8::RemoveMessageListeners(check_message_4); 3812 v8::V8::RemoveMessageListeners(check_message_4);
3808 } 3813 }
3809 3814
3810 3815
3811 static void check_message_5a(v8::Handle<v8::Message> message, 3816 static void check_message_5a(v8::Handle<v8::Message> message,
3812 v8::Handle<Value> data) { 3817 v8::Handle<Value> data) {
3813 CHECK(message->IsSharedCrossOrigin()); 3818 CHECK(message->IsSharedCrossOrigin());
3814 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); 3819 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue());
3815 message_received = true; 3820 message_received = true;
3816 } 3821 }
3817 3822
3818 3823
3819 static void check_message_5b(v8::Handle<v8::Message> message, 3824 static void check_message_5b(v8::Handle<v8::Message> message,
3820 v8::Handle<Value> data) { 3825 v8::Handle<Value> data) {
3821 CHECK(!message->IsSharedCrossOrigin()); 3826 CHECK(!message->IsSharedCrossOrigin());
3822 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue()); 3827 CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue());
3823 message_received = true; 3828 message_received = true;
3824 } 3829 }
3825 3830
3826 3831
3827 TEST(MessageHandler5) { 3832 TEST(MessageHandler5) {
3828 message_received = false; 3833 message_received = false;
3829 v8::HandleScope scope(CcTest::isolate()); 3834 v8::Isolate* isolate = CcTest::isolate();
3835 v8::HandleScope scope(isolate);
3830 CHECK(!message_received); 3836 CHECK(!message_received);
3831 v8::V8::AddMessageListener(check_message_5a); 3837 v8::V8::AddMessageListener(check_message_5a);
3832 LocalContext context; 3838 LocalContext context;
3833 v8::ScriptOrigin origin = 3839 v8::ScriptOrigin origin =
3834 v8::ScriptOrigin(v8_str("6.75"), 3840 v8::ScriptOrigin(v8_str("6.75"),
3835 v8::Integer::New(1), 3841 v8::Integer::New(1, isolate),
3836 v8::Integer::New(2), 3842 v8::Integer::New(2, isolate),
3837 v8::True()); 3843 v8::True(isolate));
3838 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"), 3844 v8::Handle<v8::Script> script = Script::Compile(v8_str("throw 'error'"),
3839 &origin); 3845 &origin);
3840 script->Run(); 3846 script->Run();
3841 CHECK(message_received); 3847 CHECK(message_received);
3842 // clear out the message listener 3848 // clear out the message listener
3843 v8::V8::RemoveMessageListeners(check_message_5a); 3849 v8::V8::RemoveMessageListeners(check_message_5a);
3844 3850
3845 message_received = false; 3851 message_received = false;
3846 v8::V8::AddMessageListener(check_message_5b); 3852 v8::V8::AddMessageListener(check_message_5b);
3847 origin = 3853 origin =
3848 v8::ScriptOrigin(v8_str("6.75"), 3854 v8::ScriptOrigin(v8_str("6.75"),
3849 v8::Integer::New(1), 3855 v8::Integer::New(1, isolate),
3850 v8::Integer::New(2), 3856 v8::Integer::New(2, isolate),
3851 v8::False()); 3857 v8::False(isolate));
3852 script = Script::Compile(v8_str("throw 'error'"), 3858 script = Script::Compile(v8_str("throw 'error'"),
3853 &origin); 3859 &origin);
3854 script->Run(); 3860 script->Run();
3855 CHECK(message_received); 3861 CHECK(message_received);
3856 // clear out the message listener 3862 // clear out the message listener
3857 v8::V8::RemoveMessageListeners(check_message_5b); 3863 v8::V8::RemoveMessageListeners(check_message_5b);
3858 } 3864 }
3859 3865
3860 3866
3861 THREADED_TEST(GetSetProperty) { 3867 THREADED_TEST(GetSetProperty) {
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
4314 // Positive zero 4320 // Positive zero
4315 CompileRun("var obj = -0.0;"); 4321 CompileRun("var obj = -0.0;");
4316 obj = env->Global()->Get(v8_str("obj")); 4322 obj = env->Global()->Get(v8_str("obj"));
4317 CHECK(!obj->IsInt32()); 4323 CHECK(!obj->IsInt32());
4318 CHECK(!obj->IsUint32()); 4324 CHECK(!obj->IsUint32());
4319 } 4325 }
4320 4326
4321 4327
4322 THREADED_TEST(ConversionException) { 4328 THREADED_TEST(ConversionException) {
4323 LocalContext env; 4329 LocalContext env;
4324 v8::HandleScope scope(env->GetIsolate()); 4330 v8::Isolate* isolate = env->GetIsolate();
4331 v8::HandleScope scope(isolate);
4325 CompileRun( 4332 CompileRun(
4326 "function TestClass() { };" 4333 "function TestClass() { };"
4327 "TestClass.prototype.toString = function () { throw 'uncle?'; };" 4334 "TestClass.prototype.toString = function () { throw 'uncle?'; };"
4328 "var obj = new TestClass();"); 4335 "var obj = new TestClass();");
4329 Local<Value> obj = env->Global()->Get(v8_str("obj")); 4336 Local<Value> obj = env->Global()->Get(v8_str("obj"));
4330 4337
4331 v8::TryCatch try_catch; 4338 v8::TryCatch try_catch;
4332 4339
4333 Local<Value> to_string_result = obj->ToString(); 4340 Local<Value> to_string_result = obj->ToString();
4334 CHECK(to_string_result.IsEmpty()); 4341 CHECK(to_string_result.IsEmpty());
4335 CheckUncle(&try_catch); 4342 CheckUncle(&try_catch);
4336 4343
4337 Local<Value> to_number_result = obj->ToNumber(); 4344 Local<Value> to_number_result = obj->ToNumber();
4338 CHECK(to_number_result.IsEmpty()); 4345 CHECK(to_number_result.IsEmpty());
4339 CheckUncle(&try_catch); 4346 CheckUncle(&try_catch);
4340 4347
4341 Local<Value> to_integer_result = obj->ToInteger(); 4348 Local<Value> to_integer_result = obj->ToInteger();
4342 CHECK(to_integer_result.IsEmpty()); 4349 CHECK(to_integer_result.IsEmpty());
4343 CheckUncle(&try_catch); 4350 CheckUncle(&try_catch);
4344 4351
4345 Local<Value> to_uint32_result = obj->ToUint32(); 4352 Local<Value> to_uint32_result = obj->ToUint32();
4346 CHECK(to_uint32_result.IsEmpty()); 4353 CHECK(to_uint32_result.IsEmpty());
4347 CheckUncle(&try_catch); 4354 CheckUncle(&try_catch);
4348 4355
4349 Local<Value> to_int32_result = obj->ToInt32(); 4356 Local<Value> to_int32_result = obj->ToInt32();
4350 CHECK(to_int32_result.IsEmpty()); 4357 CHECK(to_int32_result.IsEmpty());
4351 CheckUncle(&try_catch); 4358 CheckUncle(&try_catch);
4352 4359
4353 Local<Value> to_object_result = v8::Undefined()->ToObject(); 4360 Local<Value> to_object_result = v8::Undefined(isolate)->ToObject();
4354 CHECK(to_object_result.IsEmpty()); 4361 CHECK(to_object_result.IsEmpty());
4355 CHECK(try_catch.HasCaught()); 4362 CHECK(try_catch.HasCaught());
4356 try_catch.Reset(); 4363 try_catch.Reset();
4357 4364
4358 int32_t int32_value = obj->Int32Value(); 4365 int32_t int32_value = obj->Int32Value();
4359 CHECK_EQ(0, int32_value); 4366 CHECK_EQ(0, int32_value);
4360 CheckUncle(&try_catch); 4367 CheckUncle(&try_catch);
4361 4368
4362 uint32_t uint32_value = obj->Uint32Value(); 4369 uint32_t uint32_value = obj->Uint32Value();
4363 CHECK_EQ(0, uint32_value); 4370 CHECK_EQ(0, uint32_value);
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4969 4976
4970 // Assume String is not internalized. 4977 // Assume String is not internalized.
4971 CHECK(v8_str("a")->StrictEquals(v8_str("a"))); 4978 CHECK(v8_str("a")->StrictEquals(v8_str("a")));
4972 CHECK(!v8_str("a")->StrictEquals(v8_str("b"))); 4979 CHECK(!v8_str("a")->StrictEquals(v8_str("b")));
4973 CHECK(!v8_str("5")->StrictEquals(v8_num(5))); 4980 CHECK(!v8_str("5")->StrictEquals(v8_num(5)));
4974 CHECK(v8_num(1)->StrictEquals(v8_num(1))); 4981 CHECK(v8_num(1)->StrictEquals(v8_num(1)));
4975 CHECK(!v8_num(1)->StrictEquals(v8_num(2))); 4982 CHECK(!v8_num(1)->StrictEquals(v8_num(2)));
4976 CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0))); 4983 CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0)));
4977 Local<Value> not_a_number = v8_num(i::OS::nan_value()); 4984 Local<Value> not_a_number = v8_num(i::OS::nan_value());
4978 CHECK(!not_a_number->StrictEquals(not_a_number)); 4985 CHECK(!not_a_number->StrictEquals(not_a_number));
4979 CHECK(v8::False()->StrictEquals(v8::False())); 4986 CHECK(v8::False(isolate)->StrictEquals(v8::False(isolate)));
4980 CHECK(!v8::False()->StrictEquals(v8::Undefined())); 4987 CHECK(!v8::False(isolate)->StrictEquals(v8::Undefined(isolate)));
4981 4988
4982 v8::Handle<v8::Object> obj = v8::Object::New(); 4989 v8::Handle<v8::Object> obj = v8::Object::New();
4983 v8::Persistent<v8::Object> alias(isolate, obj); 4990 v8::Persistent<v8::Object> alias(isolate, obj);
4984 CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj)); 4991 CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj));
4985 alias.Dispose(); 4992 alias.Dispose();
4986 4993
4987 CHECK(v8_str("a")->SameValue(v8_str("a"))); 4994 CHECK(v8_str("a")->SameValue(v8_str("a")));
4988 CHECK(!v8_str("a")->SameValue(v8_str("b"))); 4995 CHECK(!v8_str("a")->SameValue(v8_str("b")));
4989 CHECK(!v8_str("5")->SameValue(v8_num(5))); 4996 CHECK(!v8_str("5")->SameValue(v8_num(5)));
4990 CHECK(v8_num(1)->SameValue(v8_num(1))); 4997 CHECK(v8_num(1)->SameValue(v8_num(1)));
4991 CHECK(!v8_num(1)->SameValue(v8_num(2))); 4998 CHECK(!v8_num(1)->SameValue(v8_num(2)));
4992 CHECK(!v8_num(0.0)->SameValue(v8_num(-0.0))); 4999 CHECK(!v8_num(0.0)->SameValue(v8_num(-0.0)));
4993 CHECK(not_a_number->SameValue(not_a_number)); 5000 CHECK(not_a_number->SameValue(not_a_number));
4994 CHECK(v8::False()->SameValue(v8::False())); 5001 CHECK(v8::False(isolate)->SameValue(v8::False(isolate)));
4995 CHECK(!v8::False()->SameValue(v8::Undefined())); 5002 CHECK(!v8::False(isolate)->SameValue(v8::Undefined(isolate)));
4996 } 5003 }
4997 5004
4998 5005
4999 THREADED_TEST(MultiRun) { 5006 THREADED_TEST(MultiRun) {
5000 LocalContext context; 5007 LocalContext context;
5001 v8::HandleScope scope(context->GetIsolate()); 5008 v8::HandleScope scope(context->GetIsolate());
5002 Local<Script> script = Script::Compile(v8_str("x")); 5009 Local<Script> script = Script::Compile(v8_str("x"));
5003 for (int i = 0; i < 10; i++) 5010 for (int i = 0; i < 10; i++)
5004 script->Run(); 5011 script->Run();
5005 } 5012 }
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
6666 last_location = NULL; 6673 last_location = NULL;
6667 script->Run(); 6674 script->Run();
6668 6675
6669 CHECK(false); // Should not return. 6676 CHECK(false); // Should not return.
6670 } 6677 }
6671 6678
6672 6679
6673 static void MissingScriptInfoMessageListener(v8::Handle<v8::Message> message, 6680 static void MissingScriptInfoMessageListener(v8::Handle<v8::Message> message,
6674 v8::Handle<Value> data) { 6681 v8::Handle<Value> data) {
6675 CHECK(message->GetScriptResourceName()->IsUndefined()); 6682 CHECK(message->GetScriptResourceName()->IsUndefined());
6676 CHECK_EQ(v8::Undefined(), message->GetScriptResourceName()); 6683 CHECK_EQ(v8::Undefined(CcTest::isolate()), message->GetScriptResourceName());
6677 message->GetLineNumber(); 6684 message->GetLineNumber();
6678 message->GetSourceLine(); 6685 message->GetSourceLine();
6679 } 6686 }
6680 6687
6681 6688
6682 THREADED_TEST(ErrorWithMissingScriptInfo) { 6689 THREADED_TEST(ErrorWithMissingScriptInfo) {
6683 LocalContext context; 6690 LocalContext context;
6684 v8::HandleScope scope(context->GetIsolate()); 6691 v8::HandleScope scope(context->GetIsolate());
6685 v8::V8::AddMessageListener(MissingScriptInfoMessageListener); 6692 v8::V8::AddMessageListener(MissingScriptInfoMessageListener);
6686 Script::Compile(v8_str("throw Error()"))->Run(); 6693 Script::Compile(v8_str("throw Error()"))->Run();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
6903 } 6910 }
6904 } 6911 }
6905 6912
6906 6913
6907 v8::Handle<Function> args_fun; 6914 v8::Handle<Function> args_fun;
6908 6915
6909 6916
6910 static void ArgumentsTestCallback( 6917 static void ArgumentsTestCallback(
6911 const v8::FunctionCallbackInfo<v8::Value>& args) { 6918 const v8::FunctionCallbackInfo<v8::Value>& args) {
6912 ApiTestFuzzer::Fuzz(); 6919 ApiTestFuzzer::Fuzz();
6920 v8::Isolate* isolate = args.GetIsolate();
6913 CHECK_EQ(args_fun, args.Callee()); 6921 CHECK_EQ(args_fun, args.Callee());
6914 CHECK_EQ(3, args.Length()); 6922 CHECK_EQ(3, args.Length());
6915 CHECK_EQ(v8::Integer::New(1), args[0]); 6923 CHECK_EQ(v8::Integer::New(1, isolate), args[0]);
6916 CHECK_EQ(v8::Integer::New(2), args[1]); 6924 CHECK_EQ(v8::Integer::New(2, isolate), args[1]);
6917 CHECK_EQ(v8::Integer::New(3), args[2]); 6925 CHECK_EQ(v8::Integer::New(3, isolate), args[2]);
6918 CHECK_EQ(v8::Undefined(), args[3]); 6926 CHECK_EQ(v8::Undefined(isolate), args[3]);
6919 v8::HandleScope scope(args.GetIsolate()); 6927 v8::HandleScope scope(args.GetIsolate());
6920 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 6928 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
6921 } 6929 }
6922 6930
6923 6931
6924 THREADED_TEST(Arguments) { 6932 THREADED_TEST(Arguments) {
6925 v8::HandleScope scope(CcTest::isolate()); 6933 v8::HandleScope scope(CcTest::isolate());
6926 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New(); 6934 v8::Handle<v8::ObjectTemplate> global = ObjectTemplate::New();
6927 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback)); 6935 global->Set(v8_str("f"), v8::FunctionTemplate::New(ArgumentsTestCallback));
6928 LocalContext context(NULL, global); 6936 LocalContext context(NULL, global);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
7156 v8::HandleScope scope(CcTest::isolate()); 7164 v8::HandleScope scope(CcTest::isolate());
7157 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); 7165 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
7158 obj->SetNamedPropertyHandler(PGetter2); 7166 obj->SetNamedPropertyHandler(PGetter2);
7159 p_getter_count2 = 0; 7167 p_getter_count2 = 0;
7160 RunHolderTest(obj); 7168 RunHolderTest(obj);
7161 CHECK_EQ(40, p_getter_count2); 7169 CHECK_EQ(40, p_getter_count2);
7162 } 7170 }
7163 7171
7164 7172
7165 THREADED_TEST(ObjectInstantiation) { 7173 THREADED_TEST(ObjectInstantiation) {
7166 v8::HandleScope scope(CcTest::isolate()); 7174 v8::Isolate* isolate = CcTest::isolate();
7175 v8::HandleScope scope(isolate);
7167 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); 7176 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
7168 templ->SetAccessor(v8_str("t"), PGetter2); 7177 templ->SetAccessor(v8_str("t"), PGetter2);
7169 LocalContext context; 7178 LocalContext context;
7170 context->Global()->Set(v8_str("o"), templ->NewInstance()); 7179 context->Global()->Set(v8_str("o"), templ->NewInstance());
7171 for (int i = 0; i < 100; i++) { 7180 for (int i = 0; i < 100; i++) {
7172 v8::HandleScope inner_scope(CcTest::isolate()); 7181 v8::HandleScope inner_scope(CcTest::isolate());
7173 v8::Handle<v8::Object> obj = templ->NewInstance(); 7182 v8::Handle<v8::Object> obj = templ->NewInstance();
7174 CHECK_NE(obj, context->Global()->Get(v8_str("o"))); 7183 CHECK_NE(obj, context->Global()->Get(v8_str("o")));
7175 context->Global()->Set(v8_str("o2"), obj); 7184 context->Global()->Set(v8_str("o2"), obj);
7176 v8::Handle<Value> value = 7185 v8::Handle<Value> value =
7177 Script::Compile(v8_str("o.__proto__ === o2.__proto__"))->Run(); 7186 Script::Compile(v8_str("o.__proto__ === o2.__proto__"))->Run();
7178 CHECK_EQ(v8::True(), value); 7187 CHECK_EQ(v8::True(isolate), value);
7179 context->Global()->Set(v8_str("o"), obj); 7188 context->Global()->Set(v8_str("o"), obj);
7180 } 7189 }
7181 } 7190 }
7182 7191
7183 7192
7184 static int StrCmp16(uint16_t* a, uint16_t* b) { 7193 static int StrCmp16(uint16_t* a, uint16_t* b) {
7185 while (true) { 7194 while (true) {
7186 if (*a == 0 && *b == 0) return 0; 7195 if (*a == 0 && *b == 0) return 0;
7187 if (*a != *b) return 0 + *a - *b; 7196 if (*a != *b) return 0 + *a - *b;
7188 a++; 7197 a++;
(...skipping 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after
9787 9796
9788 static void FakeConstructorCallback( 9797 static void FakeConstructorCallback(
9789 const v8::FunctionCallbackInfo<v8::Value>& args) { 9798 const v8::FunctionCallbackInfo<v8::Value>& args) {
9790 ApiTestFuzzer::Fuzz(); 9799 ApiTestFuzzer::Fuzz();
9791 args.GetReturnValue().Set(args[0]); 9800 args.GetReturnValue().Set(args[0]);
9792 } 9801 }
9793 9802
9794 9803
9795 THREADED_TEST(ConstructorForObject) { 9804 THREADED_TEST(ConstructorForObject) {
9796 LocalContext context; 9805 LocalContext context;
9797 v8::HandleScope handle_scope(context->GetIsolate()); 9806 v8::Isolate* isolate = context->GetIsolate();
9807 v8::HandleScope handle_scope(isolate);
9798 9808
9799 { Local<ObjectTemplate> instance_template = ObjectTemplate::New(); 9809 { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
9800 instance_template->SetCallAsFunctionHandler(ConstructorCallback); 9810 instance_template->SetCallAsFunctionHandler(ConstructorCallback);
9801 Local<Object> instance = instance_template->NewInstance(); 9811 Local<Object> instance = instance_template->NewInstance();
9802 context->Global()->Set(v8_str("obj"), instance); 9812 context->Global()->Set(v8_str("obj"), instance);
9803 v8::TryCatch try_catch; 9813 v8::TryCatch try_catch;
9804 Local<Value> value; 9814 Local<Value> value;
9805 CHECK(!try_catch.HasCaught()); 9815 CHECK(!try_catch.HasCaught());
9806 9816
9807 // Call the Object's constructor with a 32-bit signed integer. 9817 // Call the Object's constructor with a 32-bit signed integer.
(...skipping 28 matching lines...) Expand all
9836 CHECK(value->IsString()); 9846 CHECK(value->IsString());
9837 String::Utf8Value string_value2(value->ToString()); 9847 String::Utf8Value string_value2(value->ToString());
9838 CHECK_EQ("tipli", *string_value2); 9848 CHECK_EQ("tipli", *string_value2);
9839 9849
9840 // Call the Object's constructor with a Boolean. 9850 // Call the Object's constructor with a Boolean.
9841 value = CompileRun("(function() { var o = new obj(true); return o.a; })()"); 9851 value = CompileRun("(function() { var o = new obj(true); return o.a; })()");
9842 CHECK(!try_catch.HasCaught()); 9852 CHECK(!try_catch.HasCaught());
9843 CHECK(value->IsBoolean()); 9853 CHECK(value->IsBoolean());
9844 CHECK_EQ(true, value->BooleanValue()); 9854 CHECK_EQ(true, value->BooleanValue());
9845 9855
9846 Handle<Value> args3[] = { v8::True() }; 9856 Handle<Value> args3[] = { v8::True(isolate) };
9847 Local<Value> value_obj3 = instance->CallAsConstructor(1, args3); 9857 Local<Value> value_obj3 = instance->CallAsConstructor(1, args3);
9848 CHECK(value_obj3->IsObject()); 9858 CHECK(value_obj3->IsObject());
9849 Local<Object> object3 = Local<Object>::Cast(value_obj3); 9859 Local<Object> object3 = Local<Object>::Cast(value_obj3);
9850 value = object3->Get(v8_str("a")); 9860 value = object3->Get(v8_str("a"));
9851 CHECK(!try_catch.HasCaught()); 9861 CHECK(!try_catch.HasCaught());
9852 CHECK(value->IsBoolean()); 9862 CHECK(value->IsBoolean());
9853 CHECK_EQ(true, value->BooleanValue()); 9863 CHECK_EQ(true, value->BooleanValue());
9854 9864
9855 // Call the Object's constructor with undefined. 9865 // Call the Object's constructor with undefined.
9856 Handle<Value> args4[] = { v8::Undefined() }; 9866 Handle<Value> args4[] = { v8::Undefined(isolate) };
9857 Local<Value> value_obj4 = instance->CallAsConstructor(1, args4); 9867 Local<Value> value_obj4 = instance->CallAsConstructor(1, args4);
9858 CHECK(value_obj4->IsObject()); 9868 CHECK(value_obj4->IsObject());
9859 Local<Object> object4 = Local<Object>::Cast(value_obj4); 9869 Local<Object> object4 = Local<Object>::Cast(value_obj4);
9860 value = object4->Get(v8_str("a")); 9870 value = object4->Get(v8_str("a"));
9861 CHECK(!try_catch.HasCaught()); 9871 CHECK(!try_catch.HasCaught());
9862 CHECK(value->IsUndefined()); 9872 CHECK(value->IsUndefined());
9863 9873
9864 // Call the Object's constructor with null. 9874 // Call the Object's constructor with null.
9865 Handle<Value> args5[] = { v8::Null() }; 9875 Handle<Value> args5[] = { v8::Null(isolate) };
9866 Local<Value> value_obj5 = instance->CallAsConstructor(1, args5); 9876 Local<Value> value_obj5 = instance->CallAsConstructor(1, args5);
9867 CHECK(value_obj5->IsObject()); 9877 CHECK(value_obj5->IsObject());
9868 Local<Object> object5 = Local<Object>::Cast(value_obj5); 9878 Local<Object> object5 = Local<Object>::Cast(value_obj5);
9869 value = object5->Get(v8_str("a")); 9879 value = object5->Get(v8_str("a"));
9870 CHECK(!try_catch.HasCaught()); 9880 CHECK(!try_catch.HasCaught());
9871 CHECK(value->IsNull()); 9881 CHECK(value->IsNull());
9872 } 9882 }
9873 9883
9874 // Check exception handling when there is no constructor set for the Object. 9884 // Check exception handling when there is no constructor set for the Object.
9875 { Local<ObjectTemplate> instance_template = ObjectTemplate::New(); 9885 { Local<ObjectTemplate> instance_template = ObjectTemplate::New();
(...skipping 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
13725 static bool IndexedSetAccessBlocker(Local<v8::Object> obj, 13735 static bool IndexedSetAccessBlocker(Local<v8::Object> obj,
13726 uint32_t key, 13736 uint32_t key,
13727 v8::AccessType type, 13737 v8::AccessType type,
13728 Local<Value> data) { 13738 Local<Value> data) {
13729 return type != v8::ACCESS_SET; 13739 return type != v8::ACCESS_SET;
13730 } 13740 }
13731 13741
13732 13742
13733 THREADED_TEST(DisableAccessChecksWhileConfiguring) { 13743 THREADED_TEST(DisableAccessChecksWhileConfiguring) {
13734 LocalContext context; 13744 LocalContext context;
13735 v8::HandleScope scope(context->GetIsolate()); 13745 v8::Isolate* isolate = context->GetIsolate();
13746 v8::HandleScope scope(isolate);
13736 Local<ObjectTemplate> templ = ObjectTemplate::New(); 13747 Local<ObjectTemplate> templ = ObjectTemplate::New();
13737 templ->SetAccessCheckCallbacks(NamedSetAccessBlocker, 13748 templ->SetAccessCheckCallbacks(NamedSetAccessBlocker,
13738 IndexedSetAccessBlocker); 13749 IndexedSetAccessBlocker);
13739 templ->Set(v8_str("x"), v8::True()); 13750 templ->Set(v8_str("x"), v8::True(isolate));
13740 Local<v8::Object> instance = templ->NewInstance(); 13751 Local<v8::Object> instance = templ->NewInstance();
13741 context->Global()->Set(v8_str("obj"), instance); 13752 context->Global()->Set(v8_str("obj"), instance);
13742 Local<Value> value = CompileRun("obj.x"); 13753 Local<Value> value = CompileRun("obj.x");
13743 CHECK(value->BooleanValue()); 13754 CHECK(value->BooleanValue());
13744 } 13755 }
13745 13756
13746 13757
13747 static bool NamedGetAccessBlocker(Local<v8::Object> obj, 13758 static bool NamedGetAccessBlocker(Local<v8::Object> obj,
13748 Local<Value> name, 13759 Local<Value> name,
13749 v8::AccessType type, 13760 v8::AccessType type,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
14146 // This tests that we do not allow dictionary load/call inline caches 14157 // This tests that we do not allow dictionary load/call inline caches
14147 // to use functions that have not yet been compiled. The potential 14158 // to use functions that have not yet been compiled. The potential
14148 // problem of loading a function that has not yet been compiled can 14159 // problem of loading a function that has not yet been compiled can
14149 // arise because we share code between contexts via the compilation 14160 // arise because we share code between contexts via the compilation
14150 // cache. 14161 // cache.
14151 THREADED_TEST(DictionaryICLoadedFunction) { 14162 THREADED_TEST(DictionaryICLoadedFunction) {
14152 v8::HandleScope scope(CcTest::isolate()); 14163 v8::HandleScope scope(CcTest::isolate());
14153 // Test LoadIC. 14164 // Test LoadIC.
14154 for (int i = 0; i < 2; i++) { 14165 for (int i = 0; i < 2; i++) {
14155 LocalContext context; 14166 LocalContext context;
14156 context->Global()->Set(v8_str("tmp"), v8::True()); 14167 context->Global()->Set(v8_str("tmp"), v8::True(CcTest::isolate()));
14157 context->Global()->Delete(v8_str("tmp")); 14168 context->Global()->Delete(v8_str("tmp"));
14158 CompileRun("for (var j = 0; j < 10; j++) new RegExp('');"); 14169 CompileRun("for (var j = 0; j < 10; j++) new RegExp('');");
14159 } 14170 }
14160 // Test CallIC. 14171 // Test CallIC.
14161 for (int i = 0; i < 2; i++) { 14172 for (int i = 0; i < 2; i++) {
14162 LocalContext context; 14173 LocalContext context;
14163 context->Global()->Set(v8_str("tmp"), v8::True()); 14174 context->Global()->Set(v8_str("tmp"), v8::True(CcTest::isolate()));
14164 context->Global()->Delete(v8_str("tmp")); 14175 context->Global()->Delete(v8_str("tmp"));
14165 CompileRun("for (var j = 0; j < 10; j++) RegExp('')"); 14176 CompileRun("for (var j = 0; j < 10; j++) RegExp('')");
14166 } 14177 }
14167 } 14178 }
14168 14179
14169 14180
14170 // Test that cross-context new calls use the context of the callee to 14181 // Test that cross-context new calls use the context of the callee to
14171 // create the new JavaScript object. 14182 // create the new JavaScript object.
14172 THREADED_TEST(CrossContextNew) { 14183 THREADED_TEST(CrossContextNew) {
14173 v8::Isolate* isolate = CcTest::isolate(); 14184 v8::Isolate* isolate = CcTest::isolate();
(...skipping 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after
19387 global_template->Set(v8_str("proxy"), proxy_object); 19398 global_template->Set(v8_str("proxy"), proxy_object);
19388 global_template->Set(v8_str("hidden"), object_with_hidden); 19399 global_template->Set(v8_str("hidden"), object_with_hidden);
19389 global_template->Set(v8_str("phidden"), object_with_protected_hidden); 19400 global_template->Set(v8_str("phidden"), object_with_protected_hidden);
19390 19401
19391 LocalContext context2(NULL, global_template); 19402 LocalContext context2(NULL, global_template);
19392 19403
19393 Local<Value> result1 = CompileRun("Object.getPrototypeOf(simple)"); 19404 Local<Value> result1 = CompileRun("Object.getPrototypeOf(simple)");
19394 CHECK(result1->Equals(simple_object->GetPrototype())); 19405 CHECK(result1->Equals(simple_object->GetPrototype()));
19395 19406
19396 Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)"); 19407 Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)");
19397 CHECK(result2->Equals(Undefined())); 19408 CHECK(result2->Equals(Undefined(isolate)));
19398 19409
19399 Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)"); 19410 Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)");
19400 CHECK(result3->Equals(global_object->GetPrototype())); 19411 CHECK(result3->Equals(global_object->GetPrototype()));
19401 19412
19402 Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)"); 19413 Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)");
19403 CHECK(result4->Equals(Undefined())); 19414 CHECK(result4->Equals(Undefined(isolate)));
19404 19415
19405 Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)"); 19416 Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
19406 CHECK(result5->Equals( 19417 CHECK(result5->Equals(
19407 object_with_hidden->GetPrototype()->ToObject()->GetPrototype())); 19418 object_with_hidden->GetPrototype()->ToObject()->GetPrototype()));
19408 19419
19409 Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)"); 19420 Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)");
19410 CHECK(result6->Equals(Undefined())); 19421 CHECK(result6->Equals(Undefined(isolate)));
19411 } 19422 }
19412 19423
19413 19424
19414 THREADED_TEST(Regress125988) { 19425 THREADED_TEST(Regress125988) {
19415 v8::HandleScope scope(CcTest::isolate()); 19426 v8::HandleScope scope(CcTest::isolate());
19416 Handle<FunctionTemplate> intercept = FunctionTemplate::New(); 19427 Handle<FunctionTemplate> intercept = FunctionTemplate::New();
19417 AddInterceptor(intercept, EmptyInterceptorGetter, EmptyInterceptorSetter); 19428 AddInterceptor(intercept, EmptyInterceptorGetter, EmptyInterceptorSetter);
19418 LocalContext env; 19429 LocalContext env;
19419 env->Global()->Set(v8_str("Intercept"), intercept->GetFunction()); 19430 env->Global()->Set(v8_str("Intercept"), intercept->GetFunction());
19420 CompileRun("var a = new Object();" 19431 CompileRun("var a = new Object();"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
19699 StubCacheHelper(false); 19710 StubCacheHelper(false);
19700 } 19711 }
19701 19712
19702 19713
19703 TEST(StaticGetters) { 19714 TEST(StaticGetters) {
19704 LocalContext context; 19715 LocalContext context;
19705 i::Factory* factory = CcTest::i_isolate()->factory(); 19716 i::Factory* factory = CcTest::i_isolate()->factory();
19706 v8::Isolate* isolate = CcTest::isolate(); 19717 v8::Isolate* isolate = CcTest::isolate();
19707 v8::HandleScope scope(isolate); 19718 v8::HandleScope scope(isolate);
19708 i::Handle<i::Object> undefined_value = factory->undefined_value(); 19719 i::Handle<i::Object> undefined_value = factory->undefined_value();
19709 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value);
19710 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); 19720 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value);
19711 i::Handle<i::Object> null_value = factory->null_value(); 19721 i::Handle<i::Object> null_value = factory->null_value();
19712 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value);
19713 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); 19722 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value);
19714 i::Handle<i::Object> true_value = factory->true_value(); 19723 i::Handle<i::Object> true_value = factory->true_value();
19715 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value);
19716 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); 19724 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value);
19717 i::Handle<i::Object> false_value = factory->false_value(); 19725 i::Handle<i::Object> false_value = factory->false_value();
19718 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value);
19719 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); 19726 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value);
19720 } 19727 }
19721 19728
19722 19729
19723 UNINITIALIZED_TEST(IsolateEmbedderData) { 19730 UNINITIALIZED_TEST(IsolateEmbedderData) {
19724 CcTest::DisableAutomaticDispose(); 19731 CcTest::DisableAutomaticDispose();
19725 v8::Isolate* isolate = v8::Isolate::New(); 19732 v8::Isolate* isolate = v8::Isolate::New();
19726 isolate->Enter(); 19733 isolate->Enter();
19727 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 19734 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
19728 CHECK_EQ(NULL, isolate->GetData()); 19735 CHECK_EQ(NULL, isolate->GetData());
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
20151 Local<Object> set_object(Local<Object>::Cast(set_value)); 20158 Local<Object> set_object(Local<Object>::Cast(set_value));
20152 CHECK_EQ(0, set_object->InternalFieldCount()); 20159 CHECK_EQ(0, set_object->InternalFieldCount());
20153 Local<Value> map_value = CompileRun("new Map();"); 20160 Local<Value> map_value = CompileRun("new Map();");
20154 Local<Object> map_object(Local<Object>::Cast(map_value)); 20161 Local<Object> map_object(Local<Object>::Cast(map_value));
20155 CHECK_EQ(0, map_object->InternalFieldCount()); 20162 CHECK_EQ(0, map_object->InternalFieldCount());
20156 } 20163 }
20157 20164
20158 20165
20159 THREADED_TEST(Regress2746) { 20166 THREADED_TEST(Regress2746) {
20160 LocalContext context; 20167 LocalContext context;
20161 v8::HandleScope scope(context->GetIsolate()); 20168 v8::Isolate* isolate = context->GetIsolate();
20169 v8::HandleScope scope(isolate);
20162 Local<Object> obj = Object::New(); 20170 Local<Object> obj = Object::New();
20163 Local<String> key = String::New("key"); 20171 Local<String> key = String::New("key");
20164 obj->SetHiddenValue(key, v8::Undefined()); 20172 obj->SetHiddenValue(key, v8::Undefined(isolate));
20165 Local<Value> value = obj->GetHiddenValue(key); 20173 Local<Value> value = obj->GetHiddenValue(key);
20166 CHECK(!value.IsEmpty()); 20174 CHECK(!value.IsEmpty());
20167 CHECK(value->IsUndefined()); 20175 CHECK(value->IsUndefined());
20168 } 20176 }
20169 20177
20170 20178
20171 THREADED_TEST(Regress260106) { 20179 THREADED_TEST(Regress260106) {
20172 LocalContext context; 20180 LocalContext context;
20173 v8::HandleScope scope(context->GetIsolate()); 20181 v8::HandleScope scope(context->GetIsolate());
20174 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler); 20182 Local<FunctionTemplate> templ = FunctionTemplate::New(DummyCallHandler);
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
20578 Local<Object> data2 = v8::Object::New(); 20586 Local<Object> data2 = v8::Object::New();
20579 function_new_expected_env = data2; 20587 function_new_expected_env = data2;
20580 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); 20588 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2);
20581 CHECK(!func2->IsNull()); 20589 CHECK(!func2->IsNull());
20582 CHECK_NE(func, func2); 20590 CHECK_NE(func, func2);
20583 env->Global()->Set(v8_str("func2"), func2); 20591 env->Global()->Set(v8_str("func2"), func2);
20584 Local<Value> result2 = CompileRun("func2();"); 20592 Local<Value> result2 = CompileRun("func2();");
20585 CHECK_EQ(v8::Integer::New(17, isolate), result2); 20593 CHECK_EQ(v8::Integer::New(17, isolate), result2);
20586 } 20594 }
20587 20595
OLDNEW
« no previous file with comments | « test/cctest/test-accessors.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698