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 3956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3967 li(t9, Operand(target_int, rmode), CONSTANT_SIZE); | 3967 li(t9, Operand(target_int, rmode), CONSTANT_SIZE); |
3968 Call(t9, 0, cond, rs, rt, bd); | 3968 Call(t9, 0, cond, rs, rt, bd); |
3969 } | 3969 } |
3970 DCHECK_EQ(CallSize(target, rmode, cond, rs, rt, bd), | 3970 DCHECK_EQ(CallSize(target, rmode, cond, rs, rt, bd), |
3971 SizeOfCodeGeneratedSince(&start)); | 3971 SizeOfCodeGeneratedSince(&start)); |
3972 } | 3972 } |
3973 | 3973 |
3974 | 3974 |
3975 int MacroAssembler::CallSize(Handle<Code> code, | 3975 int MacroAssembler::CallSize(Handle<Code> code, |
3976 RelocInfo::Mode rmode, | 3976 RelocInfo::Mode rmode, |
3977 TypeFeedbackId ast_id, | |
3978 Condition cond, | 3977 Condition cond, |
3979 Register rs, | 3978 Register rs, |
3980 const Operand& rt, | 3979 const Operand& rt, |
3981 BranchDelaySlot bd) { | 3980 BranchDelaySlot bd) { |
3982 AllowDeferredHandleDereference using_raw_address; | 3981 AllowDeferredHandleDereference using_raw_address; |
3983 return CallSize(reinterpret_cast<Address>(code.location()), | 3982 return CallSize(reinterpret_cast<Address>(code.location()), |
3984 rmode, cond, rs, rt, bd); | 3983 rmode, cond, rs, rt, bd); |
3985 } | 3984 } |
3986 | 3985 |
3987 | 3986 |
3988 void MacroAssembler::Call(Handle<Code> code, | 3987 void MacroAssembler::Call(Handle<Code> code, |
3989 RelocInfo::Mode rmode, | 3988 RelocInfo::Mode rmode, |
3990 TypeFeedbackId ast_id, | |
3991 Condition cond, | 3989 Condition cond, |
3992 Register rs, | 3990 Register rs, |
3993 const Operand& rt, | 3991 const Operand& rt, |
3994 BranchDelaySlot bd) { | 3992 BranchDelaySlot bd) { |
3995 BlockTrampolinePoolScope block_trampoline_pool(this); | 3993 BlockTrampolinePoolScope block_trampoline_pool(this); |
3996 Label start; | 3994 Label start; |
3997 bind(&start); | 3995 bind(&start); |
3998 DCHECK(RelocInfo::IsCodeTarget(rmode)); | 3996 DCHECK(RelocInfo::IsCodeTarget(rmode)); |
3999 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | |
4000 SetRecordedAstId(ast_id); | |
4001 rmode = RelocInfo::CODE_TARGET_WITH_ID; | |
4002 } | |
4003 AllowDeferredHandleDereference embedding_raw_address; | 3997 AllowDeferredHandleDereference embedding_raw_address; |
4004 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); | 3998 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); |
4005 DCHECK_EQ(CallSize(code, rmode, ast_id, cond, rs, rt, bd), | 3999 DCHECK_EQ(CallSize(code, rmode, ast_id, cond, rs, rt, bd), |
4006 SizeOfCodeGeneratedSince(&start)); | 4000 SizeOfCodeGeneratedSince(&start)); |
4007 } | 4001 } |
4008 | 4002 |
4009 | 4003 |
4010 void MacroAssembler::Ret(Condition cond, | 4004 void MacroAssembler::Ret(Condition cond, |
4011 Register rs, | 4005 Register rs, |
4012 const Operand& rt, | 4006 const Operand& rt, |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4998 Register type_reg) { | 4992 Register type_reg) { |
4999 lw(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 4993 lw(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
5000 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 4994 lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
5001 } | 4995 } |
5002 | 4996 |
5003 | 4997 |
5004 // ----------------------------------------------------------------------------- | 4998 // ----------------------------------------------------------------------------- |
5005 // Runtime calls. | 4999 // Runtime calls. |
5006 | 5000 |
5007 void MacroAssembler::CallStub(CodeStub* stub, | 5001 void MacroAssembler::CallStub(CodeStub* stub, |
5008 TypeFeedbackId ast_id, | |
5009 Condition cond, | 5002 Condition cond, |
5010 Register r1, | 5003 Register r1, |
5011 const Operand& r2, | 5004 const Operand& r2, |
5012 BranchDelaySlot bd) { | 5005 BranchDelaySlot bd) { |
5013 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 5006 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
5014 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, | 5007 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); |
5015 cond, r1, r2, bd); | |
5016 } | 5008 } |
5017 | 5009 |
5018 | 5010 |
5019 void MacroAssembler::TailCallStub(CodeStub* stub, | 5011 void MacroAssembler::TailCallStub(CodeStub* stub, |
5020 Condition cond, | 5012 Condition cond, |
5021 Register r1, | 5013 Register r1, |
5022 const Operand& r2, | 5014 const Operand& r2, |
5023 BranchDelaySlot bd) { | 5015 BranchDelaySlot bd) { |
5024 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); | 5016 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); |
5025 } | 5017 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5339 // expectation. | 5331 // expectation. |
5340 CHECK(f->nargs < 0 || f->nargs == num_arguments); | 5332 CHECK(f->nargs < 0 || f->nargs == num_arguments); |
5341 | 5333 |
5342 // TODO(1236192): Most runtime routines don't need the number of | 5334 // TODO(1236192): Most runtime routines don't need the number of |
5343 // arguments passed in because it is constant. At some point we | 5335 // arguments passed in because it is constant. At some point we |
5344 // should remove this need and make the runtime routine entry code | 5336 // should remove this need and make the runtime routine entry code |
5345 // smarter. | 5337 // smarter. |
5346 PrepareCEntryArgs(num_arguments); | 5338 PrepareCEntryArgs(num_arguments); |
5347 PrepareCEntryFunction(ExternalReference(f, isolate())); | 5339 PrepareCEntryFunction(ExternalReference(f, isolate())); |
5348 CEntryStub stub(isolate(), 1, save_doubles); | 5340 CEntryStub stub(isolate(), 1, save_doubles); |
5349 CallStub(&stub, TypeFeedbackId::None(), al, zero_reg, Operand(zero_reg), bd); | 5341 CallStub(&stub, al, zero_reg, Operand(zero_reg), bd); |
5350 } | 5342 } |
5351 | 5343 |
5352 | 5344 |
5353 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 5345 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
5354 int num_arguments, | 5346 int num_arguments, |
5355 BranchDelaySlot bd) { | 5347 BranchDelaySlot bd) { |
5356 PrepareCEntryArgs(num_arguments); | 5348 PrepareCEntryArgs(num_arguments); |
5357 PrepareCEntryFunction(ext); | 5349 PrepareCEntryFunction(ext); |
5358 | 5350 |
5359 CEntryStub stub(isolate(), 1); | 5351 CEntryStub stub(isolate(), 1); |
5360 CallStub(&stub, TypeFeedbackId::None(), al, zero_reg, Operand(zero_reg), bd); | 5352 CallStub(&stub, al, zero_reg, Operand(zero_reg), bd); |
5361 } | 5353 } |
5362 | 5354 |
5363 | 5355 |
5364 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 5356 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
5365 const Runtime::Function* function = Runtime::FunctionForId(fid); | 5357 const Runtime::Function* function = Runtime::FunctionForId(fid); |
5366 DCHECK_EQ(1, function->result_size); | 5358 DCHECK_EQ(1, function->result_size); |
5367 if (function->nargs >= 0) { | 5359 if (function->nargs >= 0) { |
5368 PrepareCEntryArgs(function->nargs); | 5360 PrepareCEntryArgs(function->nargs); |
5369 } | 5361 } |
5370 JumpToExternalReference(ExternalReference(fid, isolate())); | 5362 JumpToExternalReference(ExternalReference(fid, isolate())); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6718 if (mag.shift > 0) sra(result, result, mag.shift); | 6710 if (mag.shift > 0) sra(result, result, mag.shift); |
6719 srl(at, dividend, 31); | 6711 srl(at, dividend, 31); |
6720 Addu(result, result, Operand(at)); | 6712 Addu(result, result, Operand(at)); |
6721 } | 6713 } |
6722 | 6714 |
6723 | 6715 |
6724 } // namespace internal | 6716 } // namespace internal |
6725 } // namespace v8 | 6717 } // namespace v8 |
6726 | 6718 |
6727 #endif // V8_TARGET_ARCH_MIPS | 6719 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |