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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 // In debug mode, make sure the lexical context is set. | 432 // In debug mode, make sure the lexical context is set. |
433 #ifdef DEBUG | 433 #ifdef DEBUG |
434 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, | 434 Check(ne, kWeShouldNotHaveAnEmptyLexicalContext, |
435 scratch, Operand(zero_reg)); | 435 scratch, Operand(zero_reg)); |
436 #endif | 436 #endif |
437 | 437 |
438 // Load the native context of the current context. | 438 // Load the native context of the current context. |
439 int offset = | 439 int offset = |
440 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 440 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
441 ld(scratch, FieldMemOperand(scratch, offset)); | 441 ld(scratch, FieldMemOperand(scratch, offset)); |
442 ld(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 442 ld(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
443 | 443 |
444 // Check the context is a native context. | 444 // Check the context is a native context. |
445 if (emit_debug_code()) { | 445 if (emit_debug_code()) { |
446 push(holder_reg); // Temporarily save holder on the stack. | 446 push(holder_reg); // Temporarily save holder on the stack. |
447 // Read the first word and compare to the native_context_map. | 447 // Read the first word and compare to the native_context_map. |
448 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 448 ld(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
449 LoadRoot(at, Heap::kNativeContextMapRootIndex); | 449 LoadRoot(at, Heap::kNativeContextMapRootIndex); |
450 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, | 450 Check(eq, kJSGlobalObjectNativeContextShouldBeANativeContext, |
451 holder_reg, Operand(at)); | 451 holder_reg, Operand(at)); |
452 pop(holder_reg); // Restore holder. | 452 pop(holder_reg); // Restore holder. |
(...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4774 DCHECK(flag == JUMP_FUNCTION); | 4774 DCHECK(flag == JUMP_FUNCTION); |
4775 Jump(t9); | 4775 Jump(t9); |
4776 } | 4776 } |
4777 } | 4777 } |
4778 | 4778 |
4779 | 4779 |
4780 void MacroAssembler::GetBuiltinFunction(Register target, | 4780 void MacroAssembler::GetBuiltinFunction(Register target, |
4781 int native_context_index) { | 4781 int native_context_index) { |
4782 // Load the builtins object into target register. | 4782 // Load the builtins object into target register. |
4783 ld(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4783 ld(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4784 ld(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); | 4784 ld(target, FieldMemOperand(target, JSGlobalObject::kNativeContextOffset)); |
4785 // Load the JavaScript builtin function from the builtins object. | 4785 // Load the JavaScript builtin function from the builtins object. |
4786 ld(target, ContextOperand(target, native_context_index)); | 4786 ld(target, ContextOperand(target, native_context_index)); |
4787 } | 4787 } |
4788 | 4788 |
4789 | 4789 |
4790 void MacroAssembler::GetBuiltinEntry(Register target, | 4790 void MacroAssembler::GetBuiltinEntry(Register target, |
4791 int native_context_index) { | 4791 int native_context_index) { |
4792 DCHECK(!target.is(a1)); | 4792 DCHECK(!target.is(a1)); |
4793 GetBuiltinFunction(a1, native_context_index); | 4793 GetBuiltinFunction(a1, native_context_index); |
4794 // Load the code entry point from the builtins object. | 4794 // Load the code entry point from the builtins object. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4924 // Slot is in the current function context. Move it into the | 4924 // Slot is in the current function context. Move it into the |
4925 // destination register in case we store into it (the write barrier | 4925 // destination register in case we store into it (the write barrier |
4926 // cannot be allowed to destroy the context in esi). | 4926 // cannot be allowed to destroy the context in esi). |
4927 Move(dst, cp); | 4927 Move(dst, cp); |
4928 } | 4928 } |
4929 } | 4929 } |
4930 | 4930 |
4931 | 4931 |
4932 void MacroAssembler::LoadGlobalProxy(Register dst) { | 4932 void MacroAssembler::LoadGlobalProxy(Register dst) { |
4933 ld(dst, GlobalObjectOperand()); | 4933 ld(dst, GlobalObjectOperand()); |
4934 ld(dst, FieldMemOperand(dst, GlobalObject::kGlobalProxyOffset)); | 4934 ld(dst, FieldMemOperand(dst, JSGlobalObject::kGlobalProxyOffset)); |
4935 } | 4935 } |
4936 | 4936 |
4937 | 4937 |
4938 void MacroAssembler::LoadTransitionedArrayMapConditional( | 4938 void MacroAssembler::LoadTransitionedArrayMapConditional( |
4939 ElementsKind expected_kind, | 4939 ElementsKind expected_kind, |
4940 ElementsKind transitioned_kind, | 4940 ElementsKind transitioned_kind, |
4941 Register map_in_out, | 4941 Register map_in_out, |
4942 Register scratch, | 4942 Register scratch, |
4943 Label* no_map_match) { | 4943 Label* no_map_match) { |
4944 // Load the global or builtins object from the current context. | 4944 // Load the global or builtins object from the current context. |
4945 ld(scratch, | 4945 ld(scratch, |
4946 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4946 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4947 ld(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset)); | 4947 ld(scratch, FieldMemOperand(scratch, JSGlobalObject::kNativeContextOffset)); |
4948 | 4948 |
4949 // Check that the function's map is the same as the expected cached map. | 4949 // Check that the function's map is the same as the expected cached map. |
4950 ld(scratch, | 4950 ld(scratch, |
4951 MemOperand(scratch, | 4951 MemOperand(scratch, |
4952 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); | 4952 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); |
4953 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; | 4953 int offset = expected_kind * kPointerSize + FixedArrayBase::kHeaderSize; |
4954 ld(at, FieldMemOperand(scratch, offset)); | 4954 ld(at, FieldMemOperand(scratch, offset)); |
4955 Branch(no_map_match, ne, map_in_out, Operand(at)); | 4955 Branch(no_map_match, ne, map_in_out, Operand(at)); |
4956 | 4956 |
4957 // Use the transitioned cached map. | 4957 // Use the transitioned cached map. |
4958 offset = transitioned_kind * kPointerSize + | 4958 offset = transitioned_kind * kPointerSize + |
4959 FixedArrayBase::kHeaderSize; | 4959 FixedArrayBase::kHeaderSize; |
4960 ld(map_in_out, FieldMemOperand(scratch, offset)); | 4960 ld(map_in_out, FieldMemOperand(scratch, offset)); |
4961 } | 4961 } |
4962 | 4962 |
4963 | 4963 |
4964 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 4964 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
4965 // Load the global or builtins object from the current context. | 4965 // Load the global or builtins object from the current context. |
4966 ld(function, | 4966 ld(function, |
4967 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4967 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4968 // Load the native context from the global or builtins object. | 4968 // Load the native context from the global or builtins object. |
4969 ld(function, FieldMemOperand(function, | 4969 ld(function, FieldMemOperand(function, JSGlobalObject::kNativeContextOffset)); |
4970 GlobalObject::kNativeContextOffset)); | |
4971 // Load the function from the native context. | 4970 // Load the function from the native context. |
4972 ld(function, MemOperand(function, Context::SlotOffset(index))); | 4971 ld(function, MemOperand(function, Context::SlotOffset(index))); |
4973 } | 4972 } |
4974 | 4973 |
4975 | 4974 |
4976 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, | 4975 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, |
4977 Register map, | 4976 Register map, |
4978 Register scratch) { | 4977 Register scratch) { |
4979 // Load the initial map. The global functions all have initial maps. | 4978 // Load the initial map. The global functions all have initial maps. |
4980 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 4979 ld(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6197 if (mag.shift > 0) sra(result, result, mag.shift); | 6196 if (mag.shift > 0) sra(result, result, mag.shift); |
6198 srl(at, dividend, 31); | 6197 srl(at, dividend, 31); |
6199 Addu(result, result, Operand(at)); | 6198 Addu(result, result, Operand(at)); |
6200 } | 6199 } |
6201 | 6200 |
6202 | 6201 |
6203 } // namespace internal | 6202 } // namespace internal |
6204 } // namespace v8 | 6203 } // namespace v8 |
6205 | 6204 |
6206 #endif // V8_TARGET_ARCH_MIPS64 | 6205 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |