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 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 if (encoding == String::ONE_BYTE_ENCODING) { | 1941 if (encoding == String::ONE_BYTE_ENCODING) { |
1942 __ add(scratch, string, Operand(ToRegister(index))); | 1942 __ add(scratch, string, Operand(ToRegister(index))); |
1943 } else { | 1943 } else { |
1944 STATIC_ASSERT(kUC16Size == 2); | 1944 STATIC_ASSERT(kUC16Size == 2); |
1945 __ add(scratch, string, Operand(ToRegister(index), LSL, 1)); | 1945 __ add(scratch, string, Operand(ToRegister(index), LSL, 1)); |
1946 } | 1946 } |
1947 return FieldMemOperand(scratch, SeqString::kHeaderSize); | 1947 return FieldMemOperand(scratch, SeqString::kHeaderSize); |
1948 } | 1948 } |
1949 | 1949 |
1950 | 1950 |
1951 void LCodeGen::DoSeqStringGetChar(LSeqStringGetChar* instr) { | |
1952 String::Encoding encoding = instr->hydrogen()->encoding(); | |
1953 Register string = ToRegister(instr->string()); | |
1954 Register result = ToRegister(instr->result()); | |
1955 | |
1956 if (FLAG_debug_code) { | |
1957 Register scratch = scratch0(); | |
1958 __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | |
1959 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
1960 | |
1961 __ and_(scratch, scratch, | |
1962 Operand(kStringRepresentationMask | kStringEncodingMask)); | |
1963 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
1964 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
1965 __ cmp(scratch, Operand(encoding == String::ONE_BYTE_ENCODING | |
1966 ? one_byte_seq_type : two_byte_seq_type)); | |
1967 __ Check(eq, kUnexpectedStringType); | |
1968 } | |
1969 | |
1970 MemOperand operand = BuildSeqStringOperand(string, instr->index(), encoding); | |
1971 if (encoding == String::ONE_BYTE_ENCODING) { | |
1972 __ ldrb(result, operand); | |
1973 } else { | |
1974 __ ldrh(result, operand); | |
1975 } | |
1976 } | |
1977 | |
1978 | |
1979 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { | 1951 void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
1980 String::Encoding encoding = instr->hydrogen()->encoding(); | 1952 String::Encoding encoding = instr->hydrogen()->encoding(); |
1981 Register string = ToRegister(instr->string()); | 1953 Register string = ToRegister(instr->string()); |
1982 Register value = ToRegister(instr->value()); | 1954 Register value = ToRegister(instr->value()); |
1983 | 1955 |
1984 if (FLAG_debug_code) { | 1956 if (FLAG_debug_code) { |
1985 Register scratch = scratch0(); | 1957 Register scratch = scratch0(); |
1986 __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); | 1958 __ ldr(scratch, FieldMemOperand(string, HeapObject::kMapOffset)); |
1987 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1959 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
1988 | 1960 |
(...skipping 3875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5864 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5836 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
5865 __ ldr(result, FieldMemOperand(scratch, | 5837 __ ldr(result, FieldMemOperand(scratch, |
5866 FixedArray::kHeaderSize - kPointerSize)); | 5838 FixedArray::kHeaderSize - kPointerSize)); |
5867 __ bind(&done); | 5839 __ bind(&done); |
5868 } | 5840 } |
5869 | 5841 |
5870 | 5842 |
5871 #undef __ | 5843 #undef __ |
5872 | 5844 |
5873 } } // namespace v8::internal | 5845 } } // namespace v8::internal |
OLD | NEW |