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

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

Issue 1921893002: Faster code for megamorphic calls fo get:hashCode for Smi and OneByteString (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 intptr_t try_index, 1293 intptr_t try_index,
1294 intptr_t slow_path_argument_count) { 1294 intptr_t slow_path_argument_count) {
1295 const String& name = String::Handle(zone(), ic_data.target_name()); 1295 const String& name = String::Handle(zone(), ic_data.target_name());
1296 const Array& arguments_descriptor = 1296 const Array& arguments_descriptor =
1297 Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); 1297 Array::ZoneHandle(zone(), ic_data.arguments_descriptor());
1298 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0)); 1298 ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
1299 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(), 1299 const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(zone(),
1300 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); 1300 MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
1301 1301
1302 __ Comment("MegamorphicCall"); 1302 __ Comment("MegamorphicCall");
1303 // Load receiver into EBX.
1303 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize)); 1304 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize));
1305 Label done;
1306 if (name.raw() == Symbols::hashCode().raw()) {
1307 Label try_onebytestring, megamorphic_call;
1308 __ Comment("Inlined get:hashCode for Smi and OneByteString");
1309 __ testl(EBX, Immediate(kSmiTagMask));
1310 __ j(NOT_ZERO, &try_onebytestring, Assembler::kNearJump); // Non-smi value.
1311 __ movl(EAX, EBX);
1312 __ jmp(&done, Assembler::kNearJump);
1313
1314 __ Bind(&try_onebytestring);
1315 __ CompareClassId(EBX, kOneByteStringCid, EAX);
1316 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump);
1317 __ movl(EAX, FieldAddress(EBX, String::hash_offset()));
1318 __ cmpl(EAX, Immediate(0));
1319 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
1320
1321 __ Bind(&megamorphic_call);
1322 __ Comment("Slow case: megamorphic call");
1323 }
1304 __ LoadObject(ECX, cache); 1324 __ LoadObject(ECX, cache);
1305 if (FLAG_use_megamorphic_stub) { 1325 if (FLAG_use_megamorphic_stub) {
1306 __ Call(*StubCode::MegamorphicLookup_entry()); 1326 __ Call(*StubCode::MegamorphicLookup_entry());
1307 } else { 1327 } else {
1308 StubCode::EmitMegamorphicLookup(assembler()); 1328 StubCode::EmitMegamorphicLookup(assembler());
1309 } 1329 }
1310 __ call(EBX); 1330 __ call(EBX);
1311 1331
1332 __ Bind(&done);
1312 AddCurrentDescriptor(RawPcDescriptors::kOther, 1333 AddCurrentDescriptor(RawPcDescriptors::kOther,
1313 Thread::kNoDeoptId, token_pos); 1334 Thread::kNoDeoptId, token_pos);
1314 RecordSafepoint(locs, slow_path_argument_count); 1335 RecordSafepoint(locs, slow_path_argument_count);
1315 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); 1336 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1316 // Precompilation not implemented on ia32 platform. 1337 // Precompilation not implemented on ia32 platform.
1317 ASSERT(!FLAG_precompiled_mode); 1338 ASSERT(!FLAG_precompiled_mode);
1318 if (is_optimizing()) { 1339 if (is_optimizing()) {
1319 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1340 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1320 } else { 1341 } else {
1321 // Add deoptimization continuation point after the call and before the 1342 // Add deoptimization continuation point after the call and before the
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 __ movups(reg, Address(ESP, 0)); 1873 __ movups(reg, Address(ESP, 0));
1853 __ addl(ESP, Immediate(kFpuRegisterSize)); 1874 __ addl(ESP, Immediate(kFpuRegisterSize));
1854 } 1875 }
1855 1876
1856 1877
1857 #undef __ 1878 #undef __
1858 1879
1859 } // namespace dart 1880 } // namespace dart
1860 1881
1861 #endif // defined TARGET_ARCH_IA32 1882 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698