| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 55 #if defined(USE_SIMULATOR) | 55 #if defined(USE_SIMULATOR) | 
| 56 byte* fast_exp_arm_machine_code = NULL; | 56 byte* fast_exp_arm_machine_code = NULL; | 
| 57 double fast_exp_simulator(double x) { | 57 double fast_exp_simulator(double x) { | 
| 58   return Simulator::current(Isolate::Current())->CallFP( | 58   return Simulator::current(Isolate::Current())->CallFP( | 
| 59       fast_exp_arm_machine_code, x, 0); | 59       fast_exp_arm_machine_code, x, 0); | 
| 60 } | 60 } | 
| 61 #endif | 61 #endif | 
| 62 | 62 | 
| 63 | 63 | 
| 64 UnaryMathFunction CreateExpFunction() { | 64 UnaryMathFunction CreateExpFunction() { | 
| 65   if (!CpuFeatures::IsSupported(VFP2)) return &exp; |  | 
| 66   if (!FLAG_fast_math) return &exp; | 65   if (!FLAG_fast_math) return &exp; | 
| 67   size_t actual_size; | 66   size_t actual_size; | 
| 68   byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 67   byte* buffer = static_cast<byte*>(OS::Allocate(1 * KB, &actual_size, true)); | 
| 69   if (buffer == NULL) return &exp; | 68   if (buffer == NULL) return &exp; | 
| 70   ExternalReference::InitializeMathExpData(); | 69   ExternalReference::InitializeMathExpData(); | 
| 71 | 70 | 
| 72   MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 71   MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size)); | 
| 73 | 72 | 
| 74   { | 73   { | 
| 75     CpuFeatureScope use_vfp(&masm, VFP2); |  | 
| 76     DwVfpRegister input = d0; | 74     DwVfpRegister input = d0; | 
| 77     DwVfpRegister result = d1; | 75     DwVfpRegister result = d1; | 
| 78     DwVfpRegister double_scratch1 = d2; | 76     DwVfpRegister double_scratch1 = d2; | 
| 79     DwVfpRegister double_scratch2 = d3; | 77     DwVfpRegister double_scratch2 = d3; | 
| 80     Register temp1 = r4; | 78     Register temp1 = r4; | 
| 81     Register temp2 = r5; | 79     Register temp2 = r5; | 
| 82     Register temp3 = r6; | 80     Register temp3 = r6; | 
| 83 | 81 | 
| 84     if (masm.use_eabi_hardfloat()) { | 82     if (masm.use_eabi_hardfloat()) { | 
| 85       // Input value is in d0 anyway, nothing to do. | 83       // Input value is in d0 anyway, nothing to do. | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 178     MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 176     MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 
| 179   // ----------- S t a t e ------------- | 177   // ----------- S t a t e ------------- | 
| 180   //  -- r0    : value | 178   //  -- r0    : value | 
| 181   //  -- r1    : key | 179   //  -- r1    : key | 
| 182   //  -- r2    : receiver | 180   //  -- r2    : receiver | 
| 183   //  -- lr    : return address | 181   //  -- lr    : return address | 
| 184   //  -- r3    : target map, scratch for subsequent call | 182   //  -- r3    : target map, scratch for subsequent call | 
| 185   //  -- r4    : scratch (elements) | 183   //  -- r4    : scratch (elements) | 
| 186   // ----------------------------------- | 184   // ----------------------------------- | 
| 187   Label loop, entry, convert_hole, gc_required, only_change_map, done; | 185   Label loop, entry, convert_hole, gc_required, only_change_map, done; | 
| 188   bool vfp2_supported = CpuFeatures::IsSupported(VFP2); |  | 
| 189 | 186 | 
| 190   if (mode == TRACK_ALLOCATION_SITE) { | 187   if (mode == TRACK_ALLOCATION_SITE) { | 
| 191     __ TestJSArrayForAllocationSiteInfo(r2, r4); | 188     __ TestJSArrayForAllocationSiteInfo(r2, r4); | 
| 192     __ b(eq, fail); | 189     __ b(eq, fail); | 
| 193   } | 190   } | 
| 194 | 191 | 
| 195   // Check for empty arrays, which only require a map transition and no changes | 192   // Check for empty arrays, which only require a map transition and no changes | 
| 196   // to the backing store. | 193   // to the backing store. | 
| 197   __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 194   __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 
| 198   __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 195   __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 241   __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 238   __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 
| 242   __ add(r7, r6, Operand(FixedDoubleArray::kHeaderSize)); | 239   __ add(r7, r6, Operand(FixedDoubleArray::kHeaderSize)); | 
| 243   __ add(r6, r7, Operand(r5, LSL, 2)); | 240   __ add(r6, r7, Operand(r5, LSL, 2)); | 
| 244   __ mov(r4, Operand(kHoleNanLower32)); | 241   __ mov(r4, Operand(kHoleNanLower32)); | 
| 245   __ mov(r5, Operand(kHoleNanUpper32)); | 242   __ mov(r5, Operand(kHoleNanUpper32)); | 
| 246   // r3: begin of source FixedArray element fields, not tagged | 243   // r3: begin of source FixedArray element fields, not tagged | 
| 247   // r4: kHoleNanLower32 | 244   // r4: kHoleNanLower32 | 
| 248   // r5: kHoleNanUpper32 | 245   // r5: kHoleNanUpper32 | 
| 249   // r6: end of destination FixedDoubleArray, not tagged | 246   // r6: end of destination FixedDoubleArray, not tagged | 
| 250   // r7: begin of FixedDoubleArray element fields, not tagged | 247   // r7: begin of FixedDoubleArray element fields, not tagged | 
| 251   if (!vfp2_supported) __ Push(r1, r0); |  | 
| 252 | 248 | 
| 253   __ b(&entry); | 249   __ b(&entry); | 
| 254 | 250 | 
| 255   __ bind(&only_change_map); | 251   __ bind(&only_change_map); | 
| 256   __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 252   __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 
| 257   __ RecordWriteField(r2, | 253   __ RecordWriteField(r2, | 
| 258                       HeapObject::kMapOffset, | 254                       HeapObject::kMapOffset, | 
| 259                       r3, | 255                       r3, | 
| 260                       r9, | 256                       r9, | 
| 261                       kLRHasNotBeenSaved, | 257                       kLRHasNotBeenSaved, | 
| 262                       kDontSaveFPRegs, | 258                       kDontSaveFPRegs, | 
| 263                       OMIT_REMEMBERED_SET, | 259                       OMIT_REMEMBERED_SET, | 
| 264                       OMIT_SMI_CHECK); | 260                       OMIT_SMI_CHECK); | 
| 265   __ b(&done); | 261   __ b(&done); | 
| 266 | 262 | 
| 267   // Call into runtime if GC is required. | 263   // Call into runtime if GC is required. | 
| 268   __ bind(&gc_required); | 264   __ bind(&gc_required); | 
| 269   __ pop(lr); | 265   __ pop(lr); | 
| 270   __ b(fail); | 266   __ b(fail); | 
| 271 | 267 | 
| 272   // Convert and copy elements. | 268   // Convert and copy elements. | 
| 273   __ bind(&loop); | 269   __ bind(&loop); | 
| 274   __ ldr(r9, MemOperand(r3, 4, PostIndex)); | 270   __ ldr(r9, MemOperand(r3, 4, PostIndex)); | 
| 275   // r9: current element | 271   // r9: current element | 
| 276   __ UntagAndJumpIfNotSmi(r9, r9, &convert_hole); | 272   __ UntagAndJumpIfNotSmi(r9, r9, &convert_hole); | 
| 277 | 273 | 
| 278   // Normal smi, convert to double and store. | 274   // Normal smi, convert to double and store. | 
| 279   if (vfp2_supported) { | 275   __ vmov(s0, r9); | 
| 280     CpuFeatureScope scope(masm, VFP2); | 276   __ vcvt_f64_s32(d0, s0); | 
| 281     __ vmov(s0, r9); | 277   __ vstr(d0, r7, 0); | 
| 282     __ vcvt_f64_s32(d0, s0); | 278   __ add(r7, r7, Operand(8)); | 
| 283     __ vstr(d0, r7, 0); |  | 
| 284     __ add(r7, r7, Operand(8)); |  | 
| 285   } else { |  | 
| 286     FloatingPointHelper::ConvertIntToDouble(masm, |  | 
| 287                                             r9, |  | 
| 288                                             FloatingPointHelper::kCoreRegisters, |  | 
| 289                                             d0, |  | 
| 290                                             r0, |  | 
| 291                                             r1, |  | 
| 292                                             lr, |  | 
| 293                                             s0); |  | 
| 294     __ Strd(r0, r1, MemOperand(r7, 8, PostIndex)); |  | 
| 295   } |  | 
| 296   __ b(&entry); | 279   __ b(&entry); | 
| 297 | 280 | 
| 298   // Hole found, store the-hole NaN. | 281   // Hole found, store the-hole NaN. | 
| 299   __ bind(&convert_hole); | 282   __ bind(&convert_hole); | 
| 300   if (FLAG_debug_code) { | 283   if (FLAG_debug_code) { | 
| 301     // Restore a "smi-untagged" heap object. | 284     // Restore a "smi-untagged" heap object. | 
| 302     __ SmiTag(r9); | 285     __ SmiTag(r9); | 
| 303     __ orr(r9, r9, Operand(1)); | 286     __ orr(r9, r9, Operand(1)); | 
| 304     __ CompareRoot(r9, Heap::kTheHoleValueRootIndex); | 287     __ CompareRoot(r9, Heap::kTheHoleValueRootIndex); | 
| 305     __ Assert(eq, "object found in smi-only array"); | 288     __ Assert(eq, "object found in smi-only array"); | 
| 306   } | 289   } | 
| 307   __ Strd(r4, r5, MemOperand(r7, 8, PostIndex)); | 290   __ Strd(r4, r5, MemOperand(r7, 8, PostIndex)); | 
| 308 | 291 | 
| 309   __ bind(&entry); | 292   __ bind(&entry); | 
| 310   __ cmp(r7, r6); | 293   __ cmp(r7, r6); | 
| 311   __ b(lt, &loop); | 294   __ b(lt, &loop); | 
| 312 | 295 | 
| 313   if (!vfp2_supported) __ Pop(r1, r0); |  | 
| 314   __ pop(lr); | 296   __ pop(lr); | 
| 315   __ bind(&done); | 297   __ bind(&done); | 
| 316 } | 298 } | 
| 317 | 299 | 
| 318 | 300 | 
| 319 void ElementsTransitionGenerator::GenerateDoubleToObject( | 301 void ElementsTransitionGenerator::GenerateDoubleToObject( | 
| 320     MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 302     MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 
| 321   // ----------- S t a t e ------------- | 303   // ----------- S t a t e ------------- | 
| 322   //  -- r0    : value | 304   //  -- r0    : value | 
| 323   //  -- r1    : key | 305   //  -- r1    : key | 
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 699     patcher.masm()->add(r0, pc, Operand(-8)); | 681     patcher.masm()->add(r0, pc, Operand(-8)); | 
| 700     patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 682     patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 
| 701     patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 683     patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 
| 702   } | 684   } | 
| 703 } | 685 } | 
| 704 | 686 | 
| 705 | 687 | 
| 706 } }  // namespace v8::internal | 688 } }  // namespace v8::internal | 
| 707 | 689 | 
| 708 #endif  // V8_TARGET_ARCH_ARM | 690 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|