Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 288213002: Refactor MacroAssembler::Prologue. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "v8.h" 7 #include "v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 4434 matching lines...) Expand 10 before | Expand all | Expand 10 after
4445 Label ok, fail; 4445 Label ok, fail;
4446 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, DO_SMI_CHECK); 4446 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, DO_SMI_CHECK);
4447 Branch(&ok); 4447 Branch(&ok);
4448 bind(&fail); 4448 bind(&fail);
4449 Abort(kGlobalFunctionsMustHaveInitialMap); 4449 Abort(kGlobalFunctionsMustHaveInitialMap);
4450 bind(&ok); 4450 bind(&ok);
4451 } 4451 }
4452 } 4452 }
4453 4453
4454 4454
4455 void MacroAssembler::Prologue(CompilationInfo* info) { 4455 void MacroAssembler::StubPrologue() {
4456 if (info->IsStub()) {
4457 Push(ra, fp, cp); 4456 Push(ra, fp, cp);
4458 Push(Smi::FromInt(StackFrame::STUB)); 4457 Push(Smi::FromInt(StackFrame::STUB));
4459 // Adjust FP to point to saved FP. 4458 // Adjust FP to point to saved FP.
4460 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 4459 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
4460 }
4461
4462
4463 void MacroAssembler::Prologue(bool code_pre_aging) {
4464 PredictableCodeSizeScope predictible_code_size_scope(
4465 this, kNoCodeAgeSequenceLength);
4466 // The following three instructions must remain together and unmodified
4467 // for code aging to work properly.
4468 if (code_pre_aging) {
4469 // Pre-age the code.
4470 Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
4471 nop(Assembler::CODE_AGE_MARKER_NOP);
4472 // Load the stub address to t9 and call it,
4473 // GetCodeAgeAndParity() extracts the stub address from this instruction.
4474 li(t9,
4475 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
4476 CONSTANT_SIZE);
4477 nop(); // Prevent jalr to jal optimization.
4478 jalr(t9, a0);
4479 nop(); // Branch delay slot nop.
4480 nop(); // Pad the empty space.
4461 } else { 4481 } else {
4462 PredictableCodeSizeScope predictible_code_size_scope( 4482 Push(ra, fp, cp, a1);
4463 this, kNoCodeAgeSequenceLength); 4483 nop(Assembler::CODE_AGE_SEQUENCE_NOP);
4464 // The following three instructions must remain together and unmodified 4484 // Adjust fp to point to caller's fp.
4465 // for code aging to work properly. 4485 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
4466 if (info->IsCodePreAgingActive()) {
4467 // Pre-age the code.
4468 Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
4469 nop(Assembler::CODE_AGE_MARKER_NOP);
4470 // Load the stub address to t9 and call it,
4471 // GetCodeAgeAndParity() extracts the stub address from this instruction.
4472 li(t9,
4473 Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
4474 CONSTANT_SIZE);
4475 nop(); // Prevent jalr to jal optimization.
4476 jalr(t9, a0);
4477 nop(); // Branch delay slot nop.
4478 nop(); // Pad the empty space.
4479 } else {
4480 Push(ra, fp, cp, a1);
4481 nop(Assembler::CODE_AGE_SEQUENCE_NOP);
4482 // Adjust fp to point to caller's fp.
4483 Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
4484 }
4485 } 4486 }
4486 } 4487 }
4487 4488
4488 4489
4489 void MacroAssembler::EnterFrame(StackFrame::Type type) { 4490 void MacroAssembler::EnterFrame(StackFrame::Type type) {
4490 addiu(sp, sp, -5 * kPointerSize); 4491 addiu(sp, sp, -5 * kPointerSize);
4491 li(t8, Operand(Smi::FromInt(type))); 4492 li(t8, Operand(Smi::FromInt(type)));
4492 li(t9, Operand(CodeObject()), CONSTANT_SIZE); 4493 li(t9, Operand(CodeObject()), CONSTANT_SIZE);
4493 sw(ra, MemOperand(sp, 4 * kPointerSize)); 4494 sw(ra, MemOperand(sp, 4 * kPointerSize));
4494 sw(fp, MemOperand(sp, 3 * kPointerSize)); 4495 sw(fp, MemOperand(sp, 3 * kPointerSize));
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
5741 } 5742 }
5742 if (ms.shift() > 0) sra(result, result, ms.shift()); 5743 if (ms.shift() > 0) sra(result, result, ms.shift());
5743 srl(at, dividend, 31); 5744 srl(at, dividend, 31);
5744 Addu(result, result, Operand(at)); 5745 Addu(result, result, Operand(at));
5745 } 5746 }
5746 5747
5747 5748
5748 } } // namespace v8::internal 5749 } } // namespace v8::internal
5749 5750
5750 #endif // V8_TARGET_ARCH_MIPS 5751 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698