| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 22 matching lines...) Expand all Loading... |
| 33 #include "macro-assembler.h" | 33 #include "macro-assembler.h" |
| 34 #include "simulator-a64.h" | 34 #include "simulator-a64.h" |
| 35 | 35 |
| 36 namespace v8 { | 36 namespace v8 { |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 #define __ ACCESS_MASM(masm) | 39 #define __ ACCESS_MASM(masm) |
| 40 | 40 |
| 41 UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) { | 41 UnaryMathFunction CreateTranscendentalFunction(TranscendentalCache::Type type) { |
| 42 switch (type) { | 42 switch (type) { |
| 43 case TranscendentalCache::SIN: return &sin; | |
| 44 case TranscendentalCache::COS: return &cos; | |
| 45 case TranscendentalCache::TAN: return &tan; | |
| 46 case TranscendentalCache::LOG: return &log; | 43 case TranscendentalCache::LOG: return &log; |
| 47 default: UNIMPLEMENTED(); | 44 default: UNIMPLEMENTED(); |
| 48 } | 45 } |
| 49 return NULL; | 46 return NULL; |
| 50 } | 47 } |
| 51 | 48 |
| 52 | 49 |
| 53 #if defined(USE_SIMULATOR) | 50 #if defined(USE_SIMULATOR) |
| 54 byte* fast_exp_a64_machine_code = NULL; | 51 byte* fast_exp_a64_machine_code = NULL; |
| 55 double fast_exp_simulator(double x) { | 52 double fast_exp_simulator(double x) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // Set the destination FixedDoubleArray's length and map. | 200 // Set the destination FixedDoubleArray's length and map. |
| 204 Register map_root = x6; | 201 Register map_root = x6; |
| 205 __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); | 202 __ LoadRoot(map_root, Heap::kFixedDoubleArrayMapRootIndex); |
| 206 __ SmiTag(x11, length); | 203 __ SmiTag(x11, length); |
| 207 __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); | 204 __ Str(x11, MemOperand(array, FixedDoubleArray::kLengthOffset)); |
| 208 __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); | 205 __ Str(map_root, MemOperand(array, HeapObject::kMapOffset)); |
| 209 | 206 |
| 210 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 207 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 211 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x6, | 208 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x6, |
| 212 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 209 kLRHasBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
| 213 OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 210 OMIT_SMI_CHECK); |
| 214 | 211 |
| 215 // Replace receiver's backing store with newly created FixedDoubleArray. | 212 // Replace receiver's backing store with newly created FixedDoubleArray. |
| 216 __ Add(x10, array, kHeapObjectTag); | 213 __ Add(x10, array, kHeapObjectTag); |
| 217 __ Str(x10, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 214 __ Str(x10, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 218 __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, | 215 __ RecordWriteField(receiver, JSObject::kElementsOffset, x10, |
| 219 x6, kLRHasBeenSaved, kDontSaveFPRegs, | 216 x6, kLRHasBeenSaved, kDontSaveFPRegs, |
| 220 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 217 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 221 | 218 |
| 222 // Prepare for conversion loop. | 219 // Prepare for conversion loop. |
| 223 Register src_elements = x10; | 220 Register src_elements = x10; |
| 224 Register dst_elements = x11; | 221 Register dst_elements = x11; |
| 225 Register dst_end = x12; | 222 Register dst_end = x12; |
| 226 __ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); | 223 __ Add(src_elements, elements, FixedArray::kHeaderSize - kHeapObjectTag); |
| 227 __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize); | 224 __ Add(dst_elements, array, FixedDoubleArray::kHeaderSize); |
| 228 __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2)); | 225 __ Add(dst_end, dst_elements, Operand(length, LSL, kDoubleSizeLog2)); |
| 229 | 226 |
| 230 FPRegister nan_d = d1; | 227 FPRegister nan_d = d1; |
| 231 __ Fmov(nan_d, rawbits_to_double(kHoleNanInt64)); | 228 __ Fmov(nan_d, rawbits_to_double(kHoleNanInt64)); |
| 232 | 229 |
| 233 Label entry, done; | 230 Label entry, done; |
| 234 __ B(&entry); | 231 __ B(&entry); |
| 235 | 232 |
| 236 __ Bind(&only_change_map); | 233 __ Bind(&only_change_map); |
| 237 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 234 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 238 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x6, | 235 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x6, |
| 239 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 236 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
| 240 OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 237 OMIT_SMI_CHECK); |
| 241 __ B(&done); | 238 __ B(&done); |
| 242 | 239 |
| 243 // Call into runtime if GC is required. | 240 // Call into runtime if GC is required. |
| 244 __ Bind(&gc_required); | 241 __ Bind(&gc_required); |
| 245 __ Pop(lr); | 242 __ Pop(lr); |
| 246 __ B(fail); | 243 __ B(fail); |
| 247 | 244 |
| 248 // Iterate over the array, copying and coverting smis to doubles. If an | 245 // Iterate over the array, copying and coverting smis to doubles. If an |
| 249 // element is non-smi, write a hole to the destination. | 246 // element is non-smi, write a hole to the destination. |
| 250 { | 247 { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 __ Cmp(x13, kHoleNanInt64); | 344 __ Cmp(x13, kHoleNanInt64); |
| 348 __ B(eq, &convert_hole); | 345 __ B(eq, &convert_hole); |
| 349 | 346 |
| 350 // Non-hole double, copy value into a heap number. | 347 // Non-hole double, copy value into a heap number. |
| 351 Register heap_num = x5; | 348 Register heap_num = x5; |
| 352 __ AllocateHeapNumber(heap_num, &gc_required, x6, x4, heap_num_map); | 349 __ AllocateHeapNumber(heap_num, &gc_required, x6, x4, heap_num_map); |
| 353 __ Str(x13, FieldMemOperand(heap_num, HeapNumber::kValueOffset)); | 350 __ Str(x13, FieldMemOperand(heap_num, HeapNumber::kValueOffset)); |
| 354 __ Mov(x13, dst_elements); | 351 __ Mov(x13, dst_elements); |
| 355 __ Str(heap_num, MemOperand(dst_elements, kPointerSize, PostIndex)); | 352 __ Str(heap_num, MemOperand(dst_elements, kPointerSize, PostIndex)); |
| 356 __ RecordWrite(array, x13, heap_num, kLRHasBeenSaved, kDontSaveFPRegs, | 353 __ RecordWrite(array, x13, heap_num, kLRHasBeenSaved, kDontSaveFPRegs, |
| 357 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 354 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 358 | 355 |
| 359 __ B(&entry); | 356 __ B(&entry); |
| 360 | 357 |
| 361 // Replace the-hole NaN with the-hole pointer. | 358 // Replace the-hole NaN with the-hole pointer. |
| 362 __ Bind(&convert_hole); | 359 __ Bind(&convert_hole); |
| 363 __ Str(the_hole, MemOperand(dst_elements, kPointerSize, PostIndex)); | 360 __ Str(the_hole, MemOperand(dst_elements, kPointerSize, PostIndex)); |
| 364 | 361 |
| 365 __ Bind(&entry); | 362 __ Bind(&entry); |
| 366 __ Cmp(dst_elements, dst_end); | 363 __ Cmp(dst_elements, dst_end); |
| 367 __ B(lt, &loop); | 364 __ B(lt, &loop); |
| 368 } | 365 } |
| 369 | 366 |
| 370 __ Pop(value, key, receiver, target_map); | 367 __ Pop(value, key, receiver, target_map); |
| 371 // Replace receiver's backing store with newly created and filled FixedArray. | 368 // Replace receiver's backing store with newly created and filled FixedArray. |
| 372 __ Str(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 369 __ Str(array, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 373 __ RecordWriteField(receiver, JSObject::kElementsOffset, array, x13, | 370 __ RecordWriteField(receiver, JSObject::kElementsOffset, array, x13, |
| 374 kLRHasBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 371 kLRHasBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 375 OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 372 OMIT_SMI_CHECK); |
| 376 __ Pop(lr); | 373 __ Pop(lr); |
| 377 | 374 |
| 378 __ Bind(&only_change_map); | 375 __ Bind(&only_change_map); |
| 379 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); | 376 __ Str(target_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
| 380 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x13, | 377 __ RecordWriteField(receiver, HeapObject::kMapOffset, target_map, x13, |
| 381 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, | 378 kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET, |
| 382 OMIT_SMI_CHECK, EXPECT_PREGENERATED); | 379 OMIT_SMI_CHECK); |
| 383 } | 380 } |
| 384 | 381 |
| 385 | 382 |
| 386 bool Code::IsYoungSequence(byte* sequence) { | 383 bool Code::IsYoungSequence(byte* sequence) { |
| 387 return MacroAssembler::IsYoungSequence(sequence); | 384 return MacroAssembler::IsYoungSequence(sequence); |
| 388 } | 385 } |
| 389 | 386 |
| 390 | 387 |
| 391 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 388 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
| 392 MarkingParity* parity) { | 389 MarkingParity* parity) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 __ Fmul(result, double_temp3, double_temp1); | 614 __ Fmul(result, double_temp3, double_temp1); |
| 618 | 615 |
| 619 __ Bind(&done); | 616 __ Bind(&done); |
| 620 } | 617 } |
| 621 | 618 |
| 622 #undef __ | 619 #undef __ |
| 623 | 620 |
| 624 } } // namespace v8::internal | 621 } } // namespace v8::internal |
| 625 | 622 |
| 626 #endif // V8_TARGET_ARCH_A64 | 623 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |