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

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

Issue 15085026: ARM: Smi refactoring and improvements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 // Dispatch on the indirect string shape: slice or cons. 434 // Dispatch on the indirect string shape: slice or cons.
435 Label cons_string; 435 Label cons_string;
436 __ tst(result, Operand(kSlicedNotConsMask)); 436 __ tst(result, Operand(kSlicedNotConsMask));
437 __ b(eq, &cons_string); 437 __ b(eq, &cons_string);
438 438
439 // Handle slices. 439 // Handle slices.
440 Label indirect_string_loaded; 440 Label indirect_string_loaded;
441 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 441 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
442 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); 442 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
443 __ add(index, index, Operand(result, ASR, kSmiTagSize)); 443 __ add(index, index, Operand::SmiUntag(result));
444 __ jmp(&indirect_string_loaded); 444 __ jmp(&indirect_string_loaded);
445 445
446 // Handle cons strings. 446 // Handle cons strings.
447 // Check whether the right hand side is the empty string (i.e. if 447 // Check whether the right hand side is the empty string (i.e. if
448 // this is really a flat string in a cons string). If that is not 448 // this is really a flat string in a cons string). If that is not
449 // the case we would rather go to the runtime system now to flatten 449 // the case we would rather go to the runtime system now to flatten
450 // the string. 450 // the string.
451 __ bind(&cons_string); 451 __ bind(&cons_string);
452 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); 452 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
453 __ CompareRoot(result, Heap::kempty_stringRootIndex); 453 __ CompareRoot(result, Heap::kempty_stringRootIndex);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 __ bind(&done); 503 __ bind(&done);
504 } 504 }
505 505
506 506
507 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm, 507 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm,
508 String::Encoding encoding, 508 String::Encoding encoding,
509 Register string, 509 Register string,
510 Register index, 510 Register index,
511 Register value) { 511 Register value) {
512 if (FLAG_debug_code) { 512 if (FLAG_debug_code) {
513 __ tst(index, Operand(kSmiTagMask)); 513 __ SmiTst(index);
514 __ Check(eq, "Non-smi index"); 514 __ Check(eq, "Non-smi index");
515 __ tst(value, Operand(kSmiTagMask)); 515 __ SmiTst(value);
516 __ Check(eq, "Non-smi value"); 516 __ Check(eq, "Non-smi value");
517 517
518 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset)); 518 __ ldr(ip, FieldMemOperand(string, String::kLengthOffset));
519 __ cmp(index, ip); 519 __ cmp(index, ip);
520 __ Check(lt, "Index is too large"); 520 __ Check(lt, "Index is too large");
521 521
522 __ cmp(index, Operand(Smi::FromInt(0))); 522 __ cmp(index, Operand(Smi::FromInt(0)));
523 __ Check(ge, "Index is negative"); 523 __ Check(ge, "Index is negative");
524 524
525 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); 525 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset));
526 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); 526 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset));
527 527
528 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); 528 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask));
529 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; 529 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
530 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; 530 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
531 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING 531 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING
532 ? one_byte_seq_type : two_byte_seq_type)); 532 ? one_byte_seq_type : two_byte_seq_type));
533 __ Check(eq, "Unexpected string type"); 533 __ Check(eq, "Unexpected string type");
534 } 534 }
535 535
536 __ add(ip, 536 __ add(ip,
537 string, 537 string,
538 Operand(SeqString::kHeaderSize - kHeapObjectTag)); 538 Operand(SeqString::kHeaderSize - kHeapObjectTag));
539 __ SmiUntag(value, value); 539 __ SmiUntag(value, value);
540 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); 540 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
541 if (encoding == String::ONE_BYTE_ENCODING) { 541 if (encoding == String::ONE_BYTE_ENCODING) {
542 // Smis are tagged by left shift by 1, thus LSR by 1 to smi-untag inline. 542 // Smis are tagged by left shift by 1, thus LSR by 1 to smi-untag inline.
543 __ strb(value, MemOperand(ip, index, LSR, 1)); 543 __ strb(value, MemOperand(ip, index, LSR, kSmiTagSize));
544 } else { 544 } else {
545 // No need to untag a smi for two-byte addressing. 545 // No need to untag a smi for two-byte addressing.
546 __ strh(value, MemOperand(ip, index)); 546 __ strh(value, MemOperand(ip, index)); // LSL(1 - kSmiTagSize).
547 } 547 }
548 } 548 }
549 549
550 550
551 static MemOperand ExpConstant(int index, Register base) { 551 static MemOperand ExpConstant(int index, Register base) {
552 return MemOperand(base, index * kDoubleSize); 552 return MemOperand(base, index * kDoubleSize);
553 } 553 }
554 554
555 555
556 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, 556 void MathExpGenerator::EmitMathExp(MacroAssembler* masm,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 patcher.masm()->add(r0, pc, Operand(-8)); 681 patcher.masm()->add(r0, pc, Operand(-8));
682 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 682 patcher.masm()->ldr(pc, MemOperand(pc, -4));
683 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); 683 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start()));
684 } 684 }
685 } 685 }
686 686
687 687
688 } } // namespace v8::internal 688 } } // namespace v8::internal
689 689
690 #endif // V8_TARGET_ARCH_ARM 690 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/debug-arm.cc » ('j') | src/arm/macro-assembler-arm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698