| 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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
| (...skipping 4573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4584 CEntryStub stub(isolate(), 1); | 4584 CEntryStub stub(isolate(), 1); |
| 4585 Jump(stub.GetCode(), | 4585 Jump(stub.GetCode(), |
| 4586 RelocInfo::CODE_TARGET, | 4586 RelocInfo::CODE_TARGET, |
| 4587 al, | 4587 al, |
| 4588 zero_reg, | 4588 zero_reg, |
| 4589 Operand(zero_reg), | 4589 Operand(zero_reg), |
| 4590 bd); | 4590 bd); |
| 4591 } | 4591 } |
| 4592 | 4592 |
| 4593 | 4593 |
| 4594 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 4594 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
| 4595 InvokeFlag flag, | |
| 4596 const CallWrapper& call_wrapper) { | 4595 const CallWrapper& call_wrapper) { |
| 4597 // You can't call a builtin without a valid frame. | 4596 // You can't call a builtin without a valid frame. |
| 4598 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 4597 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 4599 | 4598 |
| 4600 GetBuiltinEntry(t9, id); | 4599 GetBuiltinEntry(t9, native_context_index); |
| 4601 if (flag == CALL_FUNCTION) { | 4600 if (flag == CALL_FUNCTION) { |
| 4602 call_wrapper.BeforeCall(CallSize(t9)); | 4601 call_wrapper.BeforeCall(CallSize(t9)); |
| 4603 Call(t9); | 4602 Call(t9); |
| 4604 call_wrapper.AfterCall(); | 4603 call_wrapper.AfterCall(); |
| 4605 } else { | 4604 } else { |
| 4606 DCHECK(flag == JUMP_FUNCTION); | 4605 DCHECK(flag == JUMP_FUNCTION); |
| 4607 Jump(t9); | 4606 Jump(t9); |
| 4608 } | 4607 } |
| 4609 } | 4608 } |
| 4610 | 4609 |
| 4611 | 4610 |
| 4612 void MacroAssembler::GetBuiltinFunction(Register target, | 4611 void MacroAssembler::GetBuiltinFunction(Register target, |
| 4613 Builtins::JavaScript id) { | 4612 int native_context_index) { |
| 4614 // Load the builtins object into target register. | 4613 // Load the builtins object into target register. |
| 4615 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 4614 lw(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
| 4616 lw(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 4615 lw(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); |
| 4617 // Load the JavaScript builtin function from the builtins object. | 4616 // Load the JavaScript builtin function from the builtins object. |
| 4618 lw(target, FieldMemOperand(target, | 4617 lw(target, ContextOperand(target, native_context_index)); |
| 4619 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | |
| 4620 } | 4618 } |
| 4621 | 4619 |
| 4622 | 4620 |
| 4623 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 4621 void MacroAssembler::GetBuiltinEntry(Register target, |
| 4622 int native_context_index) { |
| 4624 DCHECK(!target.is(a1)); | 4623 DCHECK(!target.is(a1)); |
| 4625 GetBuiltinFunction(a1, id); | 4624 GetBuiltinFunction(a1, native_context_index); |
| 4626 // Load the code entry point from the builtins object. | 4625 // Load the code entry point from the builtins object. |
| 4627 lw(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); | 4626 lw(target, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
| 4628 } | 4627 } |
| 4629 | 4628 |
| 4630 | 4629 |
| 4631 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 4630 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
| 4632 Register scratch1, Register scratch2) { | 4631 Register scratch1, Register scratch2) { |
| 4633 if (FLAG_native_code_counters && counter->Enabled()) { | 4632 if (FLAG_native_code_counters && counter->Enabled()) { |
| 4634 li(scratch1, Operand(value)); | 4633 li(scratch1, Operand(value)); |
| 4635 li(scratch2, Operand(ExternalReference(counter))); | 4634 li(scratch2, Operand(ExternalReference(counter))); |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6022 if (mag.shift > 0) sra(result, result, mag.shift); | 6021 if (mag.shift > 0) sra(result, result, mag.shift); |
| 6023 srl(at, dividend, 31); | 6022 srl(at, dividend, 31); |
| 6024 Addu(result, result, Operand(at)); | 6023 Addu(result, result, Operand(at)); |
| 6025 } | 6024 } |
| 6026 | 6025 |
| 6027 | 6026 |
| 6028 } // namespace internal | 6027 } // namespace internal |
| 6029 } // namespace v8 | 6028 } // namespace v8 |
| 6030 | 6029 |
| 6031 #endif // V8_TARGET_ARCH_MIPS | 6030 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |