| OLD | NEW |
| 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 4451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4462 __ DropBySMI(parameter_count); | 4462 __ DropBySMI(parameter_count); |
| 4463 } | 4463 } |
| 4464 __ Ret(); | 4464 __ Ret(); |
| 4465 | 4465 |
| 4466 if (no_frame_start != -1) { | 4466 if (no_frame_start != -1) { |
| 4467 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 4467 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 4468 } | 4468 } |
| 4469 } | 4469 } |
| 4470 | 4470 |
| 4471 | 4471 |
| 4472 MemOperand LCodeGen::BuildSeqStringOperand(Register string, |
| 4473 Register temp, |
| 4474 LOperand* index, |
| 4475 String::Encoding encoding) { |
| 4476 if (index->IsConstantOperand()) { |
| 4477 int offset = ToInteger32(LConstantOperand::cast(index)); |
| 4478 if (encoding == String::TWO_BYTE_ENCODING) { |
| 4479 offset *= kUC16Size; |
| 4480 } |
| 4481 STATIC_ASSERT(kCharSize == 1); |
| 4482 return FieldMemOperand(string, SeqString::kHeaderSize + offset); |
| 4483 } |
| 4484 ASSERT(!temp.is(string)); |
| 4485 ASSERT(!temp.is(ToRegister(index))); |
| 4486 if (encoding == String::ONE_BYTE_ENCODING) { |
| 4487 __ Add(temp, string, Operand(ToRegister(index))); |
| 4488 } else { |
| 4489 STATIC_ASSERT(kUC16Size == 2); |
| 4490 __ Add(temp, string, Operand(ToRegister(index), LSL, 1)); |
| 4491 } |
| 4492 return FieldMemOperand(temp, SeqString::kHeaderSize); |
| 4493 } |
| 4494 |
| 4495 |
| 4496 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { |
| 4497 String::Encoding encoding = instr->hydrogen()->encoding(); |
| 4498 Register string = ToRegister(instr->string()); |
| 4499 Register result = ToRegister(instr->result()); |
| 4500 Register temp = ToRegister(instr->temp()); |
| 4501 |
| 4502 if (FLAG_debug_code) { |
| 4503 __ Ldr(temp, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 4504 __ Ldrb(temp, FieldMemOperand(temp, Map::kInstanceTypeOffset)); |
| 4505 |
| 4506 __ And(temp, temp, |
| 4507 Operand(kStringRepresentationMask | kStringEncodingMask)); |
| 4508 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
| 4509 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
| 4510 __ Cmp(temp, Operand(encoding == String::ONE_BYTE_ENCODING |
| 4511 ? one_byte_seq_type : two_byte_seq_type)); |
| 4512 __ Check(eq, kUnexpectedStringType); |
| 4513 } |
| 4514 |
| 4515 MemOperand operand = |
| 4516 BuildSeqStringOperand(string, temp, instr->index(), encoding); |
| 4517 if (encoding == String::ONE_BYTE_ENCODING) { |
| 4518 __ Ldrb(result, operand); |
| 4519 } else { |
| 4520 __ Ldrh(result, operand); |
| 4521 } |
| 4522 } |
| 4523 |
| 4524 |
| 4472 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 4525 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
| 4473 // TODO(all): Port ARM optimizations from r16707. | 4526 // TODO(all): Port ARM optimizations from r16707. |
| 4474 | 4527 |
| 4475 String::Encoding encoding = instr->encoding(); | 4528 String::Encoding encoding = instr->encoding(); |
| 4476 Register string = ToRegister(instr->string()); | 4529 Register string = ToRegister(instr->string()); |
| 4477 Register index = ToRegister(instr->index()); | 4530 Register index = ToRegister(instr->index()); |
| 4478 Register value = ToRegister(instr->value()); | 4531 Register value = ToRegister(instr->value()); |
| 4479 Register temp = ToRegister(instr->temp()); | 4532 Register temp = ToRegister(instr->temp()); |
| 4480 | 4533 |
| 4481 if (FLAG_debug_code) { | 4534 if (FLAG_debug_code) { |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5639 __ Bind(&out_of_object); | 5692 __ Bind(&out_of_object); |
| 5640 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5693 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5641 // Index is equal to negated out of object property index plus 1. | 5694 // Index is equal to negated out of object property index plus 1. |
| 5642 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5695 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5643 __ Ldr(result, FieldMemOperand(result, | 5696 __ Ldr(result, FieldMemOperand(result, |
| 5644 FixedArray::kHeaderSize - kPointerSize)); | 5697 FixedArray::kHeaderSize - kPointerSize)); |
| 5645 __ Bind(&done); | 5698 __ Bind(&done); |
| 5646 } | 5699 } |
| 5647 | 5700 |
| 5648 } } // namespace v8::internal | 5701 } } // namespace v8::internal |
| OLD | NEW |