OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 kDontSaveFPRegs, | 236 kDontSaveFPRegs, |
237 EMIT_REMEMBERED_SET, | 237 EMIT_REMEMBERED_SET, |
238 OMIT_SMI_CHECK); | 238 OMIT_SMI_CHECK); |
239 // Set backing store's length. | 239 // Set backing store's length. |
240 __ Integer32ToSmi(r11, r9); | 240 __ Integer32ToSmi(r11, r9); |
241 __ movq(FieldOperand(r14, FixedDoubleArray::kLengthOffset), r11); | 241 __ movq(FieldOperand(r14, FixedDoubleArray::kLengthOffset), r11); |
242 __ jmp(&allocated); | 242 __ jmp(&allocated); |
243 | 243 |
244 // Conversion loop. | 244 // Conversion loop. |
245 __ bind(&loop); | 245 __ bind(&loop); |
246 __ decq(r9); | |
247 __ movq(rbx, | 246 __ movq(rbx, |
248 FieldOperand(r8, r9, times_8, FixedArray::kHeaderSize)); | 247 FieldOperand(r8, r9, times_8, FixedArray::kHeaderSize)); |
249 // r9 : current element's index | 248 // r9 : current element's index |
250 // rbx: current element (smi-tagged) | 249 // rbx: current element (smi-tagged) |
251 __ JumpIfNotSmi(rbx, &convert_hole); | 250 __ JumpIfNotSmi(rbx, &convert_hole); |
252 __ SmiToInteger32(rbx, rbx); | 251 __ SmiToInteger32(rbx, rbx); |
253 __ cvtlsi2sd(xmm0, rbx); | 252 __ cvtlsi2sd(xmm0, rbx); |
254 __ movsd(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), | 253 __ movsd(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), |
255 xmm0); | 254 xmm0); |
256 __ jmp(&entry); | 255 __ jmp(&entry); |
257 __ bind(&convert_hole); | 256 __ bind(&convert_hole); |
258 __ movq(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), r15); | 257 __ movq(FieldOperand(r14, r9, times_8, FixedDoubleArray::kHeaderSize), r15); |
259 __ bind(&entry); | 258 __ bind(&entry); |
260 __ testq(r9, r9); | 259 __ decq(r9); |
261 __ j(not_zero, &loop); | 260 __ j(not_sign, &loop); |
262 } | 261 } |
263 | 262 |
264 | 263 |
265 void ElementsTransitionGenerator::GenerateDoubleToObject( | 264 void ElementsTransitionGenerator::GenerateDoubleToObject( |
266 MacroAssembler* masm, Label* fail) { | 265 MacroAssembler* masm, Label* fail) { |
267 // ----------- S t a t e ------------- | 266 // ----------- S t a t e ------------- |
268 // -- rax : value | 267 // -- rax : value |
269 // -- rbx : target map | 268 // -- rbx : target map |
270 // -- rcx : key | 269 // -- rcx : key |
271 // -- rdx : receiver | 270 // -- rdx : receiver |
(...skipping 22 matching lines...) Expand all Loading... |
294 __ jmp(&entry); | 293 __ jmp(&entry); |
295 | 294 |
296 // Call into runtime if GC is required. | 295 // Call into runtime if GC is required. |
297 __ bind(&gc_required); | 296 __ bind(&gc_required); |
298 __ pop(rax); | 297 __ pop(rax); |
299 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 298 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
300 __ jmp(fail); | 299 __ jmp(fail); |
301 | 300 |
302 // Box doubles into heap numbers. | 301 // Box doubles into heap numbers. |
303 __ bind(&loop); | 302 __ bind(&loop); |
304 __ decq(r9); | |
305 __ movq(r14, FieldOperand(r8, | 303 __ movq(r14, FieldOperand(r8, |
306 r9, | 304 r9, |
307 times_pointer_size, | 305 times_pointer_size, |
308 FixedDoubleArray::kHeaderSize)); | 306 FixedDoubleArray::kHeaderSize)); |
309 // r9 : current element's index | 307 // r9 : current element's index |
310 // r14: current element | 308 // r14: current element |
311 __ cmpq(r14, rsi); | 309 __ cmpq(r14, rsi); |
312 __ j(equal, &convert_hole); | 310 __ j(equal, &convert_hole); |
313 | 311 |
314 // Non-hole double, copy value into a heap number. | 312 // Non-hole double, copy value into a heap number. |
(...skipping 16 matching lines...) Expand all Loading... |
331 | 329 |
332 // Replace the-hole NaN with the-hole pointer. | 330 // Replace the-hole NaN with the-hole pointer. |
333 __ bind(&convert_hole); | 331 __ bind(&convert_hole); |
334 __ movq(FieldOperand(r11, | 332 __ movq(FieldOperand(r11, |
335 r9, | 333 r9, |
336 times_pointer_size, | 334 times_pointer_size, |
337 FixedArray::kHeaderSize), | 335 FixedArray::kHeaderSize), |
338 rdi); | 336 rdi); |
339 | 337 |
340 __ bind(&entry); | 338 __ bind(&entry); |
341 __ testq(r9, r9); | 339 __ decq(r9); |
342 __ j(not_zero, &loop); | 340 __ j(not_sign, &loop); |
343 | 341 |
344 // Set transitioned map. | 342 // Set transitioned map. |
345 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), rbx); | 343 __ movq(FieldOperand(rdx, HeapObject::kMapOffset), rbx); |
346 __ RecordWriteField(rdx, | 344 __ RecordWriteField(rdx, |
347 HeapObject::kMapOffset, | 345 HeapObject::kMapOffset, |
348 rbx, | 346 rbx, |
349 rdi, | 347 rdi, |
350 kDontSaveFPRegs, | 348 kDontSaveFPRegs, |
351 EMIT_REMEMBERED_SET, | 349 EMIT_REMEMBERED_SET, |
352 OMIT_SMI_CHECK); | 350 OMIT_SMI_CHECK); |
353 // Replace receiver's backing store with newly created and filled FixedArray. | 351 // Replace receiver's backing store with newly created and filled FixedArray. |
354 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), r11); | 352 __ movq(FieldOperand(rdx, JSObject::kElementsOffset), r11); |
355 __ RecordWriteField(rdx, | 353 __ RecordWriteField(rdx, |
356 JSObject::kElementsOffset, | 354 JSObject::kElementsOffset, |
357 r11, | 355 r11, |
358 r15, | 356 r15, |
359 kDontSaveFPRegs, | 357 kDontSaveFPRegs, |
360 EMIT_REMEMBERED_SET, | 358 EMIT_REMEMBERED_SET, |
361 OMIT_SMI_CHECK); | 359 OMIT_SMI_CHECK); |
362 __ pop(rax); | 360 __ pop(rax); |
363 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 361 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
364 } | 362 } |
365 | 363 |
366 #undef __ | 364 #undef __ |
367 | 365 |
368 } } // namespace v8::internal | 366 } } // namespace v8::internal |
369 | 367 |
370 #endif // V8_TARGET_ARCH_X64 | 368 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |