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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 if (and_then == kReturnAtEnd) { | 493 if (and_then == kReturnAtEnd) { |
494 Ret(); | 494 Ret(); |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 | 498 |
499 // ----------------------------------------------------------------------------- | 499 // ----------------------------------------------------------------------------- |
500 // Allocation support. | 500 // Allocation support. |
501 | 501 |
502 | 502 |
503 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
504 Register scratch, | |
505 Label* miss) { | |
506 Label same_contexts; | |
507 Register temporary = t8; | |
508 | |
509 DCHECK(!holder_reg.is(scratch)); | |
510 DCHECK(!holder_reg.is(at)); | |
511 DCHECK(!scratch.is(at)); | |
512 | |
513 // Load current lexical context from the active StandardFrame, which | |
514 // may require crawling past STUB frames. | |
515 Label load_context; | |
516 Label has_context; | |
517 mov(at, fp); | |
518 bind(&load_context); | |
519 lw(scratch, MemOperand(at, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
520 // Passing temporary register, otherwise JumpIfNotSmi modifies register at. | |
521 JumpIfNotSmi(scratch, &has_context, temporary); | |
522 lw(at, MemOperand(at, CommonFrameConstants::kCallerFPOffset)); | |
523 Branch(&load_context); | |
524 bind(&has_context); | |
525 | |
526 // In debug mode, make sure the lexical context is set. | |
527 #ifdef DEBUG | |
528 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, | |
529 scratch, Operand(zero_reg)); | |
530 #endif | |
531 | |
532 // Load the native context of the current context. | |
533 lw(scratch, ContextMemOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); | |
534 | |
535 // Check the context is a native context. | |
536 if (emit_debug_code()) { | |
537 push(holder_reg); // Temporarily save holder on the stack. | |
538 // Read the first word and compare to the native_context_map. | |
539 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | |
540 LoadRoot(at, Heap::kNativeContextMapRootIndex); | |
541 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | |
542 holder_reg, Operand(at)); | |
543 pop(holder_reg); // Restore holder. | |
544 } | |
545 | |
546 // Check if both contexts are the same. | |
547 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
548 Branch(&same_contexts, eq, scratch, Operand(at)); | |
549 | |
550 // Check the context is a native context. | |
551 if (emit_debug_code()) { | |
552 push(holder_reg); // Temporarily save holder on the stack. | |
553 mov(holder_reg, at); // Move at to its holding place. | |
554 LoadRoot(at, Heap::kNullValueRootIndex); | |
555 Check(ne, kJSGlobalProxyContextShouldNotBeNull, | |
556 holder_reg, Operand(at)); | |
557 | |
558 lw(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); | |
559 LoadRoot(at, Heap::kNativeContextMapRootIndex); | |
560 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | |
561 holder_reg, Operand(at)); | |
562 // Restore at is not needed. at is reloaded below. | |
563 pop(holder_reg); // Restore holder. | |
564 // Restore at to holder's context. | |
565 lw(at, FieldMemOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
566 } | |
567 | |
568 // Check that the security token in the calling global object is | |
569 // compatible with the security token in the receiving global | |
570 // object. | |
571 int token_offset = Context::kHeaderSize + | |
572 Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
573 | |
574 lw(scratch, FieldMemOperand(scratch, token_offset)); | |
575 lw(at, FieldMemOperand(at, token_offset)); | |
576 Branch(miss, ne, scratch, Operand(at)); | |
577 | |
578 bind(&same_contexts); | |
579 } | |
580 | |
581 | |
582 // Compute the hash code from the untagged key. This must be kept in sync with | 503 // Compute the hash code from the untagged key. This must be kept in sync with |
583 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 504 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
584 // code-stub-hydrogen.cc | 505 // code-stub-hydrogen.cc |
585 void MacroAssembler::GetNumberHash(Register reg0, Register scratch) { | 506 void MacroAssembler::GetNumberHash(Register reg0, Register scratch) { |
586 // First of all we assign the hash seed to scratch. | 507 // First of all we assign the hash seed to scratch. |
587 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 508 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
588 SmiUntag(scratch); | 509 SmiUntag(scratch); |
589 | 510 |
590 // Xor original key with a seed. | 511 // Xor original key with a seed. |
591 xor_(reg0, reg0, scratch); | 512 xor_(reg0, reg0, scratch); |
(...skipping 6229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6821 if (mag.shift > 0) sra(result, result, mag.shift); | 6742 if (mag.shift > 0) sra(result, result, mag.shift); |
6822 srl(at, dividend, 31); | 6743 srl(at, dividend, 31); |
6823 Addu(result, result, Operand(at)); | 6744 Addu(result, result, Operand(at)); |
6824 } | 6745 } |
6825 | 6746 |
6826 | 6747 |
6827 } // namespace internal | 6748 } // namespace internal |
6828 } // namespace v8 | 6749 } // namespace v8 |
6829 | 6750 |
6830 #endif // V8_TARGET_ARCH_MIPS | 6751 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |