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_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 4778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4789 __ Push(ebx); | 4789 __ Push(ebx); |
4790 __ Push(ecx); | 4790 __ Push(ecx); |
4791 __ CallRuntime(Runtime::kAllocateInNewSpace); | 4791 __ CallRuntime(Runtime::kAllocateInNewSpace); |
4792 __ mov(edx, eax); | 4792 __ mov(edx, eax); |
4793 __ Pop(ebx); | 4793 __ Pop(ebx); |
4794 __ Pop(eax); | 4794 __ Pop(eax); |
4795 } | 4795 } |
4796 __ jmp(&done_allocate); | 4796 __ jmp(&done_allocate); |
4797 } | 4797 } |
4798 | 4798 |
4799 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) { | |
4800 Register context_reg = esi; | |
4801 Register slot_reg = ebx; | |
4802 Register result_reg = eax; | |
4803 Label slow_case; | |
4804 | |
4805 // Go up context chain to the script context. | |
4806 for (int i = 0; i < depth(); ++i) { | |
4807 __ mov(result_reg, ContextOperand(context_reg, Context::PREVIOUS_INDEX)); | |
4808 context_reg = result_reg; | |
4809 } | |
4810 | |
4811 // Load the PropertyCell value at the specified slot. | |
4812 __ mov(result_reg, ContextOperand(context_reg, slot_reg)); | |
4813 __ mov(result_reg, FieldOperand(result_reg, PropertyCell::kValueOffset)); | |
4814 | |
4815 // Check that value is not the_hole. | |
4816 __ CompareRoot(result_reg, Heap::kTheHoleValueRootIndex); | |
4817 __ j(equal, &slow_case, Label::kNear); | |
4818 __ Ret(); | |
4819 | |
4820 // Fallback to the runtime. | |
4821 __ bind(&slow_case); | |
4822 __ SmiTag(slot_reg); | |
4823 __ Pop(result_reg); // Pop return address. | |
4824 __ Push(slot_reg); | |
4825 __ Push(result_reg); // Push return address. | |
4826 __ TailCallRuntime(Runtime::kLoadGlobalViaContext); | |
4827 } | |
4828 | |
4829 | |
4830 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { | 4799 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) { |
4831 Register context_reg = esi; | 4800 Register context_reg = esi; |
4832 Register slot_reg = ebx; | 4801 Register slot_reg = ebx; |
4833 Register value_reg = eax; | 4802 Register value_reg = eax; |
4834 Register cell_reg = edi; | 4803 Register cell_reg = edi; |
4835 Register cell_details_reg = edx; | 4804 Register cell_details_reg = edx; |
4836 Register cell_value_reg = ecx; | 4805 Register cell_value_reg = ecx; |
4837 Label fast_heapobject_case, fast_smi_case, slow_case; | 4806 Label fast_heapobject_case, fast_smi_case, slow_case; |
4838 | 4807 |
4839 if (FLAG_debug_code) { | 4808 if (FLAG_debug_code) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5327 kStackUnwindSpace, nullptr, return_value_operand, | 5296 kStackUnwindSpace, nullptr, return_value_operand, |
5328 NULL); | 5297 NULL); |
5329 } | 5298 } |
5330 | 5299 |
5331 #undef __ | 5300 #undef __ |
5332 | 5301 |
5333 } // namespace internal | 5302 } // namespace internal |
5334 } // namespace v8 | 5303 } // namespace v8 |
5335 | 5304 |
5336 #endif // V8_TARGET_ARCH_X87 | 5305 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |