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

Side by Side Diff: runtime/vm/code_patcher_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/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 30 matching lines...) Expand all
41 node_seq->Add(new ReturnNode(Scanner::kDummyTokenIndex, 41 node_seq->Add(new ReturnNode(Scanner::kDummyTokenIndex,
42 new StaticCallNode(Scanner::kDummyTokenIndex, 42 new StaticCallNode(Scanner::kDummyTokenIndex,
43 function, arguments))); 43 function, arguments)));
44 } 44 }
45 45
46 CODEGEN_TEST2_RUN(PatchStaticCall, NativePatchStaticCall, Instance::null()); 46 CODEGEN_TEST2_RUN(PatchStaticCall, NativePatchStaticCall, Instance::null());
47 47
48 #define __ assembler-> 48 #define __ assembler->
49 49
50 ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) { 50 ASSEMBLER_TEST_GENERATE(IcDataAccess, assembler) {
51 const String& class_name = String::Handle(Symbols::New("ownerClass"));
52 const Script& script = Script::Handle();
53 const Class& owner_class =
54 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
51 const String& function_name = 55 const String& function_name =
52 String::ZoneHandle(Symbols::New("callerFunction")); 56 String::ZoneHandle(Symbols::New("callerFunction"));
53 const Function& function = Function::ZoneHandle( 57 const Function& function = Function::ZoneHandle(
54 Function::New(function_name, RawFunction::kRegularFunction, 58 Function::New(function_name, RawFunction::kRegularFunction,
55 true, false, false, false, 0)); 59 true, false, false, false, owner_class, 0));
56 60
57 const String& target_name = String::Handle(String::New("targetFunction")); 61 const String& target_name = String::Handle(String::New("targetFunction"));
58 ICData& ic_data = ICData::ZoneHandle( 62 ICData& ic_data = ICData::ZoneHandle(
59 ICData::New(function, target_name, 15, 1)); 63 ICData::New(function, target_name, 15, 1));
64
60 __ LoadObject(ECX, ic_data); 65 __ LoadObject(ECX, ic_data);
61 __ LoadObject(EDX, DartEntry::ArgumentsDescriptor(1, Array::Handle())); 66 __ LoadObject(EDX, DartEntry::ArgumentsDescriptor(1, Array::Handle()));
62 ExternalLabel target_label( 67 ExternalLabel target_label(
63 "InlineCache", StubCode::OneArgCheckInlineCacheEntryPoint()); 68 "InlineCache", StubCode::OneArgCheckInlineCacheEntryPoint());
64 __ call(&target_label); 69 __ call(&target_label);
65 __ ret(); 70 __ ret();
66 } 71 }
67 72
68 73
69 ASSEMBLER_TEST_RUN(IcDataAccess, entry) { 74 ASSEMBLER_TEST_RUN(IcDataAccess, entry) {
70 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes(); 75 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes();
71 const ICData& ic_data = ICData::Handle( 76 const ICData& ic_data = ICData::Handle(
72 CodePatcher::GetInstanceCallIcDataAt(return_address)); 77 CodePatcher::GetInstanceCallIcDataAt(return_address));
73 EXPECT_STREQ("targetFunction", 78 EXPECT_STREQ("targetFunction",
74 String::Handle(ic_data.target_name()).ToCString()); 79 String::Handle(ic_data.target_name()).ToCString());
75 EXPECT_EQ(1, ic_data.num_args_tested()); 80 EXPECT_EQ(1, ic_data.num_args_tested());
76 EXPECT_EQ(0, ic_data.NumberOfChecks()); 81 EXPECT_EQ(0, ic_data.NumberOfChecks());
77 } 82 }
78 83
79 } // namespace dart 84 } // namespace dart
80 85
81 #endif // TARGET_ARCH_IA32 86 #endif // TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698