| OLD | NEW |
| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 | 330 |
| 331 // Optimizations: | 331 // Optimizations: |
| 332 // - result is 0 if: | 332 // - result is 0 if: |
| 333 // - left is 0 | 333 // - left is 0 |
| 334 // - left equals right | 334 // - left equals right |
| 335 // - result is left if | 335 // - result is left if |
| 336 // - left > 0 && left < right | 336 // - left > 0 && left < right |
| 337 // RAX: Tagged left (dividend). | 337 // RAX: Tagged left (dividend). |
| 338 // RCX: Tagged right (divisor). | 338 // RCX: Tagged right (divisor). |
| 339 // RAX: Untagged result (remainder). | 339 // Returns: |
| 340 // RAX: Untagged fallthrough result (remainder to be adjusted), or |
| 341 // RAX: Tagged return result (remainder). |
| 340 static void EmitRemainderOperation(Assembler* assembler) { | 342 static void EmitRemainderOperation(Assembler* assembler) { |
| 341 Label return_zero, try_modulo, not_32bit, done; | 343 Label return_zero, try_modulo, not_32bit, done; |
| 342 // Check for quick zero results. | 344 // Check for quick zero results. |
| 343 __ cmpq(RAX, Immediate(0)); | 345 __ cmpq(RAX, Immediate(0)); |
| 344 __ j(EQUAL, &return_zero, Assembler::kNearJump); | 346 __ j(EQUAL, &return_zero, Assembler::kNearJump); |
| 345 __ cmpq(RAX, RCX); | 347 __ cmpq(RAX, RCX); |
| 346 __ j(EQUAL, &return_zero, Assembler::kNearJump); | 348 __ j(EQUAL, &return_zero, Assembler::kNearJump); |
| 347 | 349 |
| 348 // Check if result equals left. | 350 // Check if result equals left. |
| 349 __ cmpq(RAX, Immediate(0)); | 351 __ cmpq(RAX, Immediate(0)); |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 // Set return value to Isolate::current_tag_. | 1913 // Set return value to Isolate::current_tag_. |
| 1912 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 1914 __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |
| 1913 __ ret(); | 1915 __ ret(); |
| 1914 } | 1916 } |
| 1915 | 1917 |
| 1916 #undef __ | 1918 #undef __ |
| 1917 | 1919 |
| 1918 } // namespace dart | 1920 } // namespace dart |
| 1919 | 1921 |
| 1920 #endif // defined TARGET_ARCH_X64 | 1922 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |