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

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

Issue 1920103004: Added flag --inline_smi_string_hashcode and --inline_smi_string_hashcode_ratio to decide when/if sh… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Load receiver into EBX.
1304 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize)); 1304 __ movl(EBX, Address(ESP, (argument_count - 1) * kWordSize));
1305 Label done; 1305 Label done;
1306 if (name.raw() == Symbols::hashCode().raw()) { 1306 if (ShouldInlineSmiStringHashCode(ic_data)) {
1307 Label try_onebytestring, megamorphic_call; 1307 Label megamorphic_call;
1308 __ Comment("Inlined get:hashCode for Smi and OneByteString"); 1308 __ Comment("Inlined get:hashCode for Smi and OneByteString");
1309 __ movl(EAX, EBX); // Move Smi hashcode to EAX.
zra 2016/04/27 16:28:17 Smi hash code looks really easy to calculate =) Ha
srdjan 2016/04/27 18:10:22 In order to get the cid we must check for Smi anyw
1309 __ testl(EBX, Immediate(kSmiTagMask)); 1310 __ testl(EBX, Immediate(kSmiTagMask));
1310 __ j(NOT_ZERO, &try_onebytestring, Assembler::kNearJump); // Non-smi value. 1311 __ j(ZERO, &done, Assembler::kNearJump); // It is Smi, we are done.
1311 __ movl(EAX, EBX);
1312 __ jmp(&done, Assembler::kNearJump);
1313 1312
1314 __ Bind(&try_onebytestring);
1315 __ CompareClassId(EBX, kOneByteStringCid, EAX); 1313 __ CompareClassId(EBX, kOneByteStringCid, EAX);
1316 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump); 1314 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump);
1317 __ movl(EAX, FieldAddress(EBX, String::hash_offset())); 1315 __ movl(EAX, FieldAddress(EBX, String::hash_offset()));
1318 __ cmpl(EAX, Immediate(0)); 1316 __ cmpl(EAX, Immediate(0));
1319 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 1317 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
1320 1318
1321 __ Bind(&megamorphic_call); 1319 __ Bind(&megamorphic_call);
1322 __ Comment("Slow case: megamorphic call"); 1320 __ Comment("Slow case: megamorphic call");
1323 } 1321 }
1324 __ LoadObject(ECX, cache); 1322 __ LoadObject(ECX, cache);
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1873 __ movups(reg, Address(ESP, 0)); 1871 __ movups(reg, Address(ESP, 0));
1874 __ addl(ESP, Immediate(kFpuRegisterSize)); 1872 __ addl(ESP, Immediate(kFpuRegisterSize));
1875 } 1873 }
1876 1874
1877 1875
1878 #undef __ 1876 #undef __
1879 1877
1880 } // namespace dart 1878 } // namespace dart
1881 1879
1882 #endif // defined TARGET_ARCH_IA32 1880 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698