OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 4136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4148 __ mov(ip, Operand(Handle<Object>(cell))); | 4148 __ mov(ip, Operand(Handle<Object>(cell))); |
4149 __ ldr(ip, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset)); | 4149 __ ldr(ip, FieldMemOperand(ip, JSGlobalPropertyCell::kValueOffset)); |
4150 __ cmp(reg, ip); | 4150 __ cmp(reg, ip); |
4151 } else { | 4151 } else { |
4152 __ cmp(reg, Operand(target)); | 4152 __ cmp(reg, Operand(target)); |
4153 } | 4153 } |
4154 DeoptimizeIf(ne, instr->environment()); | 4154 DeoptimizeIf(ne, instr->environment()); |
4155 } | 4155 } |
4156 | 4156 |
4157 | 4157 |
| 4158 |
| 4159 |
| 4160 void LCodeGen::DoCheckMapCommon(Register reg, |
| 4161 Register scratch, |
| 4162 Handle<Map> map, |
| 4163 MapCheckMode mode, |
| 4164 LEnvironment* env) { |
| 4165 Label success; |
| 4166 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 4167 __ mov(ip, Operand(map)); |
| 4168 __ cmp(scratch, ip); |
| 4169 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { |
| 4170 bool ignore; |
| 4171 Map* transitioned_double_map = |
| 4172 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, &ignore); |
| 4173 ASSERT(transitioned_double_map == NULL || |
| 4174 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS); |
| 4175 Map* transitioned_fast_element_map = |
| 4176 map->LookupElementsTransitionMap(FAST_ELEMENTS, &ignore); |
| 4177 ASSERT(transitioned_fast_element_map == NULL || |
| 4178 map->elements_kind() != FAST_ELEMENTS); |
| 4179 if (transitioned_fast_element_map != NULL) { |
| 4180 __ b(eq, &success); |
| 4181 __ cmp(scratch, Operand(Handle<Map>(transitioned_fast_element_map))); |
| 4182 } |
| 4183 |
| 4184 if (transitioned_double_map != NULL) { |
| 4185 __ b(eq, &success); |
| 4186 __ cmp(scratch, Operand(Handle<Map>(transitioned_double_map))); |
| 4187 } |
| 4188 } |
| 4189 DeoptimizeIf(ne, env); |
| 4190 __ bind(&success); |
| 4191 } |
| 4192 |
| 4193 |
4158 void LCodeGen::DoCheckMap(LCheckMap* instr) { | 4194 void LCodeGen::DoCheckMap(LCheckMap* instr) { |
4159 Register scratch = scratch0(); | 4195 Register scratch = scratch0(); |
4160 LOperand* input = instr->InputAt(0); | 4196 LOperand* input = instr->InputAt(0); |
4161 ASSERT(input->IsRegister()); | 4197 ASSERT(input->IsRegister()); |
4162 Register reg = ToRegister(input); | 4198 Register reg = ToRegister(input); |
4163 __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 4199 Handle<Map> map = Handle<Map>(instr->hydrogen()->map()); |
4164 __ cmp(scratch, Operand(instr->hydrogen()->map())); | 4200 DoCheckMapCommon(reg, scratch, map, instr->hydrogen()->mode(), |
4165 DeoptimizeIf(ne, instr->environment()); | 4201 instr->environment()); |
4166 } | 4202 } |
4167 | 4203 |
4168 | 4204 |
4169 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { | 4205 void LCodeGen::DoClampDToUint8(LClampDToUint8* instr) { |
4170 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); | 4206 DoubleRegister value_reg = ToDoubleRegister(instr->unclamped()); |
4171 Register result_reg = ToRegister(instr->result()); | 4207 Register result_reg = ToRegister(instr->result()); |
4172 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); | 4208 DoubleRegister temp_reg = ToDoubleRegister(instr->TempAt(0)); |
4173 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); | 4209 __ ClampDoubleToUint8(result_reg, value_reg, temp_reg); |
4174 } | 4210 } |
4175 | 4211 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4224 Register temp2 = ToRegister(instr->TempAt(1)); | 4260 Register temp2 = ToRegister(instr->TempAt(1)); |
4225 | 4261 |
4226 Handle<JSObject> holder = instr->holder(); | 4262 Handle<JSObject> holder = instr->holder(); |
4227 Handle<JSObject> current_prototype = instr->prototype(); | 4263 Handle<JSObject> current_prototype = instr->prototype(); |
4228 | 4264 |
4229 // Load prototype object. | 4265 // Load prototype object. |
4230 __ LoadHeapObject(temp1, current_prototype); | 4266 __ LoadHeapObject(temp1, current_prototype); |
4231 | 4267 |
4232 // Check prototype maps up to the holder. | 4268 // Check prototype maps up to the holder. |
4233 while (!current_prototype.is_identical_to(holder)) { | 4269 while (!current_prototype.is_identical_to(holder)) { |
4234 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); | 4270 DoCheckMapCommon(temp1, temp2, |
4235 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); | 4271 Handle<Map>(current_prototype->map()), |
4236 DeoptimizeIf(ne, instr->environment()); | 4272 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
4237 current_prototype = | 4273 current_prototype = |
4238 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); | 4274 Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
4239 // Load next prototype object. | 4275 // Load next prototype object. |
4240 __ LoadHeapObject(temp1, current_prototype); | 4276 __ LoadHeapObject(temp1, current_prototype); |
4241 } | 4277 } |
4242 | 4278 |
4243 // Check the holder map. | 4279 // Check the holder map. |
4244 __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); | 4280 DoCheckMapCommon(temp1, temp2, |
4245 __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); | 4281 Handle<Map>(current_prototype->map()), |
| 4282 ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
4246 DeoptimizeIf(ne, instr->environment()); | 4283 DeoptimizeIf(ne, instr->environment()); |
4247 } | 4284 } |
4248 | 4285 |
4249 | 4286 |
4250 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 4287 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
4251 Heap* heap = isolate()->heap(); | 4288 Heap* heap = isolate()->heap(); |
4252 ElementsKind boilerplate_elements_kind = | 4289 ElementsKind boilerplate_elements_kind = |
4253 instr->hydrogen()->boilerplate_elements_kind(); | 4290 instr->hydrogen()->boilerplate_elements_kind(); |
4254 | 4291 |
4255 // Deopt if the array literal boilerplate ElementsKind is of a type different | 4292 // Deopt if the array literal boilerplate ElementsKind is of a type different |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4732 ASSERT(osr_pc_offset_ == -1); | 4769 ASSERT(osr_pc_offset_ == -1); |
4733 osr_pc_offset_ = masm()->pc_offset(); | 4770 osr_pc_offset_ = masm()->pc_offset(); |
4734 } | 4771 } |
4735 | 4772 |
4736 | 4773 |
4737 | 4774 |
4738 | 4775 |
4739 #undef __ | 4776 #undef __ |
4740 | 4777 |
4741 } } // namespace v8::internal | 4778 } } // namespace v8::internal |
OLD | NEW |