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 6661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6672 if (builtin->is_promise_rejection() || builtin->is_exception_caught()) | 6672 if (builtin->is_promise_rejection() || builtin->is_exception_caught()) |
6673 continue; | 6673 continue; |
6674 | 6674 |
6675 if (whitelist.find(i) != whitelist.end()) continue; | 6675 if (whitelist.find(i) != whitelist.end()) continue; |
6676 | 6676 |
6677 fail = true; | 6677 fail = true; |
6678 i::PrintF("%s is missing exception predictions.\n", builtins->name(i)); | 6678 i::PrintF("%s is missing exception predictions.\n", builtins->name(i)); |
6679 } | 6679 } |
6680 CHECK(!fail); | 6680 CHECK(!fail); |
6681 } | 6681 } |
6682 | |
6683 TEST(DebugGetPossibleBreakpointsReturnLocations) { | |
6684 LocalContext env; | |
6685 v8::Isolate* isolate = env->GetIsolate(); | |
6686 v8::HandleScope scope(isolate); | |
6687 v8::Local<v8::String> source = v8_str( | |
6688 "function fib(x) {\n" | |
6689 " if (x < 0) return;\n" | |
6690 " if (x === 0) return 1;\n" | |
6691 " if (x === 1) return fib(0);\n" | |
6692 " return x > 2 ? fib(x - 1) + fib(x - 2) : fib(1) + fib(0);\n" | |
6693 "}"); | |
6694 CompileRun(source); | |
6695 v8::PersistentValueVector<v8::debug::Script> scripts(isolate); | |
6696 v8::debug::GetLoadedScripts(isolate, scripts); | |
6697 CHECK(scripts.Size() == 1); | |
6698 std::vector<v8::debug::BreakLocation> locations; | |
6699 CHECK(scripts.Get(0)->GetPossibleBreakpoints( | |
6700 v8::debug::Location(0, 17), v8::debug::Location(), true, &locations)); | |
6701 int returns_count = 0; | |
6702 for (size_t i = 0; i < locations.size(); ++i) { | |
6703 if (locations[i].type() == v8::debug::kReturnBreakLocation) { | |
6704 ++returns_count; | |
6705 } | |
6706 } | |
6707 if (i::FLAG_turbo) { | |
6708 // With turbofan we generate one return location per return statement, | |
kozy
2017/03/18 00:48:05
I found this behavior during work on this CL and c
| |
6709 // each has line = 5, column = 0 as statement position. | |
6710 CHECK(returns_count == 4); | |
6711 } else { | |
6712 // Without turbofan we generate one return location. | |
6713 CHECK(returns_count == 1); | |
6714 } | |
6715 } | |
OLD | NEW |