| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 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_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // In debug mode, make sure the lexical context is set. | 429 // In debug mode, make sure the lexical context is set. |
| 430 #ifdef DEBUG | 430 #ifdef DEBUG |
| 431 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, | 431 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, |
| 432 scratch, Operand(zero_reg)); | 432 scratch, Operand(zero_reg)); |
| 433 #endif | 433 #endif |
| 434 | 434 |
| 435 // Load the native context of the current context. | 435 // Load the native context of the current context. |
| 436 int offset = | 436 int offset = |
| 437 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 437 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 438 lw(scratch, FieldMemOperand(scratch, offset)); | 438 lw(scratch, FieldMemOperand(scratch, offset)); |
| 439 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 439 lw(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
| 440 | 440 |
| 441 // Check the context is a native context. | 441 // Check the context is a native context. |
| 442 if (emit_debug_code()) { | 442 if (emit_debug_code()) { |
| 443 push(holder_reg); // Temporarily save holder on the stack. | 443 push(holder_reg); // Temporarily save holder on the stack. |
| 444 // Read the first word and compare to the native_context_map. | 444 // Read the first word and compare to the native_context_map. |
| 445 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 445 lw(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 446 LoadRoot(at, Heap::kNativeContextMapRootIndex); | 446 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
| 447 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | 447 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, |
| 448 holder_reg, Operand(at)); | 448 holder_reg, Operand(at)); |
| 449 pop(holder_reg); // Restore holder. | 449 pop(holder_reg); // Restore holder. |
| (...skipping 4124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4574 DCHECK(flag == JUMP_FUNCTION); | 4574 DCHECK(flag == JUMP_FUNCTION); |
| 4575 Jump(t9); | 4575 Jump(t9); |
| 4576 } | 4576 } |
| 4577 } | 4577 } |
| 4578 | 4578 |
| 4579 | 4579 |
| 4580 void MacroAssembler::GetBuiltinFunction(Register target, | 4580 void MacroAssembler::GetBuiltinFunction(Register target, |
| 4581 int native_context_index) { | 4581 int native_context_index) { |
| 4582 // Load the builtins object into target register. | 4582 // Load the builtins object into target register. |
| 4583 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4583 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 4584 lw(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); | 4584 lw(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset)); |
| 4585 // Load the JavaScript builtin function from the builtins object. | 4585 // Load the JavaScript builtin function from the builtins object. |
| 4586 lw(target, ContextOperand(target, native_context_index)); | 4586 lw(target, ContextOperand(target, native_context_index)); |
| 4587 } | 4587 } |
| 4588 | 4588 |
| 4589 | 4589 |
| 4590 void MacroAssembler::GetBuiltinEntry(Register target, | 4590 void MacroAssembler::GetBuiltinEntry(Register target, |
| 4591 int native_context_index) { | 4591 int native_context_index) { |
| 4592 DCHECK(!target.is(a1)); | 4592 DCHECK(!target.is(a1)); |
| 4593 GetBuiltinFunction(a1, native_context_index); | 4593 GetBuiltinFunction(a1, native_context_index); |
| 4594 // Load the code entry point from the builtins object. | 4594 // Load the code entry point from the builtins object. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4724 // Slot is in the current function context. Move it into the | 4724 // Slot is in the current function context. Move it into the |
| 4725 // destination register in case we store into it (the write barrier | 4725 // destination register in case we store into it (the write barrier |
| 4726 // cannot be allowed to destroy the context in esi). | 4726 // cannot be allowed to destroy the context in esi). |
| 4727 Move(dst, cp); | 4727 Move(dst, cp); |
| 4728 } | 4728 } |
| 4729 } | 4729 } |
| 4730 | 4730 |
| 4731 | 4731 |
| 4732 void MacroAssembler::LoadGlobalProxy(Register dst) { | 4732 void MacroAssembler::LoadGlobalProxy(Register dst) { |
| 4733 lw(dst, GlobalObjectOperand()); | 4733 lw(dst, GlobalObjectOperand()); |
| 4734 lw(dst, FieldMemOperand(dst, GlobalObject::kGlobalProxyOffset)); | 4734 lw(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
| 4735 } | 4735 } |
| 4736 | 4736 |
| 4737 | 4737 |
| 4738 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4738 void MacroAssembler::LoadTransitionedArrayMapConditional( |
| 4739 ElementsKind expected_kind, | 4739 ElementsKind expected_kind, |
| 4740 ElementsKind transitioned_kind, | 4740 ElementsKind transitioned_kind, |
| 4741 Register map_in_out, | 4741 Register map_in_out, |
| 4742 Register scratch, | 4742 Register scratch, |
| 4743 Label* no_map_match) { | 4743 Label* no_map_match) { |
| 4744 // Load the global or builtins object from the current context. | 4744 // Load the global or builtins object from the current context. |
| 4745 lw(scratch, | 4745 lw(scratch, |
| 4746 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4746 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 4747 lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 4747 lw(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
| 4748 | 4748 |
| 4749 // Check that the function's map is the same as the expected cached map. | 4749 // Check that the function's map is the same as the expected cached map. |
| 4750 lw(scratch, | 4750 lw(scratch, |
| 4751 MemOperand(scratch, | 4751 MemOperand(scratch, |
| 4752 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4752 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
| 4753 size_t offset = expected_kind * kPointerSize + | 4753 size_t offset = expected_kind * kPointerSize + |
| 4754 FixedArrayBase::kHeaderSize; | 4754 FixedArrayBase::kHeaderSize; |
| 4755 lw(at, FieldMemOperand(scratch, offset)); | 4755 lw(at, FieldMemOperand(scratch, offset)); |
| 4756 Branch(no_map_match, ne, map_in_out, Operand(at)); | 4756 Branch(no_map_match, ne, map_in_out, Operand(at)); |
| 4757 | 4757 |
| 4758 // Use the transitioned cached map. | 4758 // Use the transitioned cached map. |
| 4759 offset = transitioned_kind * kPointerSize + | 4759 offset = transitioned_kind * kPointerSize + |
| 4760 FixedArrayBase::kHeaderSize; | 4760 FixedArrayBase::kHeaderSize; |
| 4761 lw(map_in_out, FieldMemOperand(scratch, offset)); | 4761 lw(map_in_out, FieldMemOperand(scratch, offset)); |
| 4762 } | 4762 } |
| 4763 | 4763 |
| 4764 | 4764 |
| 4765 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4765 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
| 4766 // Load the global or builtins object from the current context. | 4766 // Load the global or builtins object from the current context. |
| 4767 lw(function, | 4767 lw(function, |
| 4768 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4768 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 4769 // Load the native context from the global or builtins object. | 4769 // Load the native context from the global or builtins object. |
| 4770 lw(function, FieldMemOperand(function, | 4770 lw(function, FieldMemOperand(function, JSGlobalObject::kNativeContextOffset)); |
| 4771 GlobalObject::kNativeContextOffset)); | |
| 4772 // Load the function from the native context. | 4771 // Load the function from the native context. |
| 4773 lw(function, MemOperand(function, Context::SlotOffset(index))); | 4772 lw(function, MemOperand(function, Context::SlotOffset(index))); |
| 4774 } | 4773 } |
| 4775 | 4774 |
| 4776 | 4775 |
| 4777 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4776 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
| 4778 Register map, | 4777 Register map, |
| 4779 Register scratch) { | 4778 Register scratch) { |
| 4780 // Load the initial map. The global functions all have initial maps. | 4779 // Load the initial map. The global functions all have initial maps. |
| 4781 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 4780 lw(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| (...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5930 if (mag.shift > 0) sra(result, result, mag.shift); | 5929 if (mag.shift > 0) sra(result, result, mag.shift); |
| 5931 srl(at, dividend, 31); | 5930 srl(at, dividend, 31); |
| 5932 Addu(result, result, Operand(at)); | 5931 Addu(result, result, Operand(at)); |
| 5933 } | 5932 } |
| 5934 | 5933 |
| 5935 | 5934 |
| 5936 } // namespace internal | 5935 } // namespace internal |
| 5937 } // namespace v8 | 5936 } // namespace v8 |
| 5938 | 5937 |
| 5939 #endif // V8_TARGET_ARCH_MIPS | 5938 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |