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

Side by Side Diff: src/a64/lithium-codegen-a64.cc

Issue 153993011: A64: Port LSeqStringGetChar. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: whitespace Created 6 years, 10 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 | « src/a64/lithium-codegen-a64.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 4430 matching lines...) Expand 10 before | Expand all | Expand 10 after
4441 __ DropBySMI(parameter_count); 4441 __ DropBySMI(parameter_count);
4442 } 4442 }
4443 __ Ret(); 4443 __ Ret();
4444 4444
4445 if (no_frame_start != -1) { 4445 if (no_frame_start != -1) {
4446 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 4446 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
4447 } 4447 }
4448 } 4448 }
4449 4449
4450 4450
4451 MemOperand LCodeGen::BuildSeqStringOperand(Register string,
4452 Register temp,
4453 LOperand* index,
4454 String::Encoding encoding) {
4455 if (index->IsConstantOperand()) {
4456 int offset = ToInteger32(LConstantOperand::cast(index));
4457 if (encoding == String::TWO_BYTE_ENCODING) {
4458 offset *= kUC16Size;
4459 }
4460 STATIC_ASSERT(kCharSize == 1);
4461 return FieldMemOperand(string, SeqString::kHeaderSize + offset);
4462 }
4463 ASSERT(!temp.is(string));
Rodolph Perfetta (ARM) 2014/02/05 20:07:22 string is declared "AtStart" and temp is declared
4464 ASSERT(!temp.is(ToRegister(index)));
Rodolph Perfetta (ARM) 2014/02/05 20:07:22 ditto.
4465 if (encoding == String::ONE_BYTE_ENCODING) {
4466 __ Add(temp, string, Operand(ToRegister(index)));
4467 } else {
4468 STATIC_ASSERT(kUC16Size == 2);
4469 __ Add(temp, string, Operand(ToRegister(index), LSL, 1));
4470 }
4471 return FieldMemOperand(temp, SeqString::kHeaderSize);
4472 }
4473
4474
4475 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) {
4476 String::Encoding encoding = instr->hydrogen()->encoding();
4477 Register string = ToRegister(instr->string());
4478 Register result = ToRegister(instr->result());
4479 Register temp = ToRegister(instr->temp());
4480
4481 if (FLAG_debug_code) {
Rodolph Perfetta (ARM) 2014/02/05 20:07:22 because string and index are at start, this debug
ulan 2014/02/06 08:55:54 Good catch! I removed "AtStart" and added TODO.
4482 __ Ldr(temp, FieldMemOperand(string, HeapObject::kMapOffset));
4483 __ Ldrb(temp, FieldMemOperand(temp, Map::kInstanceTypeOffset));
4484
4485 __ And(temp, temp,
4486 Operand(kStringRepresentationMask | kStringEncodingMask));
4487 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag;
4488 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag;
4489 __ Cmp(temp, Operand(encoding == String::ONE_BYTE_ENCODING
4490 ? one_byte_seq_type : two_byte_seq_type));
4491 __ Check(eq, kUnexpectedStringType);
4492 }
4493
4494 MemOperand operand =
4495 BuildSeqStringOperand(string, temp, instr->index(), encoding);
4496 if (encoding == String::ONE_BYTE_ENCODING) {
4497 __ Ldrb(result, operand);
4498 } else {
4499 __ Ldrh(result, operand);
4500 }
4501 }
4502
4503
4451 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { 4504 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) {
4452 // TODO(all): Port ARM optimizations from r16707. 4505 // TODO(all): Port ARM optimizations from r16707.
4453 4506
4454 String::Encoding encoding = instr->encoding(); 4507 String::Encoding encoding = instr->encoding();
4455 Register string = ToRegister(instr->string()); 4508 Register string = ToRegister(instr->string());
4456 Register index = ToRegister(instr->index()); 4509 Register index = ToRegister(instr->index());
4457 Register value = ToRegister(instr->value()); 4510 Register value = ToRegister(instr->value());
4458 Register temp = ToRegister(instr->temp()); 4511 Register temp = ToRegister(instr->temp());
4459 4512
4460 if (FLAG_debug_code) { 4513 if (FLAG_debug_code) {
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
5615 __ Bind(&out_of_object); 5668 __ Bind(&out_of_object);
5616 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); 5669 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset));
5617 // Index is equal to negated out of object property index plus 1. 5670 // Index is equal to negated out of object property index plus 1.
5618 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); 5671 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2));
5619 __ Ldr(result, FieldMemOperand(result, 5672 __ Ldr(result, FieldMemOperand(result,
5620 FixedArray::kHeaderSize - kPointerSize)); 5673 FixedArray::kHeaderSize - kPointerSize));
5621 __ Bind(&done); 5674 __ Bind(&done);
5622 } 5675 }
5623 5676
5624 } } // namespace v8::internal 5677 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/a64/lithium-codegen-a64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698