| 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 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 // Load the byte into the result register. | 1050 // Load the byte into the result register. |
| 1051 __ bind(&ascii); | 1051 __ bind(&ascii); |
| 1052 __ movzx_b(result, FieldOperand(string, | 1052 __ movzx_b(result, FieldOperand(string, |
| 1053 index, | 1053 index, |
| 1054 times_1, | 1054 times_1, |
| 1055 SeqOneByteString::kHeaderSize)); | 1055 SeqOneByteString::kHeaderSize)); |
| 1056 __ bind(&done); | 1056 __ bind(&done); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 | 1059 |
| 1060 void SeqStringSetCharGenerator::Generate(MacroAssembler* masm, | |
| 1061 String::Encoding encoding, | |
| 1062 Register string, | |
| 1063 Register index, | |
| 1064 Register value) { | |
| 1065 if (FLAG_debug_code) { | |
| 1066 __ test(index, Immediate(kSmiTagMask)); | |
| 1067 __ Check(zero, "Non-smi index"); | |
| 1068 __ test(value, Immediate(kSmiTagMask)); | |
| 1069 __ Check(zero, "Non-smi value"); | |
| 1070 | |
| 1071 __ cmp(index, FieldOperand(string, String::kLengthOffset)); | |
| 1072 __ Check(less, "Index is too large"); | |
| 1073 | |
| 1074 __ cmp(index, Immediate(Smi::FromInt(0))); | |
| 1075 __ Check(greater_equal, "Index is negative"); | |
| 1076 | |
| 1077 __ push(value); | |
| 1078 __ mov(value, FieldOperand(string, HeapObject::kMapOffset)); | |
| 1079 __ movzx_b(value, FieldOperand(value, Map::kInstanceTypeOffset)); | |
| 1080 | |
| 1081 __ and_(value, Immediate(kStringRepresentationMask | kStringEncodingMask)); | |
| 1082 static const uint32_t one_byte_seq_type = kSeqStringTag | kOneByteStringTag; | |
| 1083 static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; | |
| 1084 __ cmp(value, Immediate(encoding == String::ONE_BYTE_ENCODING | |
| 1085 ? one_byte_seq_type : two_byte_seq_type)); | |
| 1086 __ Check(equal, "Unexpected string type"); | |
| 1087 __ pop(value); | |
| 1088 } | |
| 1089 | |
| 1090 __ SmiUntag(value); | |
| 1091 STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0); | |
| 1092 if (encoding == String::ONE_BYTE_ENCODING) { | |
| 1093 __ SmiUntag(index); | |
| 1094 __ mov_b(FieldOperand(string, index, times_1, SeqString::kHeaderSize), | |
| 1095 value); | |
| 1096 } else { | |
| 1097 // No need to untag a smi for two-byte addressing. | |
| 1098 __ mov_w(FieldOperand(string, index, times_1, SeqString::kHeaderSize), | |
| 1099 value); | |
| 1100 } | |
| 1101 } | |
| 1102 | |
| 1103 | |
| 1104 static Operand ExpConstant(int index) { | 1060 static Operand ExpConstant(int index) { |
| 1105 return Operand::StaticVariable(ExternalReference::math_exp_constants(index)); | 1061 return Operand::StaticVariable(ExternalReference::math_exp_constants(index)); |
| 1106 } | 1062 } |
| 1107 | 1063 |
| 1108 | 1064 |
| 1109 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, | 1065 void MathExpGenerator::EmitMathExp(MacroAssembler* masm, |
| 1110 XMMRegister input, | 1066 XMMRegister input, |
| 1111 XMMRegister result, | 1067 XMMRegister result, |
| 1112 XMMRegister double_scratch, | 1068 XMMRegister double_scratch, |
| 1113 Register temp1, | 1069 Register temp1, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 Code* stub = GetCodeAgeStub(age, parity); | 1172 Code* stub = GetCodeAgeStub(age, parity); |
| 1217 CodePatcher patcher(sequence, young_length); | 1173 CodePatcher patcher(sequence, young_length); |
| 1218 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1174 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 1219 } | 1175 } |
| 1220 } | 1176 } |
| 1221 | 1177 |
| 1222 | 1178 |
| 1223 } } // namespace v8::internal | 1179 } } // namespace v8::internal |
| 1224 | 1180 |
| 1225 #endif // V8_TARGET_ARCH_IA32 | 1181 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |