3379eefd5f
Use DART_CHECK_VALID has been incorrect since the introduction of Isolate.kill and Dart_Cleanup because it crashes when given an unwind error. Remove long-broken FullSnapshot1 test. Change-Id: I1427249349e8138427bc7833980b5eff6ac466db Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98263 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
71 lines
2.0 KiB
C++
71 lines
2.0 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 <stdio.h>
|
|
|
|
#include "include/dart_api.h"
|
|
|
|
#include "bin/builtin.h"
|
|
#include "bin/dartutils.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
Builtin::builtin_lib_props Builtin::builtin_libraries_[] = {
|
|
/* { url_, has_natives_ } */
|
|
{DartUtils::kBuiltinLibURL, true},
|
|
{DartUtils::kIOLibURL, true},
|
|
{DartUtils::kHttpLibURL, false},
|
|
{DartUtils::kCLILibURL, true},
|
|
|
|
// End marker.
|
|
{NULL, false}};
|
|
|
|
Dart_Port Builtin::load_port_ = ILLEGAL_PORT;
|
|
const int Builtin::num_libs_ =
|
|
sizeof(Builtin::builtin_libraries_) / sizeof(Builtin::builtin_lib_props);
|
|
|
|
Dart_Handle Builtin::PartSource(BuiltinLibraryId id, const char* part_uri) {
|
|
UNREACHABLE();
|
|
}
|
|
|
|
void Builtin::SetNativeResolver(BuiltinLibraryId id) {
|
|
ASSERT(static_cast<int>(id) >= 0);
|
|
ASSERT(static_cast<int>(id) < num_libs_);
|
|
|
|
if (builtin_libraries_[id].has_natives_) {
|
|
Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
|
|
Dart_Handle library = Dart_LookupLibrary(url);
|
|
ASSERT(!Dart_IsError(library));
|
|
// Setup the native resolver for built in library functions.
|
|
Dart_Handle result =
|
|
Dart_SetNativeResolver(library, NativeLookup, NativeSymbol);
|
|
ASSERT(!Dart_IsError(result));
|
|
}
|
|
}
|
|
|
|
Builtin::BuiltinLibraryId Builtin::FindId(const char* url_string) {
|
|
int id = 0;
|
|
while (true) {
|
|
if (builtin_libraries_[id].url_ == NULL) {
|
|
return kInvalidLibrary;
|
|
}
|
|
if (strcmp(url_string, builtin_libraries_[id].url_) == 0) {
|
|
return static_cast<BuiltinLibraryId>(id);
|
|
}
|
|
id++;
|
|
}
|
|
}
|
|
|
|
Dart_Handle Builtin::LoadAndCheckLibrary(BuiltinLibraryId id) {
|
|
ASSERT(static_cast<int>(id) >= 0);
|
|
ASSERT(static_cast<int>(id) < num_libs_);
|
|
|
|
Dart_Handle url = DartUtils::NewString(builtin_libraries_[id].url_);
|
|
return Dart_LookupLibrary(url);
|
|
}
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|