Files
sdk/runtime/vm/heap_test.cc
T
turnidge@google.com 9e2c641658 Remove the deprecated method invocation and field access apis from the
dart embbedding api.  Use the new apis instead.

Fixed a bug where field/function lookup was failing for imported libs.
Added tests.  Had to add a couple of lookup functions to Library.

Fixed a bug in Dart_Invoke -- it wasn't handling a null receiver
correctly.
Review URL: https://chromiumcodereview.appspot.com//10021072

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6769 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-19 21:04:15 +00:00

58 lines
1.6 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/assert.h"
#include "vm/globals.h"
#include "vm/heap.h"
#include "vm/unit_test.h"
namespace dart {
// Only ia32 and x64 can run execution tests.
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
TEST_CASE(OldGC) {
const char* kScriptChars =
"void main() {\n"
" return [1, 2, 3];\n"
"}\n";
FLAG_verbose_gc = true;
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
Dart_Handle result = Dart_Invoke(lib,
Dart_NewString("main"),
0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNull(result));
EXPECT(Dart_IsList(result));
Isolate* isolate = Isolate::Current();
Heap* heap = isolate->heap();
heap->CollectGarbage(Heap::kOld);
}
TEST_CASE(LargeSweep) {
const char* kScriptChars =
"void main() {\n"
" return new List(8 * 1024 * 1024);\n"
"}\n";
FLAG_verbose_gc = true;
Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
Dart_EnterScope();
Dart_Handle result = Dart_Invoke(lib,
Dart_NewString("main"),
0, NULL);
EXPECT_VALID(result);
EXPECT(!Dart_IsNull(result));
EXPECT(Dart_IsList(result));
Isolate* isolate = Isolate::Current();
Heap* heap = isolate->heap();
heap->CollectGarbage(Heap::kOld);
Dart_ExitScope();
heap->CollectGarbage(Heap::kOld);
}
#endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
}