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

Side by Side Diff: runtime/vm/runtime_entry_test.cc

Issue 1315893004: Load runtime entries from the Thread instead of the ObjectPool. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/runtime_entry_mips.cc ('k') | runtime/vm/runtime_entry_x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "vm/runtime_entry.h"
6
7 #include "vm/object.h"
8 #include "vm/symbols.h"
9 #include "vm/verifier.h"
10
11 namespace dart {
12
13 DECLARE_RUNTIME_ENTRY(TestSmiSub)
14 DECLARE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, RawObject*, RawObject*)
15
16
17 // Add function to a class and that class to the class dictionary so that
18 // frame walking can be used.
19 const Function& RegisterFakeFunction(const char* name, const Code& code) {
20 const String& class_name = String::Handle(Symbols::New("ownerClass"));
21 const Script& script = Script::Handle();
22 const Class& owner_class =
23 Class::Handle(Class::New(class_name, script, Scanner::kNoSourcePos));
24 const String& function_name = String::ZoneHandle(Symbols::New(name));
25 const Function& function = Function::ZoneHandle(
26 Function::New(function_name, RawFunction::kRegularFunction,
27 true, false, false, false, false, owner_class, 0));
28 const Array& functions = Array::Handle(Array::New(1));
29 functions.SetAt(0, function);
30 owner_class.SetFunctions(functions);
31 Library& lib = Library::Handle(Library::CoreLibrary());
32 lib.AddClass(owner_class);
33 function.AttachCode(code);
34 return function;
35 }
36
37
38 // A runtime call for test purposes.
39 // Arg0: a smi.
40 // Arg1: a smi.
41 // Result: a smi representing arg0 - arg1.
42 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
43 const Smi& left = Smi::CheckedHandle(arguments.ArgAt(0));
44 const Smi& right = Smi::CheckedHandle(arguments.ArgAt(1));
45 // Ignoring overflow in the calculation below.
46 intptr_t result = left.Value() - right.Value();
47 arguments.SetReturn(Smi::Handle(Smi::New(result)));
48 }
49
50
51 // A leaf runtime call for test purposes.
52 // arg0: a smi.
53 // arg1: a smi.
54 // returns a smi representing arg0 + arg1.
55 DEFINE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, 2,
56 RawObject* arg0, RawObject* arg1) {
57 // Ignoring overflow in the calculation below and using the internal
58 // representation of Smi directly without using any handlized code.
59 intptr_t result = reinterpret_cast<intptr_t>(arg0) +
60 reinterpret_cast<intptr_t>(arg1);
61 return reinterpret_cast<RawObject*>(result);
62 }
63 END_LEAF_RUNTIME_ENTRY
64
65 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry_mips.cc ('k') | runtime/vm/runtime_entry_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698