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

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

Issue 385563004: Uses a conditional move for usage counter increment instead of a branch (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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) 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" 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/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 __ popl(ECX); // Restore IC data array. 1395 __ popl(ECX); // Restore IC data array.
1396 __ popl(EDX); // Restore arguments descriptor array. 1396 __ popl(EDX); // Restore arguments descriptor array.
1397 __ LeaveFrame(); 1397 __ LeaveFrame();
1398 Label call_target_function; 1398 Label call_target_function;
1399 __ jmp(&call_target_function); 1399 __ jmp(&call_target_function);
1400 1400
1401 __ Bind(&found); 1401 __ Bind(&found);
1402 // EBX: Pointer to an IC data check group. 1402 // EBX: Pointer to an IC data check group.
1403 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; 1403 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize;
1404 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; 1404 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize;
1405
1406 // Update counter.
1407 __ movl(EAX, Address(EBX, count_offset));
1408 __ addl(EAX, Immediate(Smi::RawValue(1)));
1409 __ movl(EDI, Immediate(Smi::RawValue(Smi::kMaxValue)));
1410 __ cmovno(EDI, EAX);
1411 __ movl(Address(EBX, count_offset), EDI);
srdjan 2014/07/10 17:07:36 Are you certain this is better in ia32? The new co
zra 2014/07/10 17:15:39 I've sent you a link.
1412
1405 __ movl(EAX, Address(EBX, target_offset)); 1413 __ movl(EAX, Address(EBX, target_offset));
1406 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1)));
1407 __ j(NO_OVERFLOW, &call_target_function, Assembler::kNearJump);
1408 __ movl(Address(EBX, count_offset),
1409 Immediate(Smi::RawValue(Smi::kMaxValue)));
1410
1411 __ Bind(&call_target_function); 1414 __ Bind(&call_target_function);
1412 // EAX: Target function. 1415 // EAX: Target function.
1413 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset())); 1416 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset()));
1414 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1417 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1415 __ jmp(EBX); 1418 __ jmp(EBX);
1416 __ int3(); 1419 __ int3();
1417 } 1420 }
1418 1421
1419 1422
1420 // Use inline cache data array to invoke the target or continue in inline 1423 // Use inline cache data array to invoke the target or continue in inline
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 const Register temp = ECX; 1897 const Register temp = ECX;
1895 __ movl(left, Address(ESP, 2 * kWordSize)); 1898 __ movl(left, Address(ESP, 2 * kWordSize));
1896 __ movl(right, Address(ESP, 1 * kWordSize)); 1899 __ movl(right, Address(ESP, 1 * kWordSize));
1897 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1900 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1898 __ ret(); 1901 __ ret();
1899 } 1902 }
1900 1903
1901 } // namespace dart 1904 } // namespace dart
1902 1905
1903 #endif // defined TARGET_ARCH_IA32 1906 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698