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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 11360251: Make kAsciiDataHintTag have correct semantics for all both 1 and 2 byte string types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 | « src/x64/code-stubs-x64.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 2194
2195 // Load instance type for both strings. 2195 // Load instance type for both strings.
2196 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset)); 2196 movq(scratch1, FieldOperand(first_object, HeapObject::kMapOffset));
2197 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset)); 2197 movq(scratch2, FieldOperand(second_object, HeapObject::kMapOffset));
2198 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset)); 2198 movzxbl(scratch1, FieldOperand(scratch1, Map::kInstanceTypeOffset));
2199 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset)); 2199 movzxbl(scratch2, FieldOperand(scratch2, Map::kInstanceTypeOffset));
2200 2200
2201 // Check that both are flat ASCII strings. 2201 // Check that both are flat ASCII strings.
2202 ASSERT(kNotStringTag != 0); 2202 ASSERT(kNotStringTag != 0);
2203 const int kFlatAsciiStringMask = 2203 const int kFlatAsciiStringMask =
2204 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; 2204 kIsNotStringMask | kStringEncodingMask | kAsciiDataHintMask |
2205 kStringRepresentationMask;
2205 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; 2206 const int kFlatAsciiStringTag = ASCII_STRING_TYPE;
2206 2207
2207 andl(scratch1, Immediate(kFlatAsciiStringMask)); 2208 andl(scratch1, Immediate(kFlatAsciiStringMask));
2208 andl(scratch2, Immediate(kFlatAsciiStringMask)); 2209 andl(scratch2, Immediate(kFlatAsciiStringMask));
2209 // Interleave the bits to check both scratch1 and scratch2 in one test. 2210 // Interleave the bits to check both scratch1 and scratch2 in one test.
2210 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 2211 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 8));
2211 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 2212 ASSERT_EQ(ASCII_STRING_TYPE, ASCII_STRING_TYPE & kFlatAsciiStringMask);
2213 shl(scratch1, Immediate(8));
2214 orl(scratch1, scratch2);
2212 cmpl(scratch1, 2215 cmpl(scratch1,
2213 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); 2216 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 8)));
2214 j(not_equal, on_fail, near_jump); 2217 j(not_equal, on_fail, near_jump);
2215 } 2218 }
2216 2219
2217 2220
2218 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii( 2221 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(
2219 Register instance_type, 2222 Register instance_type,
2220 Register scratch, 2223 Register scratch,
2221 Label* failure, 2224 Label* failure,
2222 Label::Distance near_jump) { 2225 Label::Distance near_jump) {
2223 if (!scratch.is(instance_type)) { 2226 if (!scratch.is(instance_type)) {
(...skipping 15 matching lines...) Expand all
2239 Register scratch1, 2242 Register scratch1,
2240 Register scratch2, 2243 Register scratch2,
2241 Label* on_fail, 2244 Label* on_fail,
2242 Label::Distance near_jump) { 2245 Label::Distance near_jump) {
2243 // Load instance type for both strings. 2246 // Load instance type for both strings.
2244 movq(scratch1, first_object_instance_type); 2247 movq(scratch1, first_object_instance_type);
2245 movq(scratch2, second_object_instance_type); 2248 movq(scratch2, second_object_instance_type);
2246 2249
2247 // Check that both are flat ASCII strings. 2250 // Check that both are flat ASCII strings.
2248 ASSERT(kNotStringTag != 0); 2251 ASSERT(kNotStringTag != 0);
2249 const int kFlatAsciiStringMask = 2252 const int kFlatAsciiStringMask = kIsNotStringMask | kStringRepresentationMask
2250 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask; 2253 | kStringEncodingMask | kAsciiDataHintTag;
2251 const int kFlatAsciiStringTag = ASCII_STRING_TYPE; 2254 const int kFlatAsciiStringTag = ASCII_STRING_TYPE;
2252 2255
2253 andl(scratch1, Immediate(kFlatAsciiStringMask)); 2256 andl(scratch1, Immediate(kFlatAsciiStringMask));
2254 andl(scratch2, Immediate(kFlatAsciiStringMask)); 2257 andl(scratch2, Immediate(kFlatAsciiStringMask));
2255 // Interleave the bits to check both scratch1 and scratch2 in one test. 2258 // Interleave the bits to check both scratch1 and scratch2 in one test.
2256 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 2259 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 8));
2257 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 2260 ASSERT_EQ(ASCII_STRING_TYPE, ASCII_STRING_TYPE & kFlatAsciiStringMask);
2261 shl(scratch1, Immediate(8));
2262 orl(scratch1, scratch2);
2258 cmpl(scratch1, 2263 cmpl(scratch1,
2259 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); 2264 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 8)));
2260 j(not_equal, on_fail, near_jump); 2265 j(not_equal, on_fail, near_jump);
2261 } 2266 }
2262 2267
2263 2268
2264 2269
2265 void MacroAssembler::Move(Register dst, Register src) { 2270 void MacroAssembler::Move(Register dst, Register src) {
2266 if (!dst.is(src)) { 2271 if (!dst.is(src)) {
2267 movq(dst, src); 2272 movq(dst, src);
2268 } 2273 }
2269 } 2274 }
(...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
4560 4565
4561 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 4566 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
4562 cmpq(rcx, null_value); 4567 cmpq(rcx, null_value);
4563 j(not_equal, &next); 4568 j(not_equal, &next);
4564 } 4569 }
4565 4570
4566 4571
4567 } } // namespace v8::internal 4572 } } // namespace v8::internal
4568 4573
4569 #endif // V8_TARGET_ARCH_X64 4574 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698