| OLD | NEW |
| 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_S390 | 8 #if V8_TARGET_ARCH_S390 |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 STATIC_ASSERT(StackHandlerConstants::kSize == 1 * kPointerSize); | 1495 STATIC_ASSERT(StackHandlerConstants::kSize == 1 * kPointerSize); |
| 1496 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 1496 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 1497 | 1497 |
| 1498 // Pop the Next Handler into r3 and store it into Handler Address reference. | 1498 // Pop the Next Handler into r3 and store it into Handler Address reference. |
| 1499 Pop(r3); | 1499 Pop(r3); |
| 1500 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); | 1500 mov(ip, Operand(ExternalReference(Isolate::kHandlerAddress, isolate()))); |
| 1501 | 1501 |
| 1502 StoreP(r3, MemOperand(ip)); | 1502 StoreP(r3, MemOperand(ip)); |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
| 1506 Register scratch, Label* miss) { | |
| 1507 Label same_contexts; | |
| 1508 | |
| 1509 DCHECK(!holder_reg.is(scratch)); | |
| 1510 DCHECK(!holder_reg.is(ip)); | |
| 1511 DCHECK(!scratch.is(ip)); | |
| 1512 | |
| 1513 // Load current lexical context from the active StandardFrame, which | |
| 1514 // may require crawling past STUB frames. | |
| 1515 Label load_context; | |
| 1516 Label has_context; | |
| 1517 DCHECK(!ip.is(scratch)); | |
| 1518 LoadRR(ip, fp); | |
| 1519 bind(&load_context); | |
| 1520 LoadP(scratch, | |
| 1521 MemOperand(ip, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
| 1522 JumpIfNotSmi(scratch, &has_context); | |
| 1523 LoadP(ip, MemOperand(ip, CommonFrameConstants::kCallerFPOffset)); | |
| 1524 b(&load_context); | |
| 1525 bind(&has_context); | |
| 1526 | |
| 1527 // In debug mode, make sure the lexical context is set. | |
| 1528 #ifdef DEBUG | |
| 1529 CmpP(scratch, Operand::Zero()); | |
| 1530 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext); | |
| 1531 #endif | |
| 1532 | |
| 1533 // Load the native context of the current context. | |
| 1534 LoadP(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); | |
| 1535 | |
| 1536 // Check the context is a native context. | |
| 1537 if (emit_debug_code()) { | |
| 1538 // Cannot use ip as a temporary in this verification code. Due to the fact | |
| 1539 // that ip is clobbered as part of cmp with an object Operand. | |
| 1540 push(holder_reg); // Temporarily save holder on the stack. | |
| 1541 // Read the first word and compare to the native_context_map. | |
| 1542 LoadP(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | |
| 1543 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); | |
| 1544 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
| 1545 pop(holder_reg); // Restore holder. | |
| 1546 } | |
| 1547 | |
| 1548 // Check if both contexts are the same. | |
| 1549 LoadP(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 1550 CmpP(scratch, ip); | |
| 1551 beq(&same_contexts, Label::kNear); | |
| 1552 | |
| 1553 // Check the context is a native context. | |
| 1554 if (emit_debug_code()) { | |
| 1555 // TODO(119): avoid push(holder_reg)/pop(holder_reg) | |
| 1556 // Cannot use ip as a temporary in this verification code. Due to the fact | |
| 1557 // that ip is clobbered as part of cmp with an object Operand. | |
| 1558 push(holder_reg); // Temporarily save holder on the stack. | |
| 1559 LoadRR(holder_reg, ip); // Move ip to its holding place. | |
| 1560 CompareRoot(holder_reg, Heap::kNullValueRootIndex); | |
| 1561 Check(ne, kJSGlobalProxyContextShouldNotBeNull); | |
| 1562 | |
| 1563 LoadP(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | |
| 1564 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); | |
| 1565 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
| 1566 // Restore ip is not needed. ip is reloaded below. | |
| 1567 pop(holder_reg); // Restore holder. | |
| 1568 // Restore ip to holder's context. | |
| 1569 LoadP(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 1570 } | |
| 1571 | |
| 1572 // Check that the security token in the calling global object is | |
| 1573 // compatible with the security token in the receiving global | |
| 1574 // object. | |
| 1575 int token_offset = | |
| 1576 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
| 1577 | |
| 1578 LoadP(scratch, FieldMemOperand(scratch, token_offset)); | |
| 1579 LoadP(ip, FieldMemOperand(ip, token_offset)); | |
| 1580 CmpP(scratch, ip); | |
| 1581 bne(miss); | |
| 1582 | |
| 1583 bind(&same_contexts); | |
| 1584 } | |
| 1585 | |
| 1586 // Compute the hash code from the untagged key. This must be kept in sync with | 1505 // Compute the hash code from the untagged key. This must be kept in sync with |
| 1587 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 1506 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
| 1588 // code-stub-hydrogen.cc | 1507 // code-stub-hydrogen.cc |
| 1589 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { | 1508 void MacroAssembler::GetNumberHash(Register t0, Register scratch) { |
| 1590 // First of all we assign the hash seed to scratch. | 1509 // First of all we assign the hash seed to scratch. |
| 1591 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 1510 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
| 1592 SmiUntag(scratch); | 1511 SmiUntag(scratch); |
| 1593 | 1512 |
| 1594 // Xor original key with a seed. | 1513 // Xor original key with a seed. |
| 1595 XorP(t0, scratch); | 1514 XorP(t0, scratch); |
| (...skipping 3791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5387 } | 5306 } |
| 5388 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5307 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
| 5389 ExtractBit(r0, dividend, 31); | 5308 ExtractBit(r0, dividend, 31); |
| 5390 AddP(result, r0); | 5309 AddP(result, r0); |
| 5391 } | 5310 } |
| 5392 | 5311 |
| 5393 } // namespace internal | 5312 } // namespace internal |
| 5394 } // namespace v8 | 5313 } // namespace v8 |
| 5395 | 5314 |
| 5396 #endif // V8_TARGET_ARCH_S390 | 5315 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |