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 4704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4715 CEntryStub stub(isolate(), 1); | 4715 CEntryStub stub(isolate(), 1); |
4716 Jump(stub.GetCode(), | 4716 Jump(stub.GetCode(), |
4717 RelocInfo::CODE_TARGET, | 4717 RelocInfo::CODE_TARGET, |
4718 al, | 4718 al, |
4719 zero_reg, | 4719 zero_reg, |
4720 Operand(zero_reg), | 4720 Operand(zero_reg), |
4721 bd); | 4721 bd); |
4722 } | 4722 } |
4723 | 4723 |
4724 | 4724 |
4725 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 4725 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
4726 InvokeFlag flag, | |
4727 const CallWrapper& call_wrapper) { | 4726 const CallWrapper& call_wrapper) { |
4728 // You can't call a builtin without a valid frame. | 4727 // You can't call a builtin without a valid frame. |
4729 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4728 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
4730 | 4729 |
4731 GetBuiltinEntry(t9, id); | 4730 GetBuiltinEntry(t9, native_context_index); |
4732 if (flag == CALL_FUNCTION) { | 4731 if (flag == CALL_FUNCTION) { |
4733 call_wrapper.BeforeCall(CallSize(t9)); | 4732 call_wrapper.BeforeCall(CallSize(t9)); |
4734 Call(t9); | 4733 Call(t9); |
4735 call_wrapper.AfterCall(); | 4734 call_wrapper.AfterCall(); |
4736 } else { | 4735 } else { |
4737 DCHECK(flag == JUMP_FUNCTION); | 4736 DCHECK(flag == JUMP_FUNCTION); |
4738 Jump(t9); | 4737 Jump(t9); |
4739 } | 4738 } |
4740 } | 4739 } |
4741 | 4740 |
4742 | 4741 |
4743 void MacroAssembler::GetBuiltinFunction(Register target, | 4742 void MacroAssembler::GetBuiltinFunction(Register target, |
4744 Builtins::JavaScript id) { | 4743 int native_context_index) { |
4745 // Load the builtins object into target register. | 4744 // Load the builtins object into target register. |
4746 ld(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4745 ld(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
4747 ld(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 4746 ld(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); |
4748 // Load the JavaScript builtin function from the builtins object. | 4747 // Load the JavaScript builtin function from the builtins object. |
4749 ld(target, FieldMemOperand(target, | 4748 ld(target, ContextOperand(target, native_context_index)); |
4750 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | |
4751 } | 4749 } |
4752 | 4750 |
4753 | 4751 |
4754 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 4752 void MacroAssembler::GetBuiltinEntry(Register target, |
| 4753 int native_context_index) { |
4755 DCHECK(!target.is(a1)); | 4754 DCHECK(!target.is(a1)); |
4756 GetBuiltinFunction(a1, id); | 4755 GetBuiltinFunction(a1, native_context_index); |
4757 // Load the code entry point from the builtins object. | 4756 // Load the code entry point from the builtins object. |
4758 ld(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 4757 ld(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
4759 } | 4758 } |
4760 | 4759 |
4761 | 4760 |
4762 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 4761 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
4763 Register scratch1, Register scratch2) { | 4762 Register scratch1, Register scratch2) { |
4764 if (FLAG_native_code_counters && counter->Enabled()) { | 4763 if (FLAG_native_code_counters && counter->Enabled()) { |
4765 li(scratch1, Operand(value)); | 4764 li(scratch1, Operand(value)); |
4766 li(scratch2, Operand(ExternalReference(counter))); | 4765 li(scratch2, Operand(ExternalReference(counter))); |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6217 if (mag.shift > 0) sra(result, result, mag.shift); | 6216 if (mag.shift > 0) sra(result, result, mag.shift); |
6218 srl(at, dividend, 31); | 6217 srl(at, dividend, 31); |
6219 Addu(result, result, Operand(at)); | 6218 Addu(result, result, Operand(at)); |
6220 } | 6219 } |
6221 | 6220 |
6222 | 6221 |
6223 } // namespace internal | 6222 } // namespace internal |
6224 } // namespace v8 | 6223 } // namespace v8 |
6225 | 6224 |
6226 #endif // V8_TARGET_ARCH_MIPS64 | 6225 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |