| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 void Generate(MacroAssembler* masm); | 435 void Generate(MacroAssembler* masm); |
| 436 | 436 |
| 437 private: | 437 private: |
| 438 int slots_; | 438 int slots_; |
| 439 | 439 |
| 440 Major MajorKey() { return FastNewBlockContext; } | 440 Major MajorKey() { return FastNewBlockContext; } |
| 441 int MinorKey() { return slots_; } | 441 int MinorKey() { return slots_; } |
| 442 }; | 442 }; |
| 443 | 443 |
| 444 | 444 |
| 445 class FastCloneShallowArrayStub : public PlatformCodeStub { | 445 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
| 446 public: | 446 public: |
| 447 // Maximum length of copied elements array. | 447 // Maximum length of copied elements array. |
| 448 static const int kMaximumClonedLength = 8; | 448 static const int kMaximumClonedLength = 8; |
| 449 enum Mode { | 449 enum Mode { |
| 450 CLONE_ELEMENTS, | 450 CLONE_ELEMENTS, |
| 451 CLONE_DOUBLE_ELEMENTS, | 451 CLONE_DOUBLE_ELEMENTS, |
| 452 COPY_ON_WRITE_ELEMENTS, | 452 COPY_ON_WRITE_ELEMENTS, |
| 453 CLONE_ANY_ELEMENTS, | 453 CLONE_ANY_ELEMENTS, |
| 454 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS | 454 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS |
| 455 }; | 455 }; |
| 456 | 456 |
| 457 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; | 457 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; |
| 458 | 458 |
| 459 FastCloneShallowArrayStub(Mode mode, | 459 FastCloneShallowArrayStub(Mode mode, |
| 460 AllocationSiteMode allocation_site_mode, | 460 AllocationSiteMode allocation_site_mode, |
| 461 int length) | 461 int length) |
| 462 : mode_(mode), | 462 : mode_(mode), |
| 463 allocation_site_mode_(allocation_site_mode), | 463 allocation_site_mode_(allocation_site_mode), |
| 464 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 464 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
| 465 ASSERT_GE(length_, 0); | 465 ASSERT_GE(length_, 0); |
| 466 ASSERT_LE(length_, kMaximumClonedLength); | 466 ASSERT_LE(length_, kMaximumClonedLength); |
| 467 } | 467 } |
| 468 | 468 |
| 469 void Generate(MacroAssembler* masm); | 469 Mode mode() const { return mode_; } |
| 470 int length() const { return length_; } |
| 471 AllocationSiteMode allocation_site_mode() const { |
| 472 return allocation_site_mode_; |
| 473 } |
| 474 |
| 475 ElementsKind ComputeElementsKind() const { |
| 476 switch (mode()) { |
| 477 case CLONE_ELEMENTS: |
| 478 case COPY_ON_WRITE_ELEMENTS: |
| 479 return FAST_ELEMENTS; |
| 480 case CLONE_DOUBLE_ELEMENTS: |
| 481 return FAST_DOUBLE_ELEMENTS; |
| 482 case CLONE_ANY_ELEMENTS: |
| 483 /*fall-through*/; |
| 484 } |
| 485 UNREACHABLE(); |
| 486 return LAST_ELEMENTS_KIND; |
| 487 } |
| 488 |
| 489 virtual Handle<Code> GenerateCode(); |
| 490 |
| 491 virtual void InitializeInterfaceDescriptor( |
| 492 Isolate* isolate, |
| 493 CodeStubInterfaceDescriptor* descriptor); |
| 470 | 494 |
| 471 private: | 495 private: |
| 472 Mode mode_; | 496 Mode mode_; |
| 473 AllocationSiteMode allocation_site_mode_; | 497 AllocationSiteMode allocation_site_mode_; |
| 474 int length_; | 498 int length_; |
| 475 | 499 |
| 476 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 500 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
| 477 class ModeBits: public BitField<Mode, 1, 4> {}; | 501 class ModeBits: public BitField<Mode, 1, 4> {}; |
| 478 class LengthBits: public BitField<int, 5, 4> {}; | 502 class LengthBits: public BitField<int, 5, 4> {}; |
| 479 // Ensure data fits within available bits. | 503 // Ensure data fits within available bits. |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 | 1590 |
| 1567 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1591 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 1568 }; | 1592 }; |
| 1569 | 1593 |
| 1570 | 1594 |
| 1571 class StubFailureTrampolineStub : public PlatformCodeStub { | 1595 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 1572 public: | 1596 public: |
| 1573 static const int kMaxExtraExpressionStackCount = 1; | 1597 static const int kMaxExtraExpressionStackCount = 1; |
| 1574 | 1598 |
| 1575 explicit StubFailureTrampolineStub(int extra_expression_stack_count) | 1599 explicit StubFailureTrampolineStub(int extra_expression_stack_count) |
| 1576 : extra_expression_stack_count_(extra_expression_stack_count) {} | 1600 : fp_registers_(CanUseFPRegisters()), |
| 1601 extra_expression_stack_count_(extra_expression_stack_count) {} |
| 1577 | 1602 |
| 1578 virtual bool IsPregenerated() { return true; } | 1603 virtual bool IsPregenerated() { return true; } |
| 1579 | 1604 |
| 1580 static void GenerateAheadOfTime(Isolate* isolate); | 1605 static void GenerateAheadOfTime(Isolate* isolate); |
| 1581 | 1606 |
| 1582 private: | 1607 private: |
| 1608 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 1609 class ExtraStackCount: public BitField<int, 1, 1> {}; |
| 1610 |
| 1583 Major MajorKey() { return StubFailureTrampoline; } | 1611 Major MajorKey() { return StubFailureTrampoline; } |
| 1584 int MinorKey() { return extra_expression_stack_count_; } | 1612 int MinorKey() { |
| 1613 return FPRegisters::encode(fp_registers_) | |
| 1614 ExtraStackCount::encode(extra_expression_stack_count_); |
| 1615 } |
| 1585 | 1616 |
| 1586 void Generate(MacroAssembler* masm); | 1617 void Generate(MacroAssembler* masm); |
| 1587 | 1618 |
| 1619 bool fp_registers_; |
| 1588 int extra_expression_stack_count_; | 1620 int extra_expression_stack_count_; |
| 1589 | 1621 |
| 1590 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 1622 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
| 1591 }; | 1623 }; |
| 1592 | 1624 |
| 1593 | 1625 |
| 1594 class ProfileEntryHookStub : public PlatformCodeStub { | 1626 class ProfileEntryHookStub : public PlatformCodeStub { |
| 1595 public: | 1627 public: |
| 1596 explicit ProfileEntryHookStub() {} | 1628 explicit ProfileEntryHookStub() {} |
| 1597 | 1629 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1619 | 1651 |
| 1620 // The current function entry hook. | 1652 // The current function entry hook. |
| 1621 static FunctionEntryHook entry_hook_; | 1653 static FunctionEntryHook entry_hook_; |
| 1622 | 1654 |
| 1623 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1655 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1624 }; | 1656 }; |
| 1625 | 1657 |
| 1626 } } // namespace v8::internal | 1658 } } // namespace v8::internal |
| 1627 | 1659 |
| 1628 #endif // V8_CODE_STUBS_H_ | 1660 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |