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

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 11293168: Rename kAsciiStringTag to kOneByteStringTag (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/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.cc » ('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 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 5065 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset)); 5076 __ lbu(a0, FieldMemOperand(a0, Map::kInstanceTypeOffset));
5077 STATIC_ASSERT(kSeqStringTag == 0); 5077 STATIC_ASSERT(kSeqStringTag == 0);
5078 __ And(at, a0, Operand(kStringRepresentationMask)); 5078 __ And(at, a0, Operand(kStringRepresentationMask));
5079 __ Branch(&external_string, ne, at, Operand(zero_reg)); 5079 __ Branch(&external_string, ne, at, Operand(zero_reg));
5080 5080
5081 __ bind(&seq_string); 5081 __ bind(&seq_string);
5082 // subject: Subject string 5082 // subject: Subject string
5083 // regexp_data: RegExp data (FixedArray) 5083 // regexp_data: RegExp data (FixedArray)
5084 // a0: Instance type of subject string 5084 // a0: Instance type of subject string
5085 STATIC_ASSERT(kStringEncodingMask == 4); 5085 STATIC_ASSERT(kStringEncodingMask == 4);
5086 STATIC_ASSERT(kAsciiStringTag == 4); 5086 STATIC_ASSERT(kOneByteStringTag == 4);
5087 STATIC_ASSERT(kTwoByteStringTag == 0); 5087 STATIC_ASSERT(kTwoByteStringTag == 0);
5088 // Find the code object based on the assumptions above. 5088 // Find the code object based on the assumptions above.
5089 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for ASCII. 5089 __ And(a0, a0, Operand(kStringEncodingMask)); // Non-zero for ASCII.
5090 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset)); 5090 __ lw(t9, FieldMemOperand(regexp_data, JSRegExp::kDataAsciiCodeOffset));
5091 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below). 5091 __ sra(a3, a0, 2); // a3 is 1 for ASCII, 0 for UC16 (used below).
5092 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset)); 5092 __ lw(t1, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset));
5093 __ Movz(t9, t1, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset. 5093 __ Movz(t9, t1, a0); // If UC16 (a0 is 0), replace t9 w/kDataUC16CodeOffset.
5094 5094
5095 // Check that the irregexp code has been generated for the actual string 5095 // Check that the irregexp code has been generated for the actual string
5096 // encoding. If it has, the field contains a code object otherwise it contains 5096 // encoding. If it has, the field contains a code object otherwise it contains
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
6243 // a2: length 6243 // a2: length
6244 // a3: adjusted start index (untagged) 6244 // a3: adjusted start index (untagged)
6245 // Short slice. Copy instead of slicing. 6245 // Short slice. Copy instead of slicing.
6246 __ Branch(&copy_routine, lt, a2, Operand(SlicedString::kMinLength)); 6246 __ Branch(&copy_routine, lt, a2, Operand(SlicedString::kMinLength));
6247 // Allocate new sliced string. At this point we do not reload the instance 6247 // Allocate new sliced string. At this point we do not reload the instance
6248 // type including the string encoding because we simply rely on the info 6248 // type including the string encoding because we simply rely on the info
6249 // provided by the original string. It does not matter if the original 6249 // provided by the original string. It does not matter if the original
6250 // string's encoding is wrong because we always have to recheck encoding of 6250 // string's encoding is wrong because we always have to recheck encoding of
6251 // the newly created string's parent anyways due to externalized strings. 6251 // the newly created string's parent anyways due to externalized strings.
6252 Label two_byte_slice, set_slice_header; 6252 Label two_byte_slice, set_slice_header;
6253 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); 6253 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0);
6254 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 6254 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
6255 __ And(t0, a1, Operand(kStringEncodingMask)); 6255 __ And(t0, a1, Operand(kStringEncodingMask));
6256 __ Branch(&two_byte_slice, eq, t0, Operand(zero_reg)); 6256 __ Branch(&two_byte_slice, eq, t0, Operand(zero_reg));
6257 __ AllocateAsciiSlicedString(v0, a2, t2, t3, &runtime); 6257 __ AllocateAsciiSlicedString(v0, a2, t2, t3, &runtime);
6258 __ jmp(&set_slice_header); 6258 __ jmp(&set_slice_header);
6259 __ bind(&two_byte_slice); 6259 __ bind(&two_byte_slice);
6260 __ AllocateTwoByteSlicedString(v0, a2, t2, t3, &runtime); 6260 __ AllocateTwoByteSlicedString(v0, a2, t2, t3, &runtime);
6261 __ bind(&set_slice_header); 6261 __ bind(&set_slice_header);
6262 __ sll(a3, a3, 1); 6262 __ sll(a3, a3, 1);
6263 __ sw(t1, FieldMemOperand(v0, SlicedString::kParentOffset)); 6263 __ sw(t1, FieldMemOperand(v0, SlicedString::kParentOffset));
(...skipping 22 matching lines...) Expand all
6286 // t1 already points to the first character of underlying string. 6286 // t1 already points to the first character of underlying string.
6287 __ jmp(&allocate_result); 6287 __ jmp(&allocate_result);
6288 6288
6289 __ bind(&sequential_string); 6289 __ bind(&sequential_string);
6290 // Locate first character of underlying subject string. 6290 // Locate first character of underlying subject string.
6291 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize); 6291 STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqAsciiString::kHeaderSize);
6292 __ Addu(t1, t1, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag)); 6292 __ Addu(t1, t1, Operand(SeqAsciiString::kHeaderSize - kHeapObjectTag));
6293 6293
6294 __ bind(&allocate_result); 6294 __ bind(&allocate_result);
6295 // Sequential acii string. Allocate the result. 6295 // Sequential acii string. Allocate the result.
6296 STATIC_ASSERT((kAsciiStringTag & kStringEncodingMask) != 0); 6296 STATIC_ASSERT((kOneByteStringTag & kStringEncodingMask) != 0);
6297 __ And(t0, a1, Operand(kStringEncodingMask)); 6297 __ And(t0, a1, Operand(kStringEncodingMask));
6298 __ Branch(&two_byte_sequential, eq, t0, Operand(zero_reg)); 6298 __ Branch(&two_byte_sequential, eq, t0, Operand(zero_reg));
6299 6299
6300 // Allocate and copy the resulting ASCII string. 6300 // Allocate and copy the resulting ASCII string.
6301 __ AllocateAsciiString(v0, a2, t0, t2, t3, &runtime); 6301 __ AllocateAsciiString(v0, a2, t0, t2, t3, &runtime);
6302 6302
6303 // Locate first character of substring to copy. 6303 // Locate first character of substring to copy.
6304 __ Addu(t1, t1, a3); 6304 __ Addu(t1, t1, a3);
6305 6305
6306 // Locate first character of result. 6306 // Locate first character of result.
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
6658 // At least one of the strings is two-byte. Check whether it happens 6658 // At least one of the strings is two-byte. Check whether it happens
6659 // to contain only ASCII characters. 6659 // to contain only ASCII characters.
6660 // t0: first instance type. 6660 // t0: first instance type.
6661 // t1: second instance type. 6661 // t1: second instance type.
6662 // Branch to if _both_ instances have kAsciiDataHintMask set. 6662 // Branch to if _both_ instances have kAsciiDataHintMask set.
6663 __ And(at, t0, Operand(kAsciiDataHintMask)); 6663 __ And(at, t0, Operand(kAsciiDataHintMask));
6664 __ and_(at, at, t1); 6664 __ and_(at, at, t1);
6665 __ Branch(&ascii_data, ne, at, Operand(zero_reg)); 6665 __ Branch(&ascii_data, ne, at, Operand(zero_reg));
6666 6666
6667 __ xor_(t0, t0, t1); 6667 __ xor_(t0, t0, t1);
6668 STATIC_ASSERT(kAsciiStringTag != 0 && kAsciiDataHintTag != 0); 6668 STATIC_ASSERT(kOneByteStringTag != 0 && kAsciiDataHintTag != 0);
6669 __ And(t0, t0, Operand(kAsciiStringTag | kAsciiDataHintTag)); 6669 __ And(t0, t0, Operand(kOneByteStringTag | kAsciiDataHintTag));
6670 __ Branch(&ascii_data, eq, t0, Operand(kAsciiStringTag | kAsciiDataHintTag)); 6670 __ Branch(
6671 &ascii_data, eq, t0, Operand(kOneByteStringTag | kAsciiDataHintTag));
6671 6672
6672 // Allocate a two byte cons string. 6673 // Allocate a two byte cons string.
6673 __ AllocateTwoByteConsString(v0, t2, t0, t1, &call_runtime); 6674 __ AllocateTwoByteConsString(v0, t2, t0, t1, &call_runtime);
6674 __ Branch(&allocated); 6675 __ Branch(&allocated);
6675 6676
6676 // We cannot encounter sliced strings or cons strings here since: 6677 // We cannot encounter sliced strings or cons strings here since:
6677 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength); 6678 STATIC_ASSERT(SlicedString::kMinLength >= ConsString::kMinLength);
6678 // Handle creating a flat result from either external or sequential strings. 6679 // Handle creating a flat result from either external or sequential strings.
6679 // Locate the first characters' locations. 6680 // Locate the first characters' locations.
6680 // a0: first string 6681 // a0: first string
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
7834 __ Pop(ra, t1, a1); 7835 __ Pop(ra, t1, a1);
7835 __ Ret(); 7836 __ Ret();
7836 } 7837 }
7837 7838
7838 7839
7839 #undef __ 7840 #undef __
7840 7841
7841 } } // namespace v8::internal 7842 } } // namespace v8::internal
7842 7843
7843 #endif // V8_TARGET_ARCH_MIPS 7844 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698