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

Unified Diff: runtime/vm/compiler_test.cc

Issue 379353003: Implement Evaluate without creating new classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 5 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 | « no previous file | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler_test.cc
diff --git a/runtime/vm/compiler_test.cc b/runtime/vm/compiler_test.cc
index fdecd6ef2c7632efe1643dea7cbdf38f2eaf2e6c..84850084a1367bd4dfda386520562a8eed32ff10 100644
--- a/runtime/vm/compiler_test.cc
+++ b/runtime/vm/compiler_test.cc
@@ -99,4 +99,37 @@ TEST_CASE(EvalExpression) {
EXPECT_STREQ("Herr Nilsson 100.", val.ToCString());
}
+
+TEST_CASE(EvalExpressionWithLazyCompile) {
+ Library& lib = Library::Handle(Library::CoreLibrary());
+
+ const String& expression = String::Handle(String::New(
+ "(){ return (){ return (){ return 3 + 4; }(); }(); }()"));
+ Object& val = Object::Handle();
+ val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array());
+
+ EXPECT(!val.IsNull());
+ EXPECT(!val.IsError());
+ EXPECT(val.IsInteger());
+ EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
+}
+
+
+TEST_CASE(EvalExpressionExhaustCIDs) {
+ Library& lib = Library::Handle(Library::CoreLibrary());
+
+ const String& expression = String::Handle(String::New("3 + 4"));
+ Object& val = Object::Handle();
+
+ const intptr_t classTableSize = 1 << RawObject::kClassIdTagSize;
+ for (intptr_t i = 0; i < classTableSize; i++) {
+ val = lib.Evaluate(expression, Array::empty_array(), Array::empty_array());
+ }
+
+ EXPECT(!val.IsNull());
+ EXPECT(!val.IsError());
+ EXPECT(val.IsInteger());
+ EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
+}
+
} // namespace dart
« no previous file with comments | « no previous file | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698