OLD | NEW |
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 16430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16441 | 16441 |
16442 | 16442 |
16443 TEST(SecondaryStubCache) { | 16443 TEST(SecondaryStubCache) { |
16444 StubCacheHelper(true); | 16444 StubCacheHelper(true); |
16445 } | 16445 } |
16446 | 16446 |
16447 | 16447 |
16448 TEST(PrimaryStubCache) { | 16448 TEST(PrimaryStubCache) { |
16449 StubCacheHelper(false); | 16449 StubCacheHelper(false); |
16450 } | 16450 } |
| 16451 |
| 16452 |
| 16453 TEST(StaticGetters) { |
| 16454 v8::HandleScope scope; |
| 16455 LocalContext context; |
| 16456 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 16457 i::Handle<i::Object> undefined_value = FACTORY->undefined_value(); |
| 16458 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); |
| 16459 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); |
| 16460 i::Handle<i::Object> null_value = FACTORY->null_value(); |
| 16461 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); |
| 16462 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); |
| 16463 i::Handle<i::Object> true_value = FACTORY->true_value(); |
| 16464 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); |
| 16465 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); |
| 16466 i::Handle<i::Object> false_value = FACTORY->false_value(); |
| 16467 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); |
| 16468 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
| 16469 } |
| 16470 |
| 16471 |
| 16472 static int fatal_error_callback_counter = 0; |
| 16473 static void CountingErrorCallback(const char* location, const char* message) { |
| 16474 printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message); |
| 16475 fatal_error_callback_counter++; |
| 16476 } |
| 16477 |
| 16478 |
| 16479 TEST(StaticGettersAfterDeath) { |
| 16480 v8::HandleScope scope; |
| 16481 LocalContext context; |
| 16482 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 16483 CHECK(i::Internals::IsInitialized(isolate)); |
| 16484 CHECK_EQ(0, fatal_error_callback_counter); |
| 16485 v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
| 16486 v8::Utils::ReportApiFailure("StaticGettersAfterDeath()", "Kill V8"); |
| 16487 i::Isolate::Current()->TearDown(); |
| 16488 CHECK(!i::Internals::IsInitialized(isolate)); |
| 16489 CHECK_EQ(1, fatal_error_callback_counter); |
| 16490 CHECK(v8::Undefined().IsEmpty()); |
| 16491 CHECK_EQ(2, fatal_error_callback_counter); |
| 16492 CHECK(v8::Undefined(isolate).IsEmpty()); |
| 16493 CHECK_EQ(3, fatal_error_callback_counter); |
| 16494 CHECK(v8::Null().IsEmpty()); |
| 16495 CHECK_EQ(4, fatal_error_callback_counter); |
| 16496 CHECK(v8::Null(isolate).IsEmpty()); |
| 16497 CHECK_EQ(5, fatal_error_callback_counter); |
| 16498 CHECK(v8::True().IsEmpty()); |
| 16499 CHECK_EQ(6, fatal_error_callback_counter); |
| 16500 CHECK(v8::True(isolate).IsEmpty()); |
| 16501 CHECK_EQ(7, fatal_error_callback_counter); |
| 16502 CHECK(v8::False().IsEmpty()); |
| 16503 CHECK_EQ(8, fatal_error_callback_counter); |
| 16504 CHECK(v8::False(isolate).IsEmpty()); |
| 16505 CHECK_EQ(9, fatal_error_callback_counter); |
| 16506 } |
OLD | NEW |