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 20803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20814 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value()); | 20814 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value()); |
20815 CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value()); | 20815 CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value()); |
20816 } | 20816 } |
20817 | 20817 |
20818 CompileRun("1+1;"); | 20818 CompileRun("1+1;"); |
20819 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value()); | 20819 CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value()); |
20820 CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value()); | 20820 CHECK_EQ(4, CompileRun("ext2Calls")->Int32Value()); |
20821 } | 20821 } |
20822 | 20822 |
20823 | 20823 |
| 20824 TEST(RunMicrotasksWithoutEnteringContext) { |
| 20825 v8::Isolate* isolate = CcTest::isolate(); |
| 20826 HandleScope handle_scope(isolate); |
| 20827 isolate->SetAutorunMicrotasks(false); |
| 20828 Handle<Context> context = Context::New(isolate); |
| 20829 { |
| 20830 Context::Scope context_scope(context); |
| 20831 CompileRun("var ext1Calls = 0;"); |
| 20832 isolate->EnqueueMicrotask(Function::New(isolate, MicrotaskOne)); |
| 20833 } |
| 20834 isolate->RunMicrotasks(); |
| 20835 { |
| 20836 Context::Scope context_scope(context); |
| 20837 CHECK_EQ(1, CompileRun("ext1Calls")->Int32Value()); |
| 20838 } |
| 20839 isolate->SetAutorunMicrotasks(true); |
| 20840 } |
| 20841 |
| 20842 |
20824 static int probes_counter = 0; | 20843 static int probes_counter = 0; |
20825 static int misses_counter = 0; | 20844 static int misses_counter = 0; |
20826 static int updates_counter = 0; | 20845 static int updates_counter = 0; |
20827 | 20846 |
20828 | 20847 |
20829 static int* LookupCounter(const char* name) { | 20848 static int* LookupCounter(const char* name) { |
20830 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { | 20849 if (strcmp(name, "c:V8.MegamorphicStubCacheProbes") == 0) { |
20831 return &probes_counter; | 20850 return &probes_counter; |
20832 } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) { | 20851 } else if (strcmp(name, "c:V8.MegamorphicStubCacheMisses") == 0) { |
20833 return &misses_counter; | 20852 return &misses_counter; |
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22514 v8::internal::FLAG_stack_size = 150; | 22533 v8::internal::FLAG_stack_size = 150; |
22515 LocalContext current; | 22534 LocalContext current; |
22516 v8::Isolate* isolate = current->GetIsolate(); | 22535 v8::Isolate* isolate = current->GetIsolate(); |
22517 v8::HandleScope scope(isolate); | 22536 v8::HandleScope scope(isolate); |
22518 V8::SetCaptureStackTraceForUncaughtExceptions( | 22537 V8::SetCaptureStackTraceForUncaughtExceptions( |
22519 true, 10, v8::StackTrace::kDetailed); | 22538 true, 10, v8::StackTrace::kDetailed); |
22520 v8::TryCatch try_catch; | 22539 v8::TryCatch try_catch; |
22521 CompileRun("(function f(x) { f(x+1); })(0)"); | 22540 CompileRun("(function f(x) { f(x+1); })(0)"); |
22522 CHECK(try_catch.HasCaught()); | 22541 CHECK(try_catch.HasCaught()); |
22523 } | 22542 } |
OLD | NEW |