mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:11:40 +00:00
48c8ffa7f3
This is a cut of the work that Todd and I collaborated on in the reload branch. In this CL, we've dropped the loader port hacks, in other words, on stack reloading in the standalone embedder does not work yet. - [x] Support for hot reloading of isolate source code - [x] Unit test harness and many tests - [x] Service protocol and Observatory support - [x] Product build does not include support for hot reloading. R=rmacnak@google.com Review URL: https://codereview.chromium.org/1965823002 .
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
// Copyright (c) 2011, 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 "vm/runtime_entry.h"
|
|
|
|
#include "vm/object.h"
|
|
#include "vm/symbols.h"
|
|
#include "vm/verifier.h"
|
|
|
|
namespace dart {
|
|
|
|
|
|
// Add function to a class and that class to the class dictionary so that
|
|
// frame walking can be used.
|
|
const Function& RegisterFakeFunction(const char* name, const Code& code) {
|
|
Thread* thread = Thread::Current();
|
|
const String& class_name = String::Handle(Symbols::New(thread, "ownerClass"));
|
|
const Script& script = Script::Handle();
|
|
const Library& lib = Library::Handle(Library::CoreLibrary());
|
|
const Class& owner_class =
|
|
Class::Handle(Class::New(lib, class_name, script,
|
|
TokenPosition::kNoSource));
|
|
const String& function_name = String::ZoneHandle(Symbols::New(thread, name));
|
|
const Function& function = Function::ZoneHandle(
|
|
Function::New(function_name,
|
|
RawFunction::kRegularFunction,
|
|
true,
|
|
false,
|
|
false,
|
|
false,
|
|
false,
|
|
owner_class,
|
|
TokenPosition::kMinSource));
|
|
const Array& functions = Array::Handle(Array::New(1));
|
|
functions.SetAt(0, function);
|
|
owner_class.SetFunctions(functions);
|
|
lib.AddClass(owner_class);
|
|
function.AttachCode(code);
|
|
return function;
|
|
}
|
|
|
|
} // namespace dart
|