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

Side by Side Diff: vm/code_patcher_ia32_test.cc

Issue 8827015: Implement two-argument check inline cache. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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
« no previous file with comments | « vm/code_generator_ia32.cc ('k') | vm/ic_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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& function_name = String::Handle(String::New("Vermicelles")); 51 const String& function_name = String::Handle(String::New("Vermicelles"));
52 ICData ic_data(function_name, 1); 52 ICData ic_data(function_name, 1);
53 EXPECT(!Array::Handle(ic_data.data()).IsNull()); 53 EXPECT(!Array::Handle(ic_data.data()).IsNull());
54 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data())); 54 __ LoadObject(ECX, Array::ZoneHandle(ic_data.data()));
55 __ LoadObject(EDX, CodeGenerator::ArgumentsDescriptor(1, Array::Handle())); 55 __ LoadObject(EDX, CodeGenerator::ArgumentsDescriptor(1, Array::Handle()));
56 ExternalLabel target_label( 56 ExternalLabel target_label(
57 "InlineCache", StubCode::InlineCacheEntryPoint()); 57 "InlineCache", StubCode::OneArgCheckInlineCacheEntryPoint());
58 __ call(&target_label); 58 __ call(&target_label);
59 __ ret(); 59 __ ret();
60 } 60 }
61 61
62 62
63 ASSEMBLER_TEST_RUN(IcDataAccess, entry) { 63 ASSEMBLER_TEST_RUN(IcDataAccess, entry) {
64 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes(); 64 uword return_address = entry + CodePatcher::InstanceCallSizeInBytes();
65 const Array& array = Array::Handle( 65 const Array& array = Array::Handle(
66 CodePatcher::GetInstanceCallIcDataAt(return_address)); 66 CodePatcher::GetInstanceCallIcDataAt(return_address));
67 EXPECT(!array.IsNull()); 67 EXPECT(!array.IsNull());
68 ICData ic_data(array); 68 ICData ic_data(array);
69 EXPECT_STREQ("Vermicelles", 69 EXPECT_STREQ("Vermicelles",
70 String::Handle(ic_data.FunctionName()).ToCString()); 70 String::Handle(ic_data.FunctionName()).ToCString());
71 EXPECT_EQ(1, ic_data.NumberOfArgumentsChecked()); 71 EXPECT_EQ(1, ic_data.NumberOfArgumentsChecked());
72 EXPECT_EQ(0, ic_data.NumberOfChecks()); 72 EXPECT_EQ(0, ic_data.NumberOfChecks());
73 const String& new_function_name = String::Handle(String::New("Rigi")); 73 const String& new_function_name = String::Handle(String::New("Rigi"));
74 ICData new_ic_data(new_function_name, 1); 74 ICData new_ic_data(new_function_name, 1);
75 EXPECT_STREQ("Rigi", String::Handle(new_ic_data.FunctionName()).ToCString()); 75 EXPECT_STREQ("Rigi", String::Handle(new_ic_data.FunctionName()).ToCString());
76 CodePatcher::SetInstanceCallIcDataAt(return_address, 76 CodePatcher::SetInstanceCallIcDataAt(return_address,
77 Array::ZoneHandle(new_ic_data.data())); 77 Array::ZoneHandle(new_ic_data.data()));
78 const Array& new_array = Array::Handle( 78 const Array& new_array = Array::Handle(
79 CodePatcher::GetInstanceCallIcDataAt(return_address)); 79 CodePatcher::GetInstanceCallIcDataAt(return_address));
80 ICData test_ic_data(new_array); 80 ICData test_ic_data(new_array);
81 EXPECT_STREQ("Rigi", String::Handle(test_ic_data.FunctionName()).ToCString()); 81 EXPECT_STREQ("Rigi", String::Handle(test_ic_data.FunctionName()).ToCString());
82 } 82 }
83 83
84 } // namespace dart 84 } // namespace dart
85 85
86 #endif // TARGET_ARCH_IA32 86 #endif // TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « vm/code_generator_ia32.cc ('k') | vm/ic_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698