2d3775a1b1
Change 6302 description: - Wire the stack frame iterator to use stack maps for traversing objects if there are stack maps in the code object. If there are no stack maps it still does the old style stack frame traversal between fp and sp looking for tagged pointers. - Added a mechanism to be able to iterate over the code space and look for a particular object. Review URL: https://chromiumcodereview.appspot.com//10030001 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6331 260f80e4-7a28-3924-810f-c04153c831b5
45 lines
1.6 KiB
C++
45 lines
1.6 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/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) {
|
|
const String& function_name = String::ZoneHandle(String::NewSymbol(name));
|
|
const Function& function = Function::ZoneHandle(
|
|
Function::New(function_name, RawFunction::kFunction, true, false, 0));
|
|
Class& cls = Class::ZoneHandle();
|
|
const Script& script = Script::Handle();
|
|
cls = Class::New(function_name, script, Scanner::kDummyTokenIndex);
|
|
const Array& functions = Array::Handle(Array::New(1));
|
|
functions.SetAt(0, function);
|
|
cls.SetFunctions(functions);
|
|
Library& lib = Library::Handle(Library::CoreLibrary());
|
|
lib.AddClass(cls);
|
|
function.SetCode(code);
|
|
return function;
|
|
}
|
|
|
|
|
|
// A runtime call for test purposes.
|
|
// Arg0: a smi.
|
|
// Arg1: a smi.
|
|
// Result: a smi representing arg0 - arg1.
|
|
DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
|
|
ASSERT(arguments.Count() == kTestSmiSubRuntimeEntry.argument_count());
|
|
const Smi& left = Smi::CheckedHandle(arguments.At(0));
|
|
const Smi& right = Smi::CheckedHandle(arguments.At(1));
|
|
// Ignoring overflow in the calculation below.
|
|
intptr_t result = left.Value() - right.Value();
|
|
arguments.SetReturn(Smi::Handle(Smi::New(result)));
|
|
}
|
|
|
|
} // namespace dart
|