Chromium Code Reviews| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 | 294 |
| 295 void ElementsTransitionGenerator::GenerateSmiOnlyToDouble( | 295 void ElementsTransitionGenerator::GenerateSmiOnlyToDouble( |
| 296 MacroAssembler* masm, Label* fail) { | 296 MacroAssembler* masm, Label* fail) { |
| 297 // ----------- S t a t e ------------- | 297 // ----------- S t a t e ------------- |
| 298 // -- eax : value | 298 // -- eax : value |
| 299 // -- ebx : target map | 299 // -- ebx : target map |
| 300 // -- ecx : key | 300 // -- ecx : key |
| 301 // -- edx : receiver | 301 // -- edx : receiver |
| 302 // -- esp[0] : return address | 302 // -- esp[0] : return address |
| 303 // ----------------------------------- | 303 // ----------------------------------- |
| 304 Label loop, entry, convert_hole, gc_required; | 304 Label loop, entry, convert_hole, gc_required, only_change_map; |
| 305 | |
| 306 // Check for empty arrays, which only require a map transition and no changes | |
| 307 // to the backing store. | |
| 308 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | |
| 309 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | |
| 310 __ j(equal, &only_change_map); | |
| 311 | |
| 305 __ push(eax); | 312 __ push(eax); |
| 306 __ push(ebx); | 313 __ push(ebx); |
| 307 | 314 |
| 308 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | |
| 309 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); | 315 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); |
| 310 | 316 |
| 311 // Allocate new FixedDoubleArray. | 317 // Allocate new FixedDoubleArray. |
| 312 // edx: receiver | 318 // edx: receiver |
| 313 // edi: length of source FixedArray (smi-tagged) | 319 // edi: length of source FixedArray (smi-tagged) |
| 314 __ lea(esi, Operand(edi, times_4, FixedDoubleArray::kHeaderSize)); | 320 __ lea(esi, Operand(edi, times_4, FixedDoubleArray::kHeaderSize)); |
| 315 __ AllocateInNewSpace(esi, eax, ebx, no_reg, &gc_required, TAG_OBJECT); | 321 __ AllocateInNewSpace(esi, eax, ebx, no_reg, &gc_required, TAG_OBJECT); |
| 316 | 322 |
| 317 // eax: destination FixedDoubleArray | 323 // eax: destination FixedDoubleArray |
| 318 // edi: number of elements | 324 // edi: number of elements |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); | 398 __ fld_d(Operand::StaticVariable(canonical_the_hole_nan_reference)); |
| 393 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); | 399 __ fstp_d(FieldOperand(eax, edi, times_4, FixedDoubleArray::kHeaderSize)); |
| 394 } | 400 } |
| 395 | 401 |
| 396 __ bind(&entry); | 402 __ bind(&entry); |
| 397 __ sub(edi, Immediate(Smi::FromInt(1))); | 403 __ sub(edi, Immediate(Smi::FromInt(1))); |
| 398 __ j(not_sign, &loop); | 404 __ j(not_sign, &loop); |
| 399 | 405 |
| 400 __ pop(ebx); | 406 __ pop(ebx); |
| 401 __ pop(eax); | 407 __ pop(eax); |
| 408 | |
| 409 // Restore esi. | |
| 410 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 411 | |
| 412 __ bind(&only_change_map); | |
| 402 // eax: value | 413 // eax: value |
| 403 // ebx: target map | 414 // ebx: target map |
| 404 // Set transitioned map. | 415 // Set transitioned map. |
| 405 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 416 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); |
| 406 __ RecordWriteField(edx, | 417 __ RecordWriteField(edx, |
| 407 HeapObject::kMapOffset, | 418 HeapObject::kMapOffset, |
| 408 ebx, | 419 ebx, |
| 409 edi, | 420 edi, |
| 410 kDontSaveFPRegs, | 421 kDontSaveFPRegs, |
| 411 EMIT_REMEMBERED_SET, | 422 EMIT_REMEMBERED_SET, |
|
Vyacheslav Egorov (Chromium)
2012/02/09 16:29:19
map can not be in new space.
We only need an inc
danno
2012/02/10 12:25:34
Done.
| |
| 412 OMIT_SMI_CHECK); | 423 OMIT_SMI_CHECK); |
| 413 // Restore esi. | |
| 414 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 415 } | 424 } |
| 416 | 425 |
| 417 | 426 |
| 418 void ElementsTransitionGenerator::GenerateDoubleToObject( | 427 void ElementsTransitionGenerator::GenerateDoubleToObject( |
| 419 MacroAssembler* masm, Label* fail) { | 428 MacroAssembler* masm, Label* fail) { |
| 420 // ----------- S t a t e ------------- | 429 // ----------- S t a t e ------------- |
| 421 // -- eax : value | 430 // -- eax : value |
| 422 // -- ebx : target map | 431 // -- ebx : target map |
| 423 // -- ecx : key | 432 // -- ecx : key |
| 424 // -- edx : receiver | 433 // -- edx : receiver |
| 425 // -- esp[0] : return address | 434 // -- esp[0] : return address |
| 426 // ----------------------------------- | 435 // ----------------------------------- |
| 427 Label loop, entry, convert_hole, gc_required; | 436 Label loop, entry, convert_hole, gc_required, only_change_map, success; |
| 437 | |
| 438 // Check for empty arrays, which only require a map transition and no changes | |
| 439 // to the backing store. | |
| 440 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | |
| 441 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | |
| 442 __ j(equal, &only_change_map); | |
| 443 | |
| 428 __ push(eax); | 444 __ push(eax); |
| 429 __ push(edx); | 445 __ push(edx); |
| 430 __ push(ebx); | 446 __ push(ebx); |
| 431 | 447 |
| 432 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | |
| 433 __ mov(ebx, FieldOperand(edi, FixedDoubleArray::kLengthOffset)); | 448 __ mov(ebx, FieldOperand(edi, FixedDoubleArray::kLengthOffset)); |
| 434 | 449 |
| 435 // Allocate new FixedArray. | 450 // Allocate new FixedArray. |
| 436 // ebx: length of source FixedDoubleArray (smi-tagged) | 451 // ebx: length of source FixedDoubleArray (smi-tagged) |
| 437 __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); | 452 __ lea(edi, Operand(ebx, times_2, FixedArray::kHeaderSize)); |
| 438 __ AllocateInNewSpace(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); | 453 __ AllocateInNewSpace(edi, eax, esi, no_reg, &gc_required, TAG_OBJECT); |
| 439 | 454 |
| 440 // eax: destination FixedArray | 455 // eax: destination FixedArray |
| 441 // ebx: number of elements | 456 // ebx: number of elements |
| 442 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | 457 __ mov(FieldOperand(eax, HeapObject::kMapOffset), |
| 443 Immediate(masm->isolate()->factory()->fixed_array_map())); | 458 Immediate(masm->isolate()->factory()->fixed_array_map())); |
| 444 __ mov(FieldOperand(eax, FixedArray::kLengthOffset), ebx); | 459 __ mov(FieldOperand(eax, FixedArray::kLengthOffset), ebx); |
| 445 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 460 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 446 | 461 |
| 447 __ jmp(&entry); | 462 __ jmp(&entry); |
| 448 | 463 |
| 464 // ebx: target map | |
| 465 // edx: receiver | |
| 466 // Set transitioned map. | |
| 467 __ bind(&only_change_map); | |
| 468 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | |
| 469 __ RecordWriteField(edx, | |
| 470 HeapObject::kMapOffset, | |
| 471 ebx, | |
| 472 edi, | |
| 473 kDontSaveFPRegs, | |
| 474 EMIT_REMEMBERED_SET, | |
|
Vyacheslav Egorov (Chromium)
2012/02/09 16:29:19
ditto
danno
2012/02/10 12:25:34
Done.
| |
| 475 OMIT_SMI_CHECK); | |
| 476 __ jmp(&success); | |
| 477 | |
| 449 // Call into runtime if GC is required. | 478 // Call into runtime if GC is required. |
| 450 __ bind(&gc_required); | 479 __ bind(&gc_required); |
| 451 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 480 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 452 __ pop(ebx); | 481 __ pop(ebx); |
| 453 __ pop(edx); | 482 __ pop(edx); |
| 454 __ pop(eax); | 483 __ pop(eax); |
| 455 __ jmp(fail); | 484 __ jmp(fail); |
| 456 | 485 |
| 457 // Box doubles into heap numbers. | 486 // Box doubles into heap numbers. |
| 458 // edi: source FixedDoubleArray | 487 // edi: source FixedDoubleArray |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 JSObject::kElementsOffset, | 544 JSObject::kElementsOffset, |
| 516 eax, | 545 eax, |
| 517 edi, | 546 edi, |
| 518 kDontSaveFPRegs, | 547 kDontSaveFPRegs, |
| 519 EMIT_REMEMBERED_SET, | 548 EMIT_REMEMBERED_SET, |
| 520 OMIT_SMI_CHECK); | 549 OMIT_SMI_CHECK); |
| 521 | 550 |
| 522 // Restore registers. | 551 // Restore registers. |
| 523 __ pop(eax); | 552 __ pop(eax); |
| 524 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 553 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 554 | |
| 555 __ bind(&success); | |
| 525 } | 556 } |
| 526 | 557 |
| 527 | 558 |
| 528 void StringCharLoadGenerator::Generate(MacroAssembler* masm, | 559 void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
| 529 Factory* factory, | 560 Factory* factory, |
| 530 Register string, | 561 Register string, |
| 531 Register index, | 562 Register index, |
| 532 Register result, | 563 Register result, |
| 533 Label* call_runtime) { | 564 Label* call_runtime) { |
| 534 // Fetch the instance type of the receiver into result register. | 565 // Fetch the instance type of the receiver into result register. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 times_1, | 657 times_1, |
| 627 SeqAsciiString::kHeaderSize)); | 658 SeqAsciiString::kHeaderSize)); |
| 628 __ bind(&done); | 659 __ bind(&done); |
| 629 } | 660 } |
| 630 | 661 |
| 631 #undef __ | 662 #undef __ |
| 632 | 663 |
| 633 } } // namespace v8::internal | 664 } } // namespace v8::internal |
| 634 | 665 |
| 635 #endif // V8_TARGET_ARCH_IA32 | 666 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |