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

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

Issue 474913004: - Account for number of pending tasks in old-space collections. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
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 "bin/builtin.h" 5 #include "bin/builtin.h"
6 #include "include/dart_api.h" 6 #include "include/dart_api.h"
7 #include "include/dart_debugger_api.h" 7 #include "include/dart_debugger_api.h"
8 #include "include/dart_mirrors_api.h" 8 #include "include/dart_mirrors_api.h"
9 #include "include/dart_native_api.h" 9 #include "include/dart_native_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 7174 matching lines...) Expand 10 before | Expand all | Expand 10 after
7185 "\n" 7185 "\n"
7186 "void main() {\n" 7186 "void main() {\n"
7187 " Native.markMainEntered();\n" 7187 " Native.markMainEntered();\n"
7188 " while (true) {\n" // Infinite empty loop. 7188 " while (true) {\n" // Infinite empty loop.
7189 " }\n" 7189 " }\n"
7190 "}\n"; 7190 "}\n";
7191 7191
7192 // Tell the other thread that shared_isolate is created. 7192 // Tell the other thread that shared_isolate is created.
7193 Dart_Handle lib; 7193 Dart_Handle lib;
7194 { 7194 {
7195 sync->Enter(); 7195 MonitorLocker ml(sync);
7196 char* error = NULL; 7196 char* error = NULL;
7197 shared_isolate = Dart_CreateIsolate(NULL, NULL, 7197 shared_isolate = Dart_CreateIsolate(NULL, NULL,
7198 bin::snapshot_buffer, 7198 bin::snapshot_buffer,
7199 NULL, &error); 7199 NULL, &error);
7200 EXPECT(shared_isolate != NULL); 7200 EXPECT(shared_isolate != NULL);
7201 Dart_EnterScope(); 7201 Dart_EnterScope();
7202 Dart_Handle url = NewString(TestCase::url()); 7202 Dart_Handle url = NewString(TestCase::url());
7203 Dart_Handle source = NewString(kScriptChars); 7203 Dart_Handle source = NewString(kScriptChars);
7204 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler); 7204 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler);
7205 EXPECT_VALID(result); 7205 EXPECT_VALID(result);
7206 lib = Dart_LoadScript(url, source, 0, 0); 7206 lib = Dart_LoadScript(url, source, 0, 0);
7207 EXPECT_VALID(lib); 7207 EXPECT_VALID(lib);
7208 result = Dart_FinalizeLoading(false); 7208 result = Dart_FinalizeLoading(false);
7209 EXPECT_VALID(result); 7209 EXPECT_VALID(result);
7210 result = 7210 result =
7211 Dart_SetNativeResolver(lib, &IsolateInterruptTestNativeLookup, NULL); 7211 Dart_SetNativeResolver(lib, &IsolateInterruptTestNativeLookup, NULL);
7212 DART_CHECK_VALID(result); 7212 DART_CHECK_VALID(result);
7213 7213
7214 sync->Notify(); 7214 ml.Notify();
7215 sync->Exit();
7216 } 7215 }
7217 7216
7218 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL); 7217 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
7219 EXPECT(Dart_IsError(result)); 7218 EXPECT(Dart_IsError(result));
7220 EXPECT(Dart_ErrorHasException(result)); 7219 EXPECT(Dart_ErrorHasException(result));
7221 EXPECT_SUBSTRING("Unhandled exception:\nfoo\n", 7220 EXPECT_SUBSTRING("Unhandled exception:\nfoo\n",
7222 Dart_GetError(result)); 7221 Dart_GetError(result));
7223 7222
7224 Dart_ExitScope(); 7223 Dart_ExitScope();
7225 Dart_ShutdownIsolate(); 7224 Dart_ShutdownIsolate();
7226 7225
7227 // Tell the other thread that we are done (don't use MonitorLocker 7226 // Tell the other thread that we are done.
7228 // as there is no current isolate any more). 7227 {
7229 sync->Enter(); 7228 MonitorLocker ml(sync);
7230 shared_isolate = NULL; 7229 shared_isolate = NULL;
7231 sync->Notify(); 7230 ml.Notify();
7232 sync->Exit(); 7231 }
7233 } 7232 }
7234 7233
7235 7234
7236 // This callback handles isolate interrupts for the IsolateInterrupt 7235 // This callback handles isolate interrupts for the IsolateInterrupt
7237 // test. It ignores the first two interrupts and throws an exception 7236 // test. It ignores the first two interrupts and throws an exception
7238 // on the third interrupt. 7237 // on the third interrupt.
7239 const int kInterruptCount = 10; 7238 const int kInterruptCount = 10;
7240 static int interrupt_count = 0; 7239 static int interrupt_count = 0;
7241 static bool IsolateInterruptTestCallback() { 7240 static bool IsolateInterruptTestCallback() {
7242 OS::Print(" ========== Interrupt callback called #%d\n", interrupt_count + 1); 7241 OS::Print(" ========== Interrupt callback called #%d\n", interrupt_count + 1);
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
8644 NewString("main"), 8643 NewString("main"),
8645 1, 8644 1,
8646 dart_args); 8645 dart_args);
8647 int64_t value = 0; 8646 int64_t value = 0;
8648 result = Dart_IntegerToInt64(result, &value); 8647 result = Dart_IntegerToInt64(result, &value);
8649 EXPECT_VALID(result); 8648 EXPECT_VALID(result);
8650 EXPECT_EQ(6, value); 8649 EXPECT_EQ(6, value);
8651 } 8650 }
8652 8651
8653 } // namespace dart 8652 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/freelist.h » ('j') | runtime/vm/freelist.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698