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

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

Issue 11348349: Improve array to string conversion. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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') | src/ia32/codegen-ia32.cc » ('J')
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // Two-byte string. 514 // Two-byte string.
515 __ ldrh(result, MemOperand(string, index, LSL, 1)); 515 __ ldrh(result, MemOperand(string, index, LSL, 1));
516 __ jmp(&done); 516 __ jmp(&done);
517 __ bind(&ascii); 517 __ bind(&ascii);
518 // Ascii string. 518 // Ascii string.
519 __ ldrb(result, MemOperand(string, index)); 519 __ ldrb(result, MemOperand(string, index));
520 __ bind(&done); 520 __ bind(&done);
521 } 521 }
522 522
523 523
524 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
525 bool one_byte_string,
526 Register string,
527 Register index,
528 Register value) {
529 if (FLAG_debug_code) {
530 __ tst(index, Operand(kSmiTagMask));
531 __ Check(eq, "Non-smi index");
532 __ tst(value, Operand(kSmiTagMask));
533 __ Check(eq, "Non-smi value");
534
535 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset));
536 __ cmp(index, ip);
537 __ Check(lt, "Index is too large");
538
539 __ cmp(index, Operand(Smi::FromInt(0)));
540 __ Check(ge, "Index is negative");
541
542 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
543 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
544
545 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
546 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
547 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
548 __ cmp(ip, Operand(one_byte_string ? one_byte_seq_type
549 : two_byte_seq_type));
550 __ Check(eq, "Unexpected string type");
551 }
552
553 __ add(ip,
554 string,
555 Operand(SeqString::kHeaderSize - kHeapObjectTag));
556 STATIC_ASSERT(kSmiTagSize == 1);
557 __ SmiUntag(value, value);
558 if (one_byte_string) {
559 __ strb(value, MemOperand(ip, index, LSR, 1));
560 } else {
561 __ strh(value, MemOperand(ip, index));
Toon Verwaest 2012/12/05 14:29:12 Please add a comment here as well to indicate that
562 }
563 }
564
565
524 static MemOperand ExpConstant(int index, Register base) { 566 static MemOperand ExpConstant(int index, Register base) {
525 return MemOperand(base, index * kDoubleSize); 567 return MemOperand(base, index * kDoubleSize);
526 } 568 }
527 569
528 570
529 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 571 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
530 DoubleRegister input, 572 DoubleRegister input,
531 DoubleRegister result, 573 DoubleRegister result,
532 DoubleRegister double_scratch1, 574 DoubleRegister double_scratch1,
533 DoubleRegister double_scratch2, 575 DoubleRegister double_scratch2,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 patcher.masm()->add(r0, pc, Operand(-8)); 695 patcher.masm()->add(r0, pc, Operand(-8));
654 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 696 patcher.masm()->ldr(pc, MemOperand(pc, -4));
655 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 697 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
656 } 698 }
657 } 699 }
658 700
659 701
660 } } // namespace v8::internal 702 } } // namespace v8::internal
661 703
662 #endif // V8_TARGET_ARCH_ARM 704 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/full-codegen-arm.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698