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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 9562045: Added stack overflow checks at backward branches in order to allow interrupting endless loops. Bett… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_generator_x64.cc ('k') | runtime/vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_api_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 3583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3594 } 3594 }
3595 3595
3596 3596
3597 static Dart_NativeFunction IsolateInterruptTestNativeLookup( 3597 static Dart_NativeFunction IsolateInterruptTestNativeLookup(
3598 Dart_Handle name, int argument_count) { 3598 Dart_Handle name, int argument_count) {
3599 return reinterpret_cast<Dart_NativeFunction>(&MarkMainEntered); 3599 return reinterpret_cast<Dart_NativeFunction>(&MarkMainEntered);
3600 } 3600 }
3601 3601
3602 3602
3603 void BusyLoop_start(uword unused) { 3603 void BusyLoop_start(uword unused) {
3604 // TODO(turnidge): Get rid of call to 'function' after interrupts
3605 // are checked on backward branches.
3606 const char* kScriptChars = 3604 const char* kScriptChars =
3607 "class Native {\n" 3605 "class Native {\n"
3608 " static void markMainEntered() native 'MarkMainEntered';\n" 3606 " static void markMainEntered() native 'MarkMainEntered';\n"
3609 "}\n" 3607 "}\n"
3610 "void function([foo='hi']) {\n"
3611 "}\n"
3612 "\n" 3608 "\n"
3613 "void main() {\n" 3609 "void main() {\n"
3614 " Native.markMainEntered();\n" 3610 " Native.markMainEntered();\n"
3615 " while (true) {\n" // Infinite loop. 3611 " while (true) {\n" // Infinite empty loop.
3616 " function();\n"
3617 " }\n" 3612 " }\n"
3618 "}\n"; 3613 "}\n";
3619 3614
3620
3621 // Tell the other thread that shared_isolate is created. 3615 // Tell the other thread that shared_isolate is created.
3622 Dart_Handle lib; 3616 Dart_Handle lib;
3623 { 3617 {
3624 sync->Enter(); 3618 sync->Enter();
3625 char* error = NULL; 3619 char* error = NULL;
3626 shared_isolate = Dart_CreateIsolate(NULL, NULL, NULL, &error); 3620 shared_isolate = Dart_CreateIsolate(NULL, NULL, NULL, &error);
3627 EXPECT(shared_isolate != NULL); 3621 EXPECT(shared_isolate != NULL);
3628 Dart_EnterScope(); 3622 Dart_EnterScope();
3629 Dart_Handle url = Dart_NewString(TestCase::url()); 3623 Dart_Handle url = Dart_NewString(TestCase::url());
3630 Dart_Handle source = Dart_NewString(kScriptChars); 3624 Dart_Handle source = Dart_NewString(kScriptChars);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 // We should have received the expected number of interrupts. 3727 // We should have received the expected number of interrupts.
3734 EXPECT_EQ(kInterruptCount, interrupt_count); 3728 EXPECT_EQ(kInterruptCount, interrupt_count);
3735 3729
3736 // Give the spawned thread enough time to properly exit. 3730 // Give the spawned thread enough time to properly exit.
3737 Isolate::SetInterruptCallback(saved); 3731 Isolate::SetInterruptCallback(saved);
3738 } 3732 }
3739 3733
3740 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3734 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3741 3735
3742 } // namespace dart 3736 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_x64.cc ('k') | runtime/vm/opt_code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698