Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: src/ppc/macro-assembler-ppc.cc

Issue 2455953002: [ic] Remove unnecessary access rights checks from the IC handlers. (Closed)
Patch Set: Addressing comments and rebasing Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <assert.h> // For assert 5 #include <assert.h> // For assert
6 #include <limits.h> // For LONG_MIN, LONG_MAX. 6 #include <limits.h> // For LONG_MIN, LONG_MAX.
7 7
8 #if V8_TARGET_ARCH_PPC 8 #if V8_TARGET_ARCH_PPC
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 void MacroAssembler::PopStackHandler() { 1598 void MacroAssembler::PopStackHandler() {
1599 STATIC_ASSERT(StackHandlerConstants::kSize == 1 * kPointerSize); 1599 STATIC_ASSERT(StackHandlerConstants::kSize == 1 * kPointerSize);
1600 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); 1600 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
1601 1601
1602 pop(r4); 1602 pop(r4);
1603 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); 1603 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate())));
1604 StoreP(r4, MemOperand(ip)); 1604 StoreP(r4, MemOperand(ip));
1605 } 1605 }
1606 1606
1607 1607
1608 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
1609 Register scratch, Label* miss) {
1610 Label same_contexts;
1611
1612 DCHECK(!holder_reg.is(scratch));
1613 DCHECK(!holder_reg.is(ip));
1614 DCHECK(!scratch.is(ip));
1615
1616 // Load current lexical context from the active StandardFrame, which
1617 // may require crawling past STUB frames.
1618 Label load_context;
1619 Label has_context;
1620 DCHECK(!ip.is(scratch));
1621 mr(ip, fp);
1622 bind(&load_context);
1623 LoadP(scratch,
1624 MemOperand(ip, CommonFrameConstants::kContextOrFrameTypeOffset));
1625 JumpIfNotSmi(scratch, &has_context);
1626 LoadP(ip, MemOperand(ip, CommonFrameConstants::kCallerFPOffset));
1627 b(&load_context);
1628 bind(&has_context);
1629
1630 // In debug mode, make sure the lexical context is set.
1631 #ifdef DEBUG
1632 cmpi(scratch, Operand::Zero());
1633 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext);
1634 #endif
1635
1636 // Load the native context of the current context.
1637 LoadP(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX));
1638
1639 // Check the context is a native context.
1640 if (emit_debug_code()) {
1641 // Cannot use ip as a temporary in this verification code. Due to the fact
1642 // that ip is clobbered as part of cmp with an object Operand.
1643 push(holder_reg); // Temporarily save holder on the stack.
1644 // Read the first word and compare to the native_context_map.
1645 LoadP(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset));
1646 LoadRoot(ip, Heap::kNativeContextMapRootIndex);
1647 cmp(holder_reg, ip);
1648 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext);
1649 pop(holder_reg); // Restore holder.
1650 }
1651
1652 // Check if both contexts are the same.
1653 LoadP(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1654 cmp(scratch, ip);
1655 beq(&same_contexts);
1656
1657 // Check the context is a native context.
1658 if (emit_debug_code()) {
1659 // Cannot use ip as a temporary in this verification code. Due to the fact
1660 // that ip is clobbered as part of cmp with an object Operand.
1661 push(holder_reg); // Temporarily save holder on the stack.
1662 mr(holder_reg, ip); // Move ip to its holding place.
1663 LoadRoot(ip, Heap::kNullValueRootIndex);
1664 cmp(holder_reg, ip);
1665 Check(ne, kJSGlobalProxyContextShouldNotBeNull);
1666
1667 LoadP(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset));
1668 LoadRoot(ip, Heap::kNativeContextMapRootIndex);
1669 cmp(holder_reg, ip);
1670 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext);
1671 // Restore ip is not needed. ip is reloaded below.
1672 pop(holder_reg); // Restore holder.
1673 // Restore ip to holder's context.
1674 LoadP(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset));
1675 }
1676
1677 // Check that the security token in the calling global object is
1678 // compatible with the security token in the receiving global
1679 // object.
1680 int token_offset =
1681 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize;
1682
1683 LoadP(scratch, FieldMemOperand(scratch, token_offset));
1684 LoadP(ip, FieldMemOperand(ip, token_offset));
1685 cmp(scratch, ip);
1686 bne(miss);
1687
1688 bind(&same_contexts);
1689 }
1690
1691
1692 // Compute the hash code from the untagged key. This must be kept in sync with 1608 // Compute the hash code from the untagged key. This must be kept in sync with
1693 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in 1609 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in
1694 // code-stub-hydrogen.cc 1610 // code-stub-hydrogen.cc
1695 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { 1611 void MacroAssembler::GetNumberHash(Register t0, Register scratch) {
1696 // First of all we assign the hash seed to scratch. 1612 // First of all we assign the hash seed to scratch.
1697 LoadRoot(scratch, Heap::kHashSeedRootIndex); 1613 LoadRoot(scratch, Heap::kHashSeedRootIndex);
1698 SmiUntag(scratch); 1614 SmiUntag(scratch);
1699 1615
1700 // Xor original key with a seed. 1616 // Xor original key with a seed.
1701 xor_(t0, t0, scratch); 1617 xor_(t0, t0, scratch);
(...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after
4702 } 4618 }
4703 if (mag.shift > 0) srawi(result, result, mag.shift); 4619 if (mag.shift > 0) srawi(result, result, mag.shift);
4704 ExtractBit(r0, dividend, 31); 4620 ExtractBit(r0, dividend, 31);
4705 add(result, result, r0); 4621 add(result, result, r0);
4706 } 4622 }
4707 4623
4708 } // namespace internal 4624 } // namespace internal
4709 } // namespace v8 4625 } // namespace v8
4710 4626
4711 #endif // V8_TARGET_ARCH_PPC 4627 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | src/s390/macro-assembler-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698