Chromium Code Reviews| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); | 381 return FUNCTION_CAST<OS::MemCopyFunction>(buffer); |
| 382 } | 382 } |
| 383 | 383 |
| 384 #undef __ | 384 #undef __ |
| 385 | 385 |
| 386 // ------------------------------------------------------------------------- | 386 // ------------------------------------------------------------------------- |
| 387 // Code generators | 387 // Code generators |
| 388 | 388 |
| 389 #define __ ACCESS_MASM(masm) | 389 #define __ ACCESS_MASM(masm) |
| 390 | 390 |
| 391 | |
| 392 static void PerformAllocationSiteInfoCheck(MacroAssembler* masm, | |
| 393 Label* defer_to_runtime, | |
| 394 Label* no_info_available) { | |
|
danno
2012/12/26 10:32:01
This might be better as a method directly on Macro
mvstanton
2013/01/03 14:40:43
Done.
| |
| 395 // ----------- S t a t e ------------- | |
| 396 // -- eax : value | |
| 397 // -- ebx : target map | |
| 398 // -- ecx : key | |
| 399 // -- edx : receiver | |
|
danno
2012/12/26 10:32:01
This comment isn't correct any more, I think.
mvstanton
2013/01/03 14:40:43
I changed it to just talk about edx and edi, the o
| |
| 400 // -- esp[0] : return address | |
| 401 // | |
| 402 // edi is clobbered. | |
| 403 // ----------------------------------- | |
| 404 masm->JumpIfNotInNewSpace(edx, edi, no_info_available, Label::kNear); | |
| 405 | |
| 406 // Make sure we aren't just at the top of new space. | |
| 407 ExternalReference new_space_allocation_top = | |
| 408 ExternalReference::new_space_allocation_top_address(masm->isolate()); | |
| 409 __ lea(edi, Operand(edx, JSArray::kSize + AllocationSiteInfo::kSize)); | |
| 410 | |
| 411 __ cmp(edi, Operand::StaticVariable(new_space_allocation_top)); | |
| 412 __ j(greater_equal, no_info_available); | |
| 413 | |
| 414 __ mov(edi, FieldOperand(edi, AllocationSiteInfo::kMapOffset - | |
| 415 AllocationSiteInfo::kSize)); | |
| 416 __ cmp(edi, Immediate(Handle<Map>(masm->isolate()->heap()-> | |
|
danno
2012/12/26 10:32:01
This entire check might be useful as a method dire
mvstanton
2013/01/03 14:40:43
Added issue http://code.google.com/p/v8/issues/det
| |
| 417 allocation_site_info_map()))); | |
| 418 | |
| 419 // Use the j/jmp sequence below for debugging, but the j(equal) sequence | |
| 420 // for production. | |
| 421 // __ j(not_equal, no_info_available); | |
| 422 // __ int3(); | |
| 423 // __ jmp(defer_to_runtime); | |
| 424 // or | |
| 425 __ j(equal, defer_to_runtime); | |
| 426 } | |
| 427 | |
| 428 | |
| 391 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( | 429 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
| 392 MacroAssembler* masm) { | 430 MacroAssembler* masm) { |
| 393 // ----------- S t a t e ------------- | 431 // ----------- S t a t e ------------- |
| 394 // -- eax : value | 432 // -- eax : value |
| 395 // -- ebx : target map | 433 // -- ebx : target map |
| 396 // -- ecx : key | 434 // -- ecx : key |
| 397 // -- edx : receiver | 435 // -- edx : receiver |
| 398 // -- esp[0] : return address | 436 // -- esp[0] : return address |
| 399 // ----------------------------------- | 437 // ----------------------------------- |
| 400 // Set transitioned map. | 438 // Set transitioned map. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 413 MacroAssembler* masm, Label* fail) { | 451 MacroAssembler* masm, Label* fail) { |
| 414 // ----------- S t a t e ------------- | 452 // ----------- S t a t e ------------- |
| 415 // -- eax : value | 453 // -- eax : value |
| 416 // -- ebx : target map | 454 // -- ebx : target map |
| 417 // -- ecx : key | 455 // -- ecx : key |
| 418 // -- edx : receiver | 456 // -- edx : receiver |
| 419 // -- esp[0] : return address | 457 // -- esp[0] : return address |
| 420 // ----------------------------------- | 458 // ----------------------------------- |
| 421 Label loop, entry, convert_hole, gc_required, only_change_map; | 459 Label loop, entry, convert_hole, gc_required, only_change_map; |
| 422 | 460 |
| 461 if (FLAG_use_allocation_site_info) { | |
| 462 Label no_allocation_site_info; | |
| 463 PerformAllocationSiteInfoCheck(masm, fail, &no_allocation_site_info); | |
| 464 __ bind(&no_allocation_site_info); | |
| 465 } | |
| 466 | |
| 423 // Check for empty arrays, which only require a map transition and no changes | 467 // Check for empty arrays, which only require a map transition and no changes |
| 424 // to the backing store. | 468 // to the backing store. |
| 425 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 469 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 426 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 470 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
| 427 __ j(equal, &only_change_map); | 471 __ j(equal, &only_change_map); |
| 428 | 472 |
| 429 __ push(eax); | 473 __ push(eax); |
| 430 __ push(ebx); | 474 __ push(ebx); |
| 431 | 475 |
| 432 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); | 476 __ mov(edi, FieldOperand(edi, FixedArray::kLengthOffset)); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 MacroAssembler* masm, Label* fail) { | 605 MacroAssembler* masm, Label* fail) { |
| 562 // ----------- S t a t e ------------- | 606 // ----------- S t a t e ------------- |
| 563 // -- eax : value | 607 // -- eax : value |
| 564 // -- ebx : target map | 608 // -- ebx : target map |
| 565 // -- ecx : key | 609 // -- ecx : key |
| 566 // -- edx : receiver | 610 // -- edx : receiver |
| 567 // -- esp[0] : return address | 611 // -- esp[0] : return address |
| 568 // ----------------------------------- | 612 // ----------------------------------- |
| 569 Label loop, entry, convert_hole, gc_required, only_change_map, success; | 613 Label loop, entry, convert_hole, gc_required, only_change_map, success; |
| 570 | 614 |
| 615 if (FLAG_use_allocation_site_info) { | |
| 616 Label no_allocation_site_info; | |
| 617 PerformAllocationSiteInfoCheck(masm, fail, &no_allocation_site_info); | |
| 618 __ bind(&no_allocation_site_info); | |
|
danno
2012/12/26 10:32:01
I like the idea to not pre-transition any arrays t
mvstanton
2013/01/03 14:40:43
I'm trying this out on all platforms with that sec
| |
| 619 } | |
| 620 | |
| 571 // Check for empty arrays, which only require a map transition and no changes | 621 // Check for empty arrays, which only require a map transition and no changes |
| 572 // to the backing store. | 622 // to the backing store. |
| 573 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 623 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 574 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 624 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
| 575 __ j(equal, &only_change_map); | 625 __ j(equal, &only_change_map); |
| 576 | 626 |
| 577 __ push(eax); | 627 __ push(eax); |
| 578 __ push(edx); | 628 __ push(edx); |
| 579 __ push(ebx); | 629 __ push(ebx); |
| 580 | 630 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 Code* stub = GetCodeAgeStub(age, parity); | 1002 Code* stub = GetCodeAgeStub(age, parity); |
| 953 CodePatcher patcher(sequence, young_length); | 1003 CodePatcher patcher(sequence, young_length); |
| 954 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE); | 1004 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE); |
| 955 } | 1005 } |
| 956 } | 1006 } |
| 957 | 1007 |
| 958 | 1008 |
| 959 } } // namespace v8::internal | 1009 } } // namespace v8::internal |
| 960 | 1010 |
| 961 #endif // V8_TARGET_ARCH_IA32 | 1011 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |