| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
| 8 | 8 |
| 9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 if (and_then == kReturnAtEnd) { | 510 if (and_then == kReturnAtEnd) { |
| 511 Ret(); | 511 Ret(); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 | 515 |
| 516 // ----------------------------------------------------------------------------- | 516 // ----------------------------------------------------------------------------- |
| 517 // Allocation support. | 517 // Allocation support. |
| 518 | 518 |
| 519 | 519 |
| 520 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
| 521 Register scratch, | |
| 522 Label* miss) { | |
| 523 Label same_contexts; | |
| 524 Register temporary = t8; | |
| 525 | |
| 526 DCHECK(!holder_reg.is(scratch)); | |
| 527 DCHECK(!holder_reg.is(at)); | |
| 528 DCHECK(!scratch.is(at)); | |
| 529 | |
| 530 // Load current lexical context from the active StandardFrame, which | |
| 531 // may require crawling past STUB frames. | |
| 532 Label load_context; | |
| 533 Label has_context; | |
| 534 mov(at, fp); | |
| 535 bind(&load_context); | |
| 536 ld(scratch, MemOperand(at, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
| 537 // Passing temporary register, otherwise JumpIfNotSmi modifies register at. | |
| 538 JumpIfNotSmi(scratch, &has_context, temporary); | |
| 539 ld(at, MemOperand(at, CommonFrameConstants::kCallerFPOffset)); | |
| 540 Branch(&load_context); | |
| 541 bind(&has_context); | |
| 542 | |
| 543 // In debug mode, make sure the lexical context is set. | |
| 544 #ifdef DEBUG | |
| 545 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, | |
| 546 scratch, Operand(zero_reg)); | |
| 547 #endif | |
| 548 | |
| 549 // Load the native context of the current context. | |
| 550 ld(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); | |
| 551 | |
| 552 // Check the context is a native context. | |
| 553 if (emit_debug_code()) { | |
| 554 push(holder_reg); // Temporarily save holder on the stack. | |
| 555 // Read the first word and compare to the native_context_map. | |
| 556 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | |
| 557 LoadRoot(at, Heap::kNativeContextMapRootIndex); | |
| 558 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | |
| 559 holder_reg, Operand(at)); | |
| 560 pop(holder_reg); // Restore holder. | |
| 561 } | |
| 562 | |
| 563 // Check if both contexts are the same. | |
| 564 ld(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 565 Branch(&same_contexts, eq, scratch, Operand(at)); | |
| 566 | |
| 567 // Check the context is a native context. | |
| 568 if (emit_debug_code()) { | |
| 569 push(holder_reg); // Temporarily save holder on the stack. | |
| 570 mov(holder_reg, at); // Move at to its holding place. | |
| 571 LoadRoot(at, Heap::kNullValueRootIndex); | |
| 572 Check(ne, kJSGlobalProxyContextShouldNotBeNull, | |
| 573 holder_reg, Operand(at)); | |
| 574 | |
| 575 ld(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | |
| 576 LoadRoot(at, Heap::kNativeContextMapRootIndex); | |
| 577 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | |
| 578 holder_reg, Operand(at)); | |
| 579 // Restore at is not needed. at is reloaded below. | |
| 580 pop(holder_reg); // Restore holder. | |
| 581 // Restore at to holder's context. | |
| 582 ld(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
| 583 } | |
| 584 | |
| 585 // Check that the security token in the calling global object is | |
| 586 // compatible with the security token in the receiving global | |
| 587 // object. | |
| 588 int token_offset = Context::kHeaderSize + | |
| 589 Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
| 590 | |
| 591 ld(scratch, FieldMemOperand(scratch, token_offset)); | |
| 592 ld(at, FieldMemOperand(at, token_offset)); | |
| 593 Branch(miss, ne, scratch, Operand(at)); | |
| 594 | |
| 595 bind(&same_contexts); | |
| 596 } | |
| 597 | |
| 598 | |
| 599 // Compute the hash code from the untagged key. This must be kept in sync with | 520 // Compute the hash code from the untagged key. This must be kept in sync with |
| 600 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 521 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
| 601 // code-stub-hydrogen.cc | 522 // code-stub-hydrogen.cc |
| 602 void MacroAssembler::GetNumberHash(Register reg0, Register scratch) { | 523 void MacroAssembler::GetNumberHash(Register reg0, Register scratch) { |
| 603 // First of all we assign the hash seed to scratch. | 524 // First of all we assign the hash seed to scratch. |
| 604 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 525 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
| 605 SmiUntag(scratch); | 526 SmiUntag(scratch); |
| 606 | 527 |
| 607 // Xor original key with a seed. | 528 // Xor original key with a seed. |
| 608 xor_(reg0, reg0, scratch); | 529 xor_(reg0, reg0, scratch); |
| (...skipping 6613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7222 if (mag.shift > 0) sra(result, result, mag.shift); | 7143 if (mag.shift > 0) sra(result, result, mag.shift); |
| 7223 srl(at, dividend, 31); | 7144 srl(at, dividend, 31); |
| 7224 Addu(result, result, Operand(at)); | 7145 Addu(result, result, Operand(at)); |
| 7225 } | 7146 } |
| 7226 | 7147 |
| 7227 | 7148 |
| 7228 } // namespace internal | 7149 } // namespace internal |
| 7229 } // namespace v8 | 7150 } // namespace v8 |
| 7230 | 7151 |
| 7231 #endif // V8_TARGET_ARCH_MIPS64 | 7152 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |