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 21463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21474 { | 21474 { |
21475 v8::MicrotasksScope scope(env->GetIsolate(), | 21475 v8::MicrotasksScope scope(env->GetIsolate(), |
21476 v8::MicrotasksScope::kDoNotRunMicrotasks); | 21476 v8::MicrotasksScope::kDoNotRunMicrotasks); |
21477 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); | 21477 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); |
21478 CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); | 21478 CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); |
21479 } | 21479 } |
21480 | 21480 |
21481 env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); | 21481 env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); |
21482 } | 21482 } |
21483 | 21483 |
21484 #if defined(ENABLE_DISASSEMBLER) && !defined(V8_USE_EXTERNAL_STARTUP_DATA) | 21484 #ifdef ENABLE_DISASSEMBLER |
21485 // FLAG_test_primary_stub_cache and FLAG_test_secondary_stub_cache are read | 21485 // FLAG_test_primary_stub_cache and FLAG_test_secondary_stub_cache are read |
21486 // only when ENABLE_DISASSEMBLER is not defined. | 21486 // only when ENABLE_DISASSEMBLER is not defined. |
21487 // These tests are valid only for no-snapshot mode. | |
21488 | 21487 |
21489 namespace { | 21488 namespace { |
21490 | 21489 |
21491 int probes_counter = 0; | 21490 int probes_counter = 0; |
21492 int misses_counter = 0; | 21491 int misses_counter = 0; |
21493 int updates_counter = 0; | 21492 int updates_counter = 0; |
21494 | 21493 |
21495 int* LookupCounter(const char* name) { | 21494 int* LookupCounter(const char* name) { |
21496 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { | 21495 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { |
21497 return &probes_counter; | 21496 return &probes_counter; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21530 i::FLAG_test_primary_stub_cache = true; | 21529 i::FLAG_test_primary_stub_cache = true; |
21531 } else { | 21530 } else { |
21532 i::FLAG_test_secondary_stub_cache = true; | 21531 i::FLAG_test_secondary_stub_cache = true; |
21533 } | 21532 } |
21534 i::FLAG_crankshaft = false; | 21533 i::FLAG_crankshaft = false; |
21535 i::FLAG_turbo = false; | 21534 i::FLAG_turbo = false; |
21536 v8::Isolate::CreateParams create_params; | 21535 v8::Isolate::CreateParams create_params; |
21537 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 21536 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
21538 create_params.counter_lookup_callback = LookupCounter; | 21537 create_params.counter_lookup_callback = LookupCounter; |
21539 v8::Isolate* isolate = v8::Isolate::New(create_params); | 21538 v8::Isolate* isolate = v8::Isolate::New(create_params); |
| 21539 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
21540 | 21540 |
21541 { | 21541 if (!i_isolate->snapshot_available()) { |
| 21542 // The test is valid only for no-snapshot mode. |
21542 v8::Isolate::Scope isolate_scope(isolate); | 21543 v8::Isolate::Scope isolate_scope(isolate); |
21543 LocalContext env(isolate); | 21544 LocalContext env(isolate); |
21544 v8::HandleScope scope(isolate); | 21545 v8::HandleScope scope(isolate); |
21545 | 21546 |
21546 int initial_probes = probes_counter; | 21547 int initial_probes = probes_counter; |
21547 int initial_misses = misses_counter; | 21548 int initial_misses = misses_counter; |
21548 int initial_updates = updates_counter; | 21549 int initial_updates = updates_counter; |
21549 CompileRun(kMegamorphicTestProgram); | 21550 CompileRun(kMegamorphicTestProgram); |
21550 int probes = probes_counter - initial_probes; | 21551 int probes = probes_counter - initial_probes; |
21551 int misses = misses_counter - initial_misses; | 21552 int misses = misses_counter - initial_misses; |
(...skipping 11 matching lines...) Expand all Loading... |
21563 } | 21564 } |
21564 isolate->Dispose(); | 21565 isolate->Dispose(); |
21565 } | 21566 } |
21566 | 21567 |
21567 } // namespace | 21568 } // namespace |
21568 | 21569 |
21569 UNINITIALIZED_TEST(PrimaryStubCache) { StubCacheHelper(true); } | 21570 UNINITIALIZED_TEST(PrimaryStubCache) { StubCacheHelper(true); } |
21570 | 21571 |
21571 UNINITIALIZED_TEST(SecondaryStubCache) { StubCacheHelper(false); } | 21572 UNINITIALIZED_TEST(SecondaryStubCache) { StubCacheHelper(false); } |
21572 | 21573 |
21573 #endif // ENABLE_DISASSEMBLER && !V8_USE_EXTERNAL_STARTUP_DATA | 21574 #endif // ENABLE_DISASSEMBLER |
21574 | 21575 |
21575 #ifdef DEBUG | 21576 #ifdef DEBUG |
21576 static int cow_arrays_created_runtime = 0; | 21577 static int cow_arrays_created_runtime = 0; |
21577 | 21578 |
21578 | 21579 |
21579 static int* LookupCounterCOWArrays(const char* name) { | 21580 static int* LookupCounterCOWArrays(const char* name) { |
21580 if (strcmp(name, "c:V8.COWArraysCreatedRuntime") == 0) { | 21581 if (strcmp(name, "c:V8.COWArraysCreatedRuntime") == 0) { |
21581 return &cow_arrays_created_runtime; | 21582 return &cow_arrays_created_runtime; |
21582 } | 21583 } |
21583 return NULL; | 21584 return NULL; |
(...skipping 3784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25368 } | 25369 } |
25369 | 25370 |
25370 TEST(PrivateForApiIsNumber) { | 25371 TEST(PrivateForApiIsNumber) { |
25371 LocalContext context; | 25372 LocalContext context; |
25372 v8::Isolate* isolate = CcTest::isolate(); | 25373 v8::Isolate* isolate = CcTest::isolate(); |
25373 v8::HandleScope scope(isolate); | 25374 v8::HandleScope scope(isolate); |
25374 | 25375 |
25375 // Shouldn't crash. | 25376 // Shouldn't crash. |
25376 v8::Private::ForApi(isolate, v8_str("42")); | 25377 v8::Private::ForApi(isolate, v8_str("42")); |
25377 } | 25378 } |
OLD | NEW |