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

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

Issue 18130004: Split IdenticalWithNumberCheck in two versions: once called from unoptimized code the other called… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | 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) 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_X64) 6 #if defined(TARGET_ARCH_X64)
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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 RawBigint* left, 2031 RawBigint* left,
2032 RawBigint* right); 2032 RawBigint* right);
2033 2033
2034 2034
2035 // Does identical check (object references are equal or not equal) with special 2035 // Does identical check (object references are equal or not equal) with special
2036 // checks for boxed numbers. 2036 // checks for boxed numbers.
2037 // Left and right are pushed on stack. 2037 // Left and right are pushed on stack.
2038 // Return ZF set. 2038 // Return ZF set.
2039 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint 2039 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint
2040 // cannot contain a value that fits in Mint or Smi. 2040 // cannot contain a value that fits in Mint or Smi.
2041 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { 2041 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler,
2042 const Register left = RAX; 2042 const Register left,
2043 const Register right = RDX; 2043 const Register right,
2044 // Preserve left, right and temp. 2044 const Register unused1,
2045 __ pushq(left); 2045 const Register unused2) {
2046 __ pushq(right);
2047 // TOS + 0: saved right
2048 // TOS + 1: saved left
2049 // TOS + 2: return address
2050 // TOS + 3: right argument.
2051 // TOS + 4: left argument.
2052 __ movq(left, Address(RSP, 4 * kWordSize));
2053 __ movq(right, Address(RSP, 3 * kWordSize));
2054 Label reference_compare, done, check_mint, check_bigint; 2046 Label reference_compare, done, check_mint, check_bigint;
2055 // If any of the arguments is Smi do reference compare. 2047 // If any of the arguments is Smi do reference compare.
2056 __ testq(left, Immediate(kSmiTagMask)); 2048 __ testq(left, Immediate(kSmiTagMask));
2057 __ j(ZERO, &reference_compare); 2049 __ j(ZERO, &reference_compare);
2058 __ testq(right, Immediate(kSmiTagMask)); 2050 __ testq(right, Immediate(kSmiTagMask));
2059 __ j(ZERO, &reference_compare); 2051 __ j(ZERO, &reference_compare);
2060 2052
2061 // Value compare for two doubles. 2053 // Value compare for two doubles.
2062 __ CompareClassId(left, kDoubleCid); 2054 __ CompareClassId(left, kDoubleCid);
2063 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump); 2055 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump);
(...skipping 25 matching lines...) Expand all
2089 __ movq(RSI, right); 2081 __ movq(RSI, right);
2090 __ CallRuntime(kBigintCompareRuntimeEntry); 2082 __ CallRuntime(kBigintCompareRuntimeEntry);
2091 // Result in RAX, 0 means equal. 2083 // Result in RAX, 0 means equal.
2092 __ LeaveFrame(); 2084 __ LeaveFrame();
2093 __ cmpq(RAX, Immediate(0)); 2085 __ cmpq(RAX, Immediate(0));
2094 __ jmp(&done); 2086 __ jmp(&done);
2095 2087
2096 __ Bind(&reference_compare); 2088 __ Bind(&reference_compare);
2097 __ cmpq(left, right); 2089 __ cmpq(left, right);
2098 __ Bind(&done); 2090 __ Bind(&done);
2091 }
2092
2093
2094 // Called only from unoptimized code. All relevant registers have been saved.
2095 // TOS + 0: return address
2096 // TOS + 1: right argument.
2097 // TOS + 2: left argument.
2098 // Returns ZF set.
2099 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub(
2100 Assembler* assembler) {
2101 const Register left = RAX;
2102 const Register right = RDX;
2103
2104 __ movq(left, Address(RSP, 2 * kWordSize));
2105 __ movq(right, Address(RSP, 1 * kWordSize));
2106 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2107 __ ret();
2108 }
2109
2110
2111 // Called from otpimzied code only. Must preserve any registers that are
2112 // destroyed.
2113 // TOS + 0: return address
2114 // TOS + 1: right argument.
2115 // TOS + 2: left argument.
2116 // Returns ZF set.
2117 void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub(
2118 Assembler* assembler) {
2119 const Register left = RAX;
2120 const Register right = RDX;
2121 // Preserve left and right.
2122 __ pushq(left);
2123 __ pushq(right);
2124 __ movq(left, Address(RSP, 4 * kWordSize));
2125 __ movq(right, Address(RSP, 3 * kWordSize));
2126 GenerateIdenticalWithNumberCheckStub(assembler, left, right);
2099 __ popq(right); 2127 __ popq(right);
2100 __ popq(left); 2128 __ popq(left);
2101 __ ret(); 2129 __ ret();
2102 } 2130 }
2103 2131
2104 } // namespace dart 2132 } // namespace dart
2105 2133
2106 #endif // defined TARGET_ARCH_X64 2134 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698