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

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

Issue 10831142: Associate the correct type to method receivers (instead of Dynamic type). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/runtime_entry.h" 5 #include "vm/runtime_entry.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/symbols.h" 8 #include "vm/symbols.h"
9 #include "vm/verifier.h" 9 #include "vm/verifier.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // Add function to a class and that class to the class dictionary so that 13 // Add function to a class and that class to the class dictionary so that
14 // frame walking can be used. 14 // frame walking can be used.
15 const Function& RegisterFakeFunction(const char* name, const Code& code) { 15 const Function& RegisterFakeFunction(const char* name, const Code& code) {
16 const String& class_name = String::Handle(Symbols::New("ownerClass"));
17 const Script& script = Script::Handle();
18 const Class& owner_class =
19 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
16 const String& function_name = String::ZoneHandle(Symbols::New(name)); 20 const String& function_name = String::ZoneHandle(Symbols::New(name));
17 const Function& function = Function::ZoneHandle( 21 const Function& function = Function::ZoneHandle(
18 Function::New(function_name, RawFunction::kRegularFunction, 22 Function::New(function_name, RawFunction::kRegularFunction,
19 true, false, false, false, 0)); 23 true, false, false, false, owner_class, 0));
20 Class& cls = Class::ZoneHandle();
21 const Script& script = Script::Handle();
22 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex);
23 const Array& functions = Array::Handle(Array::New(1)); 24 const Array& functions = Array::Handle(Array::New(1));
24 functions.SetAt(0, function); 25 functions.SetAt(0, function);
25 cls.SetFunctions(functions); 26 owner_class.SetFunctions(functions);
26 Library& lib = Library::Handle(Library::CoreLibrary()); 27 Library& lib = Library::Handle(Library::CoreLibrary());
27 lib.AddClass(cls); 28 lib.AddClass(owner_class);
28 function.SetCode(code); 29 function.SetCode(code);
29 return function; 30 return function;
30 } 31 }
31 32
32 33
33 // A runtime call for test purposes. 34 // A runtime call for test purposes.
34 // Arg0: a smi. 35 // Arg0: a smi.
35 // Arg1: a smi. 36 // Arg1: a smi.
36 // Result: a smi representing arg0 - arg1. 37 // Result: a smi representing arg0 - arg1.
37 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) { 38 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
(...skipping 14 matching lines...) Expand all
52 RawObject* arg0, RawObject* arg1) { 53 RawObject* arg0, RawObject* arg1) {
53 // Ignoring overflow in the calculation below and using the internal 54 // Ignoring overflow in the calculation below and using the internal
54 // representation of Smi directly without using any handlized code. 55 // representation of Smi directly without using any handlized code.
55 intptr_t result = reinterpret_cast<intptr_t>(arg0) + 56 intptr_t result = reinterpret_cast<intptr_t>(arg0) +
56 reinterpret_cast<intptr_t>(arg1); 57 reinterpret_cast<intptr_t>(arg1);
57 return reinterpret_cast<RawObject*>(result); 58 return reinterpret_cast<RawObject*>(result);
58 } 59 }
59 END_LEAF_RUNTIME_ENTRY 60 END_LEAF_RUNTIME_ENTRY
60 61
61 } // namespace dart 62 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698