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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 4640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4651 #endif | 4651 #endif |
4652 | 4652 |
4653 // Clear the top frame. | 4653 // Clear the top frame. |
4654 ExternalReference c_entry_fp_address(Isolate::kCEntryFPAddress, | 4654 ExternalReference c_entry_fp_address(Isolate::kCEntryFPAddress, |
4655 isolate()); | 4655 isolate()); |
4656 Operand c_entry_fp_operand = ExternalOperand(c_entry_fp_address); | 4656 Operand c_entry_fp_operand = ExternalOperand(c_entry_fp_address); |
4657 movp(c_entry_fp_operand, Immediate(0)); | 4657 movp(c_entry_fp_operand, Immediate(0)); |
4658 } | 4658 } |
4659 | 4659 |
4660 | 4660 |
4661 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | |
4662 Register scratch, | |
4663 Label* miss) { | |
4664 Label same_contexts; | |
4665 | |
4666 DCHECK(!holder_reg.is(scratch)); | |
4667 DCHECK(!scratch.is(kScratchRegister)); | |
4668 // Load current lexical context from the active StandardFrame, which | |
4669 // may require crawling past STUB frames. | |
4670 Label load_context; | |
4671 Label has_context; | |
4672 movp(scratch, rbp); | |
4673 bind(&load_context); | |
4674 DCHECK(SmiValuesAre32Bits()); | |
4675 // This is "JumpIfNotSmi" but without loading the value into a register. | |
4676 cmpl(MemOperand(scratch, CommonFrameConstants::kContextOrFrameTypeOffset), | |
4677 Immediate(0)); | |
4678 j(not_equal, &has_context); | |
4679 movp(scratch, MemOperand(scratch, CommonFrameConstants::kCallerFPOffset)); | |
4680 jmp(&load_context); | |
4681 bind(&has_context); | |
4682 movp(scratch, | |
4683 MemOperand(scratch, CommonFrameConstants::kContextOrFrameTypeOffset)); | |
4684 | |
4685 // When generating debug code, make sure the lexical context is set. | |
4686 if (emit_debug_code()) { | |
4687 cmpp(scratch, Immediate(0)); | |
4688 Check(not_equal, kWeShouldNotHaveAnEmptyLexicalContext); | |
4689 } | |
4690 // Load the native context of the current context. | |
4691 movp(scratch, ContextOperand(scratch, Context::NATIVE_CONTEXT_INDEX)); | |
4692 | |
4693 // Check the context is a native context. | |
4694 if (emit_debug_code()) { | |
4695 Cmp(FieldOperand(scratch, HeapObject::kMapOffset), | |
4696 isolate()->factory()->native_context_map()); | |
4697 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
4698 } | |
4699 | |
4700 // Check if both contexts are the same. | |
4701 cmpp(scratch, FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
4702 j(equal, &same_contexts); | |
4703 | |
4704 // Compare security tokens. | |
4705 // Check that the security token in the calling global object is | |
4706 // compatible with the security token in the receiving global | |
4707 // object. | |
4708 | |
4709 // Check the context is a native context. | |
4710 if (emit_debug_code()) { | |
4711 // Preserve original value of holder_reg. | |
4712 Push(holder_reg); | |
4713 movp(holder_reg, | |
4714 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
4715 CompareRoot(holder_reg, Heap::kNullValueRootIndex); | |
4716 Check(not_equal, kJSGlobalProxyContextShouldNotBeNull); | |
4717 | |
4718 // Read the first word and compare to native_context_map(), | |
4719 movp(holder_reg, FieldOperand(holder_reg, HeapObject::kMapOffset)); | |
4720 CompareRoot(holder_reg, Heap::kNativeContextMapRootIndex); | |
4721 Check(equal, kJSGlobalObjectNativeContextShouldBeANativeContext); | |
4722 Pop(holder_reg); | |
4723 } | |
4724 | |
4725 movp(kScratchRegister, | |
4726 FieldOperand(holder_reg, JSGlobalProxy::kNativeContextOffset)); | |
4727 int token_offset = | |
4728 Context::kHeaderSize + Context::SECURITY_TOKEN_INDEX * kPointerSize; | |
4729 movp(scratch, FieldOperand(scratch, token_offset)); | |
4730 cmpp(scratch, FieldOperand(kScratchRegister, token_offset)); | |
4731 j(not_equal, miss); | |
4732 | |
4733 bind(&same_contexts); | |
4734 } | |
4735 | |
4736 | |
4737 // Compute the hash code from the untagged key. This must be kept in sync with | 4661 // Compute the hash code from the untagged key. This must be kept in sync with |
4738 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in | 4662 // ComputeIntegerHash in utils.h and KeyedLoadGenericStub in |
4739 // code-stub-hydrogen.cc | 4663 // code-stub-hydrogen.cc |
4740 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { | 4664 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { |
4741 // First of all we assign the hash seed to scratch. | 4665 // First of all we assign the hash seed to scratch. |
4742 LoadRoot(scratch, Heap::kHashSeedRootIndex); | 4666 LoadRoot(scratch, Heap::kHashSeedRootIndex); |
4743 SmiToInteger32(scratch, scratch); | 4667 SmiToInteger32(scratch, scratch); |
4744 | 4668 |
4745 // Xor original key with a seed. | 4669 // Xor original key with a seed. |
4746 xorl(r0, scratch); | 4670 xorl(r0, scratch); |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5626 movl(rax, dividend); | 5550 movl(rax, dividend); |
5627 shrl(rax, Immediate(31)); | 5551 shrl(rax, Immediate(31)); |
5628 addl(rdx, rax); | 5552 addl(rdx, rax); |
5629 } | 5553 } |
5630 | 5554 |
5631 | 5555 |
5632 } // namespace internal | 5556 } // namespace internal |
5633 } // namespace v8 | 5557 } // namespace v8 |
5634 | 5558 |
5635 #endif // V8_TARGET_ARCH_X64 | 5559 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |