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 16390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16401 | 16401 |
16402 TEST(SecondaryStubCache) { | 16402 TEST(SecondaryStubCache) { |
16403 StubCacheHelper(true); | 16403 StubCacheHelper(true); |
16404 } | 16404 } |
16405 | 16405 |
16406 | 16406 |
16407 TEST(PrimaryStubCache) { | 16407 TEST(PrimaryStubCache) { |
16408 StubCacheHelper(false); | 16408 StubCacheHelper(false); |
16409 } | 16409 } |
16410 | 16410 |
| 16411 |
| 16412 TEST(StaticGetters) { |
| 16413 v8::HandleScope scope; |
| 16414 LocalContext context; |
| 16415 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 16416 i::Handle<i::Object> undefined_value = FACTORY->undefined_value(); |
| 16417 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); |
| 16418 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); |
| 16419 i::Handle<i::Object> null_value = FACTORY->null_value(); |
| 16420 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); |
| 16421 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); |
| 16422 i::Handle<i::Object> true_value = FACTORY->true_value(); |
| 16423 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); |
| 16424 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); |
| 16425 i::Handle<i::Object> false_value = FACTORY->false_value(); |
| 16426 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); |
| 16427 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
| 16428 } |
| 16429 |
| 16430 |
| 16431 static int fatal_error_callback_counter = 0; |
| 16432 static void CountingErrorCallback(const char* location, const char* message) { |
| 16433 printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message); |
| 16434 fatal_error_callback_counter++; |
| 16435 } |
| 16436 |
| 16437 |
| 16438 TEST(StaticGettersAfterDeath) { |
| 16439 v8::HandleScope scope; |
| 16440 LocalContext context; |
| 16441 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 16442 CHECK(i::Internals::IsInitialized(isolate)); |
| 16443 CHECK_EQ(0, fatal_error_callback_counter); |
| 16444 v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
| 16445 v8::Utils::ReportApiFailure("StaticGettersAfterDeath()", "Kill V8"); |
| 16446 i::Isolate::Current()->TearDown(); |
| 16447 CHECK(!i::Internals::IsInitialized(isolate)); |
| 16448 CHECK_EQ(1, fatal_error_callback_counter); |
| 16449 CHECK(v8::Undefined().IsEmpty()); |
| 16450 CHECK_EQ(2, fatal_error_callback_counter); |
| 16451 CHECK(v8::Undefined(isolate).IsEmpty()); |
| 16452 CHECK_EQ(3, fatal_error_callback_counter); |
| 16453 CHECK(v8::Null().IsEmpty()); |
| 16454 CHECK_EQ(4, fatal_error_callback_counter); |
| 16455 CHECK(v8::Null(isolate).IsEmpty()); |
| 16456 CHECK_EQ(5, fatal_error_callback_counter); |
| 16457 CHECK(v8::True().IsEmpty()); |
| 16458 CHECK_EQ(6, fatal_error_callback_counter); |
| 16459 CHECK(v8::True(isolate).IsEmpty()); |
| 16460 CHECK_EQ(7, fatal_error_callback_counter); |
| 16461 CHECK(v8::False().IsEmpty()); |
| 16462 CHECK_EQ(8, fatal_error_callback_counter); |
| 16463 CHECK(v8::False(isolate).IsEmpty()); |
| 16464 CHECK_EQ(9, fatal_error_callback_counter); |
| 16465 } |
OLD | NEW |