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 4307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4318 int64_t target_int = reinterpret_cast<int64_t>(target); | 4318 int64_t target_int = reinterpret_cast<int64_t>(target); |
4319 li(t9, Operand(target_int, rmode), ADDRESS_LOAD); | 4319 li(t9, Operand(target_int, rmode), ADDRESS_LOAD); |
4320 Call(t9, cond, rs, rt, bd); | 4320 Call(t9, cond, rs, rt, bd); |
4321 DCHECK_EQ(CallSize(target, rmode, cond, rs, rt, bd), | 4321 DCHECK_EQ(CallSize(target, rmode, cond, rs, rt, bd), |
4322 SizeOfCodeGeneratedSince(&start)); | 4322 SizeOfCodeGeneratedSince(&start)); |
4323 } | 4323 } |
4324 | 4324 |
4325 | 4325 |
4326 int MacroAssembler::CallSize(Handle<Code> code, | 4326 int MacroAssembler::CallSize(Handle<Code> code, |
4327 RelocInfo::Mode rmode, | 4327 RelocInfo::Mode rmode, |
4328 TypeFeedbackId ast_id, | |
4329 Condition cond, | 4328 Condition cond, |
4330 Register rs, | 4329 Register rs, |
4331 const Operand& rt, | 4330 const Operand& rt, |
4332 BranchDelaySlot bd) { | 4331 BranchDelaySlot bd) { |
4333 AllowDeferredHandleDereference using_raw_address; | 4332 AllowDeferredHandleDereference using_raw_address; |
4334 return CallSize(reinterpret_cast<Address>(code.location()), | 4333 return CallSize(reinterpret_cast<Address>(code.location()), |
4335 rmode, cond, rs, rt, bd); | 4334 rmode, cond, rs, rt, bd); |
4336 } | 4335 } |
4337 | 4336 |
4338 | 4337 |
4339 void MacroAssembler::Call(Handle<Code> code, | 4338 void MacroAssembler::Call(Handle<Code> code, |
4340 RelocInfo::Mode rmode, | 4339 RelocInfo::Mode rmode, |
4341 TypeFeedbackId ast_id, | |
4342 Condition cond, | 4340 Condition cond, |
4343 Register rs, | 4341 Register rs, |
4344 const Operand& rt, | 4342 const Operand& rt, |
4345 BranchDelaySlot bd) { | 4343 BranchDelaySlot bd) { |
4346 BlockTrampolinePoolScope block_trampoline_pool(this); | 4344 BlockTrampolinePoolScope block_trampoline_pool(this); |
4347 Label start; | 4345 Label start; |
4348 bind(&start); | 4346 bind(&start); |
4349 DCHECK(RelocInfo::IsCodeTarget(rmode)); | 4347 DCHECK(RelocInfo::IsCodeTarget(rmode)); |
4350 if (rmode == RelocInfo::CODE_TARGET && !ast_id.IsNone()) { | |
4351 SetRecordedAstId(ast_id); | |
4352 rmode = RelocInfo::CODE_TARGET_WITH_ID; | |
4353 } | |
4354 AllowDeferredHandleDereference embedding_raw_address; | 4348 AllowDeferredHandleDereference embedding_raw_address; |
4355 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); | 4349 Call(reinterpret_cast<Address>(code.location()), rmode, cond, rs, rt, bd); |
4356 DCHECK_EQ(CallSize(code, rmode, ast_id, cond, rs, rt, bd), | 4350 DCHECK_EQ(CallSize(code, rmode, cond, rs, rt, bd), |
4357 SizeOfCodeGeneratedSince(&start)); | 4351 SizeOfCodeGeneratedSince(&start)); |
4358 } | 4352 } |
4359 | 4353 |
4360 | 4354 |
4361 void MacroAssembler::Ret(Condition cond, | 4355 void MacroAssembler::Ret(Condition cond, |
4362 Register rs, | 4356 Register rs, |
4363 const Operand& rt, | 4357 const Operand& rt, |
4364 BranchDelaySlot bd) { | 4358 BranchDelaySlot bd) { |
4365 Jump(ra, cond, rs, rt, bd); | 4359 Jump(ra, cond, rs, rt, bd); |
4366 } | 4360 } |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5368 Register type_reg) { | 5362 Register type_reg) { |
5369 Ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 5363 Ld(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
5370 Lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 5364 Lbu(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
5371 } | 5365 } |
5372 | 5366 |
5373 | 5367 |
5374 // ----------------------------------------------------------------------------- | 5368 // ----------------------------------------------------------------------------- |
5375 // Runtime calls. | 5369 // Runtime calls. |
5376 | 5370 |
5377 void MacroAssembler::CallStub(CodeStub* stub, | 5371 void MacroAssembler::CallStub(CodeStub* stub, |
5378 TypeFeedbackId ast_id, | |
5379 Condition cond, | 5372 Condition cond, |
5380 Register r1, | 5373 Register r1, |
5381 const Operand& r2, | 5374 const Operand& r2, |
5382 BranchDelaySlot bd) { | 5375 BranchDelaySlot bd) { |
5383 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. | 5376 DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. |
5384 Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id, | 5377 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); |
5385 cond, r1, r2, bd); | |
5386 } | 5378 } |
5387 | 5379 |
5388 | 5380 |
5389 void MacroAssembler::TailCallStub(CodeStub* stub, | 5381 void MacroAssembler::TailCallStub(CodeStub* stub, |
5390 Condition cond, | 5382 Condition cond, |
5391 Register r1, | 5383 Register r1, |
5392 const Operand& r2, | 5384 const Operand& r2, |
5393 BranchDelaySlot bd) { | 5385 BranchDelaySlot bd) { |
5394 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); | 5386 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd); |
5395 } | 5387 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5860 // expectation. | 5852 // expectation. |
5861 CHECK(f->nargs < 0 || f->nargs == num_arguments); | 5853 CHECK(f->nargs < 0 || f->nargs == num_arguments); |
5862 | 5854 |
5863 // TODO(1236192): Most runtime routines don't need the number of | 5855 // TODO(1236192): Most runtime routines don't need the number of |
5864 // arguments passed in because it is constant. At some point we | 5856 // arguments passed in because it is constant. At some point we |
5865 // should remove this need and make the runtime routine entry code | 5857 // should remove this need and make the runtime routine entry code |
5866 // smarter. | 5858 // smarter. |
5867 PrepareCEntryArgs(num_arguments); | 5859 PrepareCEntryArgs(num_arguments); |
5868 PrepareCEntryFunction(ExternalReference(f, isolate())); | 5860 PrepareCEntryFunction(ExternalReference(f, isolate())); |
5869 CEntryStub stub(isolate(), 1, save_doubles); | 5861 CEntryStub stub(isolate(), 1, save_doubles); |
5870 CallStub(&stub, TypeFeedbackId::None(), al, zero_reg, Operand(zero_reg), bd); | 5862 CallStub(&stub, al, zero_reg, Operand(zero_reg), bd); |
5871 } | 5863 } |
5872 | 5864 |
5873 | 5865 |
5874 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 5866 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
5875 int num_arguments, | 5867 int num_arguments, |
5876 BranchDelaySlot bd) { | 5868 BranchDelaySlot bd) { |
5877 PrepareCEntryArgs(num_arguments); | 5869 PrepareCEntryArgs(num_arguments); |
5878 PrepareCEntryFunction(ext); | 5870 PrepareCEntryFunction(ext); |
5879 | 5871 |
5880 CEntryStub stub(isolate(), 1); | 5872 CEntryStub stub(isolate(), 1); |
5881 CallStub(&stub, TypeFeedbackId::None(), al, zero_reg, Operand(zero_reg), bd); | 5873 CallStub(&stub, al, zero_reg, Operand(zero_reg), bd); |
5882 } | 5874 } |
5883 | 5875 |
5884 | 5876 |
5885 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 5877 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
5886 const Runtime::Function* function = Runtime::FunctionForId(fid); | 5878 const Runtime::Function* function = Runtime::FunctionForId(fid); |
5887 DCHECK_EQ(1, function->result_size); | 5879 DCHECK_EQ(1, function->result_size); |
5888 if (function->nargs >= 0) { | 5880 if (function->nargs >= 0) { |
5889 PrepareCEntryArgs(function->nargs); | 5881 PrepareCEntryArgs(function->nargs); |
5890 } | 5882 } |
5891 JumpToExternalReference(ExternalReference(fid, isolate())); | 5883 JumpToExternalReference(ExternalReference(fid, isolate())); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7290 if (mag.shift > 0) sra(result, result, mag.shift); | 7282 if (mag.shift > 0) sra(result, result, mag.shift); |
7291 srl(at, dividend, 31); | 7283 srl(at, dividend, 31); |
7292 Addu(result, result, Operand(at)); | 7284 Addu(result, result, Operand(at)); |
7293 } | 7285 } |
7294 | 7286 |
7295 | 7287 |
7296 } // namespace internal | 7288 } // namespace internal |
7297 } // namespace v8 | 7289 } // namespace v8 |
7298 | 7290 |
7299 #endif // V8_TARGET_ARCH_MIPS64 | 7291 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |