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

Side by Side Diff: runtime/vm/stub_code_ia32_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/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
11 #include "vm/native_entry_test.h" 11 #include "vm/native_entry_test.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/runtime_entry.h" 13 #include "vm/runtime_entry.h"
14 #include "vm/stub_code.h" 14 #include "vm/stub_code.h"
15 #include "vm/symbols.h" 15 #include "vm/symbols.h"
16 #include "vm/unit_test.h" 16 #include "vm/unit_test.h"
17 17
18 #define __ assembler-> 18 #define __ assembler->
19 19
20 namespace dart { 20 namespace dart {
21 21
22 DECLARE_RUNTIME_ENTRY(TestSmiSub); 22 DECLARE_RUNTIME_ENTRY(TestSmiSub);
23 DECLARE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, RawObject*, RawObject*); 23 DECLARE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, RawObject*, RawObject*);
24 24
25 25
26 static Function* CreateFunction(const char* name) { 26 static Function* CreateFunction(const char* name) {
27 const String& class_name = String::Handle(Symbols::New("ownerClass"));
28 const Script& script = Script::Handle();
29 const Class& owner_class =
30 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
27 const String& function_name = String::ZoneHandle(Symbols::New(name)); 31 const String& function_name = String::ZoneHandle(Symbols::New(name));
28 Function& function = Function::ZoneHandle( 32 Function& function = Function::ZoneHandle(
29 Function::New(function_name, RawFunction::kRegularFunction, 33 Function::New(function_name, RawFunction::kRegularFunction,
30 true, false, false, false, 0)); 34 true, false, false, false, owner_class, 0));
31 return &function; 35 return &function;
32 } 36 }
33 37
38
34 // Test calls to stub code which calls into the runtime. 39 // Test calls to stub code which calls into the runtime.
35 static void GenerateCallToCallRuntimeStub(Assembler* assembler, 40 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
36 int value1, int value2) { 41 int value1, int value2) {
37 const int argc = 2; 42 const int argc = 2;
38 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 43 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
39 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 44 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
40 const Object& result = Object::ZoneHandle(); 45 const Object& result = Object::ZoneHandle();
41 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld)); 46 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld));
42 ASSERT(context.isolate() == Isolate::Current()); 47 ASSERT(context.isolate() == Isolate::Current());
43 __ enter(Immediate(0)); 48 __ enter(Immediate(0));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 GrowableArray<const Object*> arguments; 159 GrowableArray<const Object*> arguments;
155 const Array& kNoArgumentNames = Array::Handle(); 160 const Array& kNoArgumentNames = Array::Handle();
156 Smi& result = Smi::Handle(); 161 Smi& result = Smi::Handle();
157 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); 162 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames);
158 EXPECT_EQ((value1 - value2), result.Value()); 163 EXPECT_EQ((value1 - value2), result.Value());
159 } 164 }
160 165
161 } // namespace dart 166 } // namespace dart
162 167
163 #endif // defined TARGET_ARCH_IA32 168 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698