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

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

Issue 11414136: Implement proposed new identity spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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_ia32.cc ('k') | tests/language/language_dart2js.status » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 AssemblerMacros::EnterStubFrame(assembler); 2084 AssemblerMacros::EnterStubFrame(assembler);
2085 __ pushq(RAX); 2085 __ pushq(RAX);
2086 __ pushq(RDX); 2086 __ pushq(RDX);
2087 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); 2087 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry);
2088 __ popq(RDX); 2088 __ popq(RDX);
2089 __ popq(RAX); 2089 __ popq(RAX);
2090 __ LeaveFrame(); 2090 __ LeaveFrame();
2091 __ ret(); 2091 __ ret();
2092 } 2092 }
2093 2093
2094
2095 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t,
2096 BigintCompare,
2097 RawBigint* left,
2098 RawBigint* right);
2099
2100
2101 // Does identical check (object references are equal or not equal) with special
2102 // checks for boxed numbers.
2103 // Left and right are pushed on stack.
2104 // Return ZF set.
2105 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint
2106 // cannot contain a value that fits in Mint or Smi.
2107 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) {
2108 const Register left = RAX;
2109 const Register right = RDX;
2110 // Preserve left, right and temp.
2111 __ pushq(left);
2112 __ pushq(right);
2113 // TOS + 0: saved right
2114 // TOS + 1: saved left
2115 // TOS + 2: return address
2116 // TOS + 3: right argument.
2117 // TOS + 4: left argument.
2118 __ movq(left, Address(RSP, 4 * kWordSize));
2119 __ movq(right, Address(RSP, 3 * kWordSize));
2120 Label reference_compare, done, check_mint, check_bigint;
2121 // If any of the arguments is Smi do reference compare.
2122 __ testq(left, Immediate(kSmiTagMask));
2123 __ j(ZERO, &reference_compare);
2124 __ testq(right, Immediate(kSmiTagMask));
2125 __ j(ZERO, &reference_compare);
2126
2127 // Value compare for two doubles.
2128 __ CompareClassId(left, kDoubleCid);
2129 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump);
2130 __ CompareClassId(right, kDoubleCid);
2131 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2132
2133 // Double values bitwise compare.
2134 __ movq(left, FieldAddress(left, Double::value_offset()));
2135 __ cmpq(left, FieldAddress(right, Double::value_offset()));
2136 __ jmp(&done, Assembler::kNearJump);
2137
2138 __ Bind(&check_mint);
2139 __ CompareClassId(left, kMintCid);
2140 __ j(NOT_EQUAL, &check_bigint, Assembler::kNearJump);
2141 __ CompareClassId(right, kMintCid);
2142 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2143 __ movq(left, FieldAddress(left, Mint::value_offset()));
2144 __ cmpq(left, FieldAddress(right, Mint::value_offset()));
2145 __ jmp(&done, Assembler::kNearJump);
2146
2147 __ Bind(&check_bigint);
2148 __ CompareClassId(left, kBigintCid);
2149 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump);
2150 __ CompareClassId(right, kBigintCid);
2151 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2152 __ EnterFrame(0);
2153 __ ReserveAlignedFrameSpace(0);
2154 __ movq(RDI, left);
2155 __ movq(RSI, right);
2156 __ CallRuntime(kBigintCompareRuntimeEntry);
2157 // Result in RAX, 0 means equal.
2158 __ LeaveFrame();
2159 __ cmpq(RAX, Immediate(0));
2160 __ jmp(&done);
2161
2162 __ Bind(&reference_compare);
2163 __ cmpq(left, right);
2164 __ Bind(&done);
2165 __ popq(right);
2166 __ popq(left);
2167 __ ret();
2168 }
2169
2094 } // namespace dart 2170 } // namespace dart
2095 2171
2096 #endif // defined TARGET_ARCH_X64 2172 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698