Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(397)

Unified Diff: runtime/vm/stack_frame_test.cc

Issue 1191813002: Port "Add flag to disable lazy compilation of invocation dispatchers." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stack_frame_test.cc
diff --git a/runtime/vm/stack_frame_test.cc b/runtime/vm/stack_frame_test.cc
index 2472160ae6482872b93fbc2c8e9ed76f98802941..fd728776f899883b8d3a7699e9a319b302d9ea1b 100644
--- a/runtime/vm/stack_frame_test.cc
+++ b/runtime/vm/stack_frame_test.cc
@@ -16,6 +16,8 @@
namespace dart {
+DECLARE_FLAG(bool, lazy_dispatchers);
+
// Unit test for empty stack frame iteration.
TEST_CASE(EmptyStackFrameIteration) {
StackFrameIterator iterator(StackFrameIterator::kValidateFrames);
@@ -246,7 +248,12 @@ TEST_CASE(ValidateStackFrameIteration) {
// Unit test case to verify stack frame iteration.
TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
- const char* kScriptChars =
+ const char* kScriptChars;
+ // The true stack depends on which strategy we are using for noSuchMethod. The
+ // stacktrace as seen by Dart is the same either way because dispatcher
+ // methods are marked invisible.
+ if (FLAG_lazy_dispatchers) {
+ kScriptChars =
"class StackFrame {"
" static equals(var obj1, var obj2) native \"StackFrame_equals\";"
" static int frameCount() native \"StackFrame_frameCount\";"
@@ -278,6 +285,41 @@ TEST_CASE(ValidateNoSuchMethodStackFrameIteration) {
" StackFrame.equals(5, obj.foo(101, 202));"
" }"
"}";
+ } else {
+ kScriptChars =
+ "class StackFrame {"
+ " static equals(var obj1, var obj2) native \"StackFrame_equals\";"
+ " static int frameCount() native \"StackFrame_frameCount\";"
+ " static int dartFrameCount() native \"StackFrame_dartFrameCount\";"
+ " static validateFrame(int index,"
+ " String name) native \"StackFrame_validateFrame\";"
+ "} "
+ "class StackFrame2Test {"
+ " StackFrame2Test() {}"
+ " noSuchMethod(Invocation im) {"
+ " /* We should have 8 general frames and 3 dart frames as follows:"
+ " * exit frame"
+ " * dart frame corresponding to StackFrame.frameCount"
+ " * dart frame corresponding to StackFrame2Test.noSuchMethod"
+ " * entry frame"
+ " * exit frame (call to runtime InvokeNoSuchMethodDispatcher)"
+ " * IC stub"
+ " * dart frame corresponding to StackFrame2Test.testMain"
+ " * entry frame"
+ " */"
+ " StackFrame.equals(8, StackFrame.frameCount());"
+ " StackFrame.equals(3, StackFrame.dartFrameCount());"
+ " StackFrame.validateFrame(0, \"StackFrame_validateFrame\");"
+ " StackFrame.validateFrame(1, \"StackFrame2Test_noSuchMethod\");"
+ " StackFrame.validateFrame(2, \"StackFrame2Test_testMain\");"
+ " return 5;"
+ " }"
+ " static testMain() {"
+ " var obj = new StackFrame2Test();"
+ " StackFrame.equals(5, obj.foo(101, 202));"
+ " }"
+ "}";
+ }
Dart_Handle lib = TestCase::LoadTestScript(
kScriptChars,
reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
« no previous file with comments | « runtime/vm/dart_entry.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698