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

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

Issue 8568013: Introduce read buffer for external strings when using charAt (ia32). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 9 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/runtime.cc ('k') | test/mjsunit/string-externalize.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4203 matching lines...) Expand 10 before | Expand all | Expand 10 after
4214 // If it's external, the length is just ExternalString::kSize. 4214 // If it's external, the length is just ExternalString::kSize.
4215 // Otherwise it's String::kHeaderSize + string->length() * (1 or 2). 4215 // Otherwise it's String::kHeaderSize + string->length() * (1 or 2).
4216 Label not_external; 4216 Label not_external;
4217 // External strings are the only ones with the kExternalStringTag bit 4217 // External strings are the only ones with the kExternalStringTag bit
4218 // set. 4218 // set.
4219 ASSERT_EQ(0, kSeqStringTag & kExternalStringTag); 4219 ASSERT_EQ(0, kSeqStringTag & kExternalStringTag);
4220 ASSERT_EQ(0, kConsStringTag & kExternalStringTag); 4220 ASSERT_EQ(0, kConsStringTag & kExternalStringTag);
4221 testb(instance_type, Immediate(kExternalStringTag)); 4221 testb(instance_type, Immediate(kExternalStringTag));
4222 j(zero, &not_external, Label::kNear); 4222 j(zero, &not_external, Label::kNear);
4223 movq(length, Immediate(ExternalString::kSize)); 4223 movq(length, Immediate(ExternalString::kSize));
4224 testb(instance_type, Immediate(kBufferedStringTag));
4225 j(zero, &is_data_object, Label::kNear);
4226 movq(length, Immediate(ExternalString::kExtendedSize));
4224 jmp(&is_data_object, Label::kNear); 4227 jmp(&is_data_object, Label::kNear);
4225 4228
4226 bind(&not_external); 4229 bind(&not_external);
4227 // Sequential string, either ASCII or UC16. 4230 // Sequential string, either ASCII or UC16.
4228 ASSERT(kAsciiStringTag == 0x04); 4231 ASSERT(kAsciiStringTag == 0x04);
4229 and_(length, Immediate(kStringEncodingMask)); 4232 and_(length, Immediate(kStringEncodingMask));
4230 xor_(length, Immediate(kStringEncodingMask)); 4233 xor_(length, Immediate(kStringEncodingMask));
4231 addq(length, Immediate(0x04)); 4234 addq(length, Immediate(0x04));
4232 // Value now either 4 (if ASCII) or 8 (if UC16), i.e. char-size shifted by 2. 4235 // Value now either 4 (if ASCII) or 8 (if UC16), i.e. char-size shifted by 2.
4233 imul(length, FieldOperand(value, String::kLengthOffset)); 4236 imul(length, FieldOperand(value, String::kLengthOffset));
4234 shr(length, Immediate(2 + kSmiTagSize + kSmiShiftSize)); 4237 shr(length, Immediate(2 + kSmiTagSize + kSmiShiftSize));
4235 addq(length, Immediate(SeqString::kHeaderSize + kObjectAlignmentMask)); 4238 addq(length, Immediate(SeqString::kHeaderSize + kObjectAlignmentMask));
4236 and_(length, Immediate(~kObjectAlignmentMask)); 4239 and_(length, Immediate(~kObjectAlignmentMask));
4237 4240
4238 bind(&is_data_object); 4241 bind(&is_data_object);
4239 // Value is a data object, and it is white. Mark it black. Since we know 4242 // Value is a data object, and it is white. Mark it black. Since we know
4240 // that the object is white we can make it black by flipping one bit. 4243 // that the object is white we can make it black by flipping one bit.
4241 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch); 4244 or_(Operand(bitmap_scratch, MemoryChunk::kHeaderSize), mask_scratch);
4242 4245
4243 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); 4246 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask));
4244 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); 4247 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length);
4245 4248
4246 bind(&done); 4249 bind(&done);
4247 } 4250 }
4248 4251
4249 } } // namespace v8::internal 4252 } } // namespace v8::internal
4250 4253
4251 #endif // V8_TARGET_ARCH_X64 4254 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/string-externalize.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698