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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 15743006: Improve SeqStringSetChar implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: small fix Created 7 years, 7 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 | « no previous file | src/arm/full-codegen-arm.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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Two-byte string. 497 // Two-byte string.
498 __ ldrh(result, MemOperand(string, index, LSL, 1)); 498 __ ldrh(result, MemOperand(string, index, LSL, 1));
499 __ jmp(&done); 499 __ jmp(&done);
500 __ bind(&ascii); 500 __ bind(&ascii);
501 // Ascii string. 501 // Ascii string.
502 __ ldrb(result, MemOperand(string, index)); 502 __ ldrb(result, MemOperand(string, index));
503 __ bind(&done); 503 __ bind(&done);
504 } 504 }
505 505
506 506
507 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
508 String::Encoding encoding,
509 Register string,
510 Register index,
511 Register value) {
512 if (FLAG_debug_code) {
513 __ SmiTst(index);
514 __ Check(eq, "Non-smi index");
515 __ SmiTst(value);
516 __ Check(eq, "Non-smi value");
517
518 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset));
519 __ cmp(index, ip);
520 __ Check(lt, "Index is too large");
521
522 __ cmp(index, Operand(Smi::FromInt(0)));
523 __ Check(ge, "Index is negative");
524
525 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
526 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
527
528 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
529 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
530 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
531 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING
532 ? one_byte_seq_type : two_byte_seq_type));
533 __ Check(eq, "Unexpected string type");
534 }
535
536 __ add(ip,
537 string,
538 Operand(SeqString::kHeaderSize - kHeapObjectTag));
539 __ SmiUntag(value, value);
540 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
541 if (encoding == String::ONE_BYTE_ENCODING) {
542 // Smis are tagged by left shift by 1, thus LSR by 1 to smi-untag inline.
543 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize));
544 } else {
545 // No need to untag a smi for two-byte addressing.
546 __ strh(value, MemOperand(ip, index)); // LSL(1 - kSmiTagSize).
547 }
548 }
549
550
551 static MemOperand ExpConstant(int index, Register base) { 507 static MemOperand ExpConstant(int index, Register base) {
552 return MemOperand(base, index * kDoubleSize); 508 return MemOperand(base, index * kDoubleSize);
553 } 509 }
554 510
555 511
556 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 512 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
557 DwVfpRegister input, 513 DwVfpRegister input,
558 DwVfpRegister result, 514 DwVfpRegister result,
559 DwVfpRegister double_scratch1, 515 DwVfpRegister double_scratch1,
560 DwVfpRegister double_scratch2, 516 DwVfpRegister double_scratch2,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 patcher.masm()->add(r0, pc, Operand(-8)); 637 patcher.masm()->add(r0, pc, Operand(-8));
682 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 638 patcher.masm()->ldr(pc, MemOperand(pc, -4));
683 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 639 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
684 } 640 }
685 } 641 }
686 642
687 643
688 } } // namespace v8::internal 644 } } // namespace v8::internal
689 645
690 #endif // V8_TARGET_ARCH_ARM 646 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698