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

Unified Diff: vm/unit_test.cc

Issue 10178030: Added lib/compiler compile all VM benchmark. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « vm/benchmark_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/unit_test.cc
===================================================================
--- vm/unit_test.cc (revision 7165)
+++ vm/unit_test.cc (working copy)
@@ -6,6 +6,9 @@
#include "vm/unit_test.h"
+#include "bin/builtin.h"
+#include "bin/dartutils.h"
+
#include "vm/assembler.h"
#include "vm/ast_printer.h"
#include "vm/code_generator.h"
@@ -60,17 +63,42 @@
if (Dart_IsError(result)) {
return Dart_Error("accessing url characters failed");
}
- static const char* kDartScheme = "dart:";
- static const intptr_t kDartSchemeLen = strlen(kDartScheme);
- // If the URL starts with "dart:" then it is not modified as it will be
- // handled by the VM internally.
- if (strncmp(url_chars, kDartScheme, kDartSchemeLen) == 0) {
- if (tag == kCanonicalizeUrl) {
+ bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_chars);
+ if (tag == kCanonicalizeUrl) {
+ // If this is a Dart Scheme URL then it is not modified as it will be
+ // handled by the VM internally.
+ if (is_dart_scheme_url) {
return url;
}
- return Dart_Error("unexpected tag encountered %d", tag);
+ Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary);
+ DART_CHECK_VALID(builtin_lib);
+ return DartUtils::CanonicalizeURL(NULL, library, url_chars);
}
- return Dart_Error("unsupported url encountered %s", url_chars);
+ if (is_dart_scheme_url) {
+ ASSERT(tag == kImportTag);
+ // Handle imports of other built-in libraries present in the SDK.
+ if (DartUtils::IsDartIOLibURL(url_chars)) {
+ return Builtin::LoadLibrary(Builtin::kIOLibrary);
+ } else if (DartUtils::IsDartJsonLibURL(url_chars)) {
+ return Builtin::LoadLibrary(Builtin::kJsonLibrary);
+ } else if (DartUtils::IsDartUriLibURL(url_chars)) {
+ return Builtin::LoadLibrary(Builtin::kUriLibrary);
+ } else if (DartUtils::IsDartUtfLibURL(url_chars)) {
+ return Builtin::LoadLibrary(Builtin::kUtfLibrary);
+ } else {
+ return Dart_Error("Do not know how to load '%s'", url_chars);
+ }
+ }
+ result = DartUtils::LoadSource(NULL,
+ library,
+ url,
+ tag,
+ url_chars,
+ import_map);
+ if (!Dart_IsError(result) && (tag == kImportTag)) {
+ Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary);
+ }
+ return result;
}
« no previous file with comments | « vm/benchmark_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698