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 #if V8_TARGET_ARCH_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
11 // parameter to a function is defined to be 'a0'. So there are many | 11 // parameter to a function is defined to be 'a0'. So there are many |
12 // places where we have to move a previous result in v0 to a0 for the | 12 // places where we have to move a previous result in v0 to a0 for the |
13 // next call: mov(a0, v0). This is not needed on the other architectures. | 13 // next call: mov(a0, v0). This is not needed on the other architectures. |
14 | 14 |
15 #include "src/code-factory.h" | 15 #include "src/code-factory.h" |
16 #include "src/code-stubs.h" | 16 #include "src/code-stubs.h" |
17 #include "src/codegen.h" | 17 #include "src/codegen.h" |
18 #include "src/compiler.h" | |
19 #include "src/debug/debug.h" | 18 #include "src/debug/debug.h" |
20 #include "src/full-codegen/full-codegen.h" | 19 #include "src/full-codegen/full-codegen.h" |
21 #include "src/ic/ic.h" | 20 #include "src/ic/ic.h" |
22 #include "src/parser.h" | 21 #include "src/parser.h" |
23 #include "src/scopes.h" | 22 #include "src/scopes.h" |
24 | 23 |
25 #include "src/mips64/code-stubs-mips64.h" | 24 #include "src/mips64/code-stubs-mips64.h" |
26 #include "src/mips64/macro-assembler-mips64.h" | 25 #include "src/mips64/macro-assembler-mips64.h" |
27 | 26 |
28 namespace v8 { | 27 namespace v8 { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 139 |
141 __ sd(a2, MemOperand(sp, receiver_offset)); | 140 __ sd(a2, MemOperand(sp, receiver_offset)); |
142 __ bind(&ok); | 141 __ bind(&ok); |
143 } | 142 } |
144 // Open a frame scope to indicate that there is a frame on the stack. The | 143 // Open a frame scope to indicate that there is a frame on the stack. The |
145 // MANUAL indicates that the scope shouldn't actually generate code to set up | 144 // MANUAL indicates that the scope shouldn't actually generate code to set up |
146 // the frame (that is done below). | 145 // the frame (that is done below). |
147 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 146 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
148 info->set_prologue_offset(masm_->pc_offset()); | 147 info->set_prologue_offset(masm_->pc_offset()); |
149 __ Prologue(info->IsCodePreAgingActive()); | 148 __ Prologue(info->IsCodePreAgingActive()); |
150 info->AddNoFrameRange(0, masm_->pc_offset()); | |
151 | 149 |
152 { Comment cmnt(masm_, "[ Allocate locals"); | 150 { Comment cmnt(masm_, "[ Allocate locals"); |
153 int locals_count = info->scope()->num_stack_slots(); | 151 int locals_count = info->scope()->num_stack_slots(); |
154 // Generators allocate locals, if any, in context slots. | 152 // Generators allocate locals, if any, in context slots. |
155 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); | 153 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); |
156 if (locals_count > 0) { | 154 if (locals_count > 0) { |
157 if (locals_count >= 128) { | 155 if (locals_count >= 128) { |
158 Label ok; | 156 Label ok; |
159 __ Dsubu(t1, sp, Operand(locals_count * kPointerSize)); | 157 __ Dsubu(t1, sp, Operand(locals_count * kPointerSize)); |
160 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 158 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 463 |
466 // Make sure that the constant pool is not emitted inside of the return | 464 // Make sure that the constant pool is not emitted inside of the return |
467 // sequence. | 465 // sequence. |
468 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 466 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
469 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 467 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
470 // tool from instrumenting as we rely on the code size here. | 468 // tool from instrumenting as we rely on the code size here. |
471 int32_t arg_count = info_->scope()->num_parameters() + 1; | 469 int32_t arg_count = info_->scope()->num_parameters() + 1; |
472 int32_t sp_delta = arg_count * kPointerSize; | 470 int32_t sp_delta = arg_count * kPointerSize; |
473 SetReturnPosition(literal()); | 471 SetReturnPosition(literal()); |
474 masm_->mov(sp, fp); | 472 masm_->mov(sp, fp); |
475 int no_frame_start = masm_->pc_offset(); | |
476 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); | 473 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); |
477 masm_->Daddu(sp, sp, Operand(sp_delta)); | 474 masm_->Daddu(sp, sp, Operand(sp_delta)); |
478 masm_->Jump(ra); | 475 masm_->Jump(ra); |
479 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | |
480 } | 476 } |
481 } | 477 } |
482 } | 478 } |
483 | 479 |
484 | 480 |
485 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { | 481 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { |
486 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 482 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
487 codegen()->GetVar(result_register(), var); | 483 codegen()->GetVar(result_register(), var); |
488 __ push(result_register()); | 484 __ push(result_register()); |
489 } | 485 } |
(...skipping 4755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5245 reinterpret_cast<uint64_t>( | 5241 reinterpret_cast<uint64_t>( |
5246 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5242 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5247 return OSR_AFTER_STACK_CHECK; | 5243 return OSR_AFTER_STACK_CHECK; |
5248 } | 5244 } |
5249 | 5245 |
5250 | 5246 |
5251 } // namespace internal | 5247 } // namespace internal |
5252 } // namespace v8 | 5248 } // namespace v8 |
5253 | 5249 |
5254 #endif // V8_TARGET_ARCH_MIPS64 | 5250 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |