OLD | NEW |
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 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 __ PrepareCallCFunction(2, scratch); | 1968 __ PrepareCallCFunction(2, scratch); |
1969 __ mov(r1, Operand(index)); | 1969 __ mov(r1, Operand(index)); |
1970 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 1970 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
1971 __ bind(&done); | 1971 __ bind(&done); |
1972 } | 1972 } |
1973 } | 1973 } |
1974 | 1974 |
1975 | 1975 |
1976 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 1976 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
1977 Register string = ToRegister(instr->string()); | 1977 Register string = ToRegister(instr->string()); |
1978 LOperand* index_op = instr->index(); | 1978 Register index = ToRegister(instr->index()); |
1979 Register value = ToRegister(instr->value()); | 1979 Register value = ToRegister(instr->value()); |
1980 Register scratch = scratch0(); | |
1981 String::Encoding encoding = instr->encoding(); | 1980 String::Encoding encoding = instr->encoding(); |
1982 | 1981 |
1983 if (FLAG_debug_code) { | 1982 if (FLAG_debug_code) { |
1984 __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 1983 __ ldr(ip, FieldMemOperand(string, HeapObject::kMapOffset)); |
1985 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1984 __ ldrb(ip, FieldMemOperand(ip, Map::kInstanceTypeOffset)); |
1986 | 1985 |
1987 __ and_(scratch, scratch, | 1986 __ and_(ip, ip, Operand(kStringRepresentationMask | kStringEncodingMask)); |
1988 Operand(kStringRepresentationMask | kStringEncodingMask)); | |
1989 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | 1987 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; |
1990 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | 1988 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
1991 __ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING | 1989 __ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING |
1992 ? one_byte_seq_type : two_byte_seq_type)); | 1990 ? one_byte_seq_type : two_byte_seq_type)); |
1993 __ Check(eq, kUnexpectedStringType); | 1991 __ Check(eq, kUnexpectedStringType); |
1994 } | 1992 } |
1995 | 1993 |
1996 if (index_op->IsConstantOperand()) { | 1994 __ add(ip, |
1997 int constant_index = ToInteger32(LConstantOperand::cast(index_op)); | 1995 string, |
1998 if (encoding == String::ONE_BYTE_ENCODING) { | 1996 Operand(SeqString::kHeaderSize - kHeapObjectTag)); |
1999 __ strb(value, | 1997 if (encoding == String::ONE_BYTE_ENCODING) { |
2000 FieldMemOperand(string, SeqString::kHeaderSize + constant_index)); | 1998 __ strb(value, MemOperand(ip, index)); |
2001 } else { | |
2002 __ strh(value, | |
2003 FieldMemOperand(string, SeqString::kHeaderSize + constant_index * 2)); | |
2004 } | |
2005 } else { | 1999 } else { |
2006 Register index = ToRegister(index_op); | 2000 // MemOperand with ip as the base register is not allowed for strh, so |
2007 if (encoding == String::ONE_BYTE_ENCODING) { | 2001 // we do the address calculation explicitly. |
2008 __ add(scratch, string, Operand(index)); | 2002 __ add(ip, ip, Operand(index, LSL, 1)); |
2009 __ strb(value, FieldMemOperand(scratch, SeqString::kHeaderSize)); | 2003 __ strh(value, MemOperand(ip)); |
2010 } else { | |
2011 __ add(scratch, string, Operand(index, LSL, 1)); | |
2012 __ strh(value, FieldMemOperand(scratch, SeqString::kHeaderSize)); | |
2013 } | |
2014 } | 2004 } |
2015 } | 2005 } |
2016 | 2006 |
2017 | 2007 |
2018 void LCodeGen::DoThrow(LThrow* instr) { | 2008 void LCodeGen::DoThrow(LThrow* instr) { |
2019 Register input_reg = EmitLoadRegister(instr->value(), ip); | 2009 Register input_reg = EmitLoadRegister(instr->value(), ip); |
2020 __ push(input_reg); | 2010 __ push(input_reg); |
2021 CallRuntime(Runtime::kThrow, 1, instr); | 2011 CallRuntime(Runtime::kThrow, 1, instr); |
2022 | 2012 |
2023 if (FLAG_debug_code) { | 2013 if (FLAG_debug_code) { |
(...skipping 3763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5787 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5777 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5788 __ ldr(result, FieldMemOperand(scratch, | 5778 __ ldr(result, FieldMemOperand(scratch, |
5789 FixedArray::kHeaderSize - kPointerSize)); | 5779 FixedArray::kHeaderSize - kPointerSize)); |
5790 __ bind(&done); | 5780 __ bind(&done); |
5791 } | 5781 } |
5792 | 5782 |
5793 | 5783 |
5794 #undef __ | 5784 #undef __ |
5795 | 5785 |
5796 } } // namespace v8::internal | 5786 } } // namespace v8::internal |
OLD | NEW |