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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 HInstruction* array_function = BuildGetArrayFunction(context()); | 531 HInstruction* array_function = BuildGetArrayFunction(context()); |
532 ArrayContextChecker(this, | 532 ArrayContextChecker(this, |
533 GetParameter(ArrayConstructorStubBase::kConstructor), | 533 GetParameter(ArrayConstructorStubBase::kConstructor), |
534 array_function); | 534 array_function); |
535 // Get the right map | 535 // Get the right map |
536 // Should be a constant | 536 // Should be a constant |
537 JSArrayBuilder array_builder( | 537 JSArrayBuilder array_builder( |
538 this, | 538 this, |
539 casted_stub()->elements_kind(), | 539 casted_stub()->elements_kind(), |
540 GetParameter(ArrayConstructorStubBase::kPropertyCell), | 540 GetParameter(ArrayConstructorStubBase::kPropertyCell), |
541 casted_stub()->mode()); | 541 casted_stub()->disable_allocation_sites()); |
542 return array_builder.AllocateEmptyArray(); | 542 return array_builder.AllocateEmptyArray(); |
543 } | 543 } |
544 | 544 |
545 | 545 |
546 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode() { | 546 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode() { |
547 return DoGenerateCode(this); | 547 return DoGenerateCode(this); |
548 } | 548 } |
549 | 549 |
550 | 550 |
551 template <> | 551 template <> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 if_builder.End(); | 583 if_builder.End(); |
584 | 584 |
585 // Figure out total size | 585 // Figure out total size |
586 HValue* length = Pop(); | 586 HValue* length = Pop(); |
587 HValue* capacity = Pop(); | 587 HValue* capacity = Pop(); |
588 | 588 |
589 JSArrayBuilder array_builder( | 589 JSArrayBuilder array_builder( |
590 this, | 590 this, |
591 casted_stub()->elements_kind(), | 591 casted_stub()->elements_kind(), |
592 GetParameter(ArrayConstructorStubBase::kPropertyCell), | 592 GetParameter(ArrayConstructorStubBase::kPropertyCell), |
593 casted_stub()->mode()); | 593 casted_stub()->disable_allocation_sites()); |
594 return array_builder.AllocateArray(capacity, length, true); | 594 return array_builder.AllocateArray(capacity, length, true); |
595 } | 595 } |
596 | 596 |
597 | 597 |
598 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode() { | 598 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode() { |
599 return DoGenerateCode(this); | 599 return DoGenerateCode(this); |
600 } | 600 } |
601 | 601 |
602 | 602 |
603 template <> | 603 template <> |
604 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { | 604 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { |
605 HInstruction* array_function = BuildGetArrayFunction(context()); | 605 HInstruction* array_function = BuildGetArrayFunction(context()); |
606 ArrayContextChecker(this, | 606 ArrayContextChecker(this, |
607 GetParameter(ArrayConstructorStubBase::kConstructor), | 607 GetParameter(ArrayConstructorStubBase::kConstructor), |
608 array_function); | 608 array_function); |
609 ElementsKind kind = casted_stub()->elements_kind(); | 609 ElementsKind kind = casted_stub()->elements_kind(); |
610 HValue* length = GetArgumentsLength(); | 610 HValue* length = GetArgumentsLength(); |
611 | 611 |
612 JSArrayBuilder array_builder( | 612 JSArrayBuilder array_builder( |
613 this, | 613 this, |
614 kind, | 614 kind, |
615 GetParameter(ArrayConstructorStubBase::kPropertyCell), | 615 GetParameter(ArrayConstructorStubBase::kPropertyCell), |
616 casted_stub()->mode()); | 616 casted_stub()->disable_allocation_sites()); |
617 | 617 |
618 // We need to fill with the hole if it's a smi array in the multi-argument | 618 // We need to fill with the hole if it's a smi array in the multi-argument |
619 // case because we might have to bail out while copying arguments into | 619 // case because we might have to bail out while copying arguments into |
620 // the array because they aren't compatible with a smi array. | 620 // the array because they aren't compatible with a smi array. |
621 // If it's a double array, no problem, and if it's fast then no | 621 // If it's a double array, no problem, and if it's fast then no |
622 // problem either because doubles are boxed. | 622 // problem either because doubles are boxed. |
623 bool fill_with_hole = IsFastSmiElementsKind(kind); | 623 bool fill_with_hole = IsFastSmiElementsKind(kind); |
624 HValue* new_object = array_builder.AllocateArray(length, | 624 HValue* new_object = array_builder.AllocateArray(length, |
625 length, | 625 length, |
626 fill_with_hole); | 626 fill_with_hole); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 return graph()->GetConstant0(); | 688 return graph()->GetConstant0(); |
689 } | 689 } |
690 | 690 |
691 | 691 |
692 Handle<Code> ToBooleanStub::GenerateCode() { | 692 Handle<Code> ToBooleanStub::GenerateCode() { |
693 return DoGenerateCode(this); | 693 return DoGenerateCode(this); |
694 } | 694 } |
695 | 695 |
696 | 696 |
697 } } // namespace v8::internal | 697 } } // namespace v8::internal |
OLD | NEW |