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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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/mips/code-stubs-mips.h" | 24 #include "src/mips/code-stubs-mips.h" |
26 #include "src/mips/macro-assembler-mips.h" | 25 #include "src/mips/macro-assembler-mips.h" |
27 | 26 |
28 namespace v8 { | 27 namespace v8 { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 __ bind(&ok); | 142 __ bind(&ok); |
144 } | 143 } |
145 | 144 |
146 // Open a frame scope to indicate that there is a frame on the stack. The | 145 // Open a frame scope to indicate that there is a frame on the stack. The |
147 // MANUAL indicates that the scope shouldn't actually generate code to set up | 146 // MANUAL indicates that the scope shouldn't actually generate code to set up |
148 // the frame (that is done below). | 147 // the frame (that is done below). |
149 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 148 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
150 | 149 |
151 info->set_prologue_offset(masm_->pc_offset()); | 150 info->set_prologue_offset(masm_->pc_offset()); |
152 __ Prologue(info->IsCodePreAgingActive()); | 151 __ Prologue(info->IsCodePreAgingActive()); |
153 info->AddNoFrameRange(0, masm_->pc_offset()); | |
154 | 152 |
155 { Comment cmnt(masm_, "[ Allocate locals"); | 153 { Comment cmnt(masm_, "[ Allocate locals"); |
156 int locals_count = info->scope()->num_stack_slots(); | 154 int locals_count = info->scope()->num_stack_slots(); |
157 // Generators allocate locals, if any, in context slots. | 155 // Generators allocate locals, if any, in context slots. |
158 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); | 156 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); |
159 if (locals_count > 0) { | 157 if (locals_count > 0) { |
160 if (locals_count >= 128) { | 158 if (locals_count >= 128) { |
161 Label ok; | 159 Label ok; |
162 __ Subu(t5, sp, Operand(locals_count * kPointerSize)); | 160 __ Subu(t5, sp, Operand(locals_count * kPointerSize)); |
163 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 161 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 465 |
468 // Make sure that the constant pool is not emitted inside of the return | 466 // Make sure that the constant pool is not emitted inside of the return |
469 // sequence. | 467 // sequence. |
470 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 468 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
471 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 469 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
472 // tool from instrumenting as we rely on the code size here. | 470 // tool from instrumenting as we rely on the code size here. |
473 int32_t arg_count = info_->scope()->num_parameters() + 1; | 471 int32_t arg_count = info_->scope()->num_parameters() + 1; |
474 int32_t sp_delta = arg_count * kPointerSize; | 472 int32_t sp_delta = arg_count * kPointerSize; |
475 SetReturnPosition(literal()); | 473 SetReturnPosition(literal()); |
476 masm_->mov(sp, fp); | 474 masm_->mov(sp, fp); |
477 int no_frame_start = masm_->pc_offset(); | |
478 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); | 475 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); |
479 masm_->Addu(sp, sp, Operand(sp_delta)); | 476 masm_->Addu(sp, sp, Operand(sp_delta)); |
480 masm_->Jump(ra); | 477 masm_->Jump(ra); |
481 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | |
482 } | 478 } |
483 } | 479 } |
484 } | 480 } |
485 | 481 |
486 | 482 |
487 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { | 483 void FullCodeGenerator::StackValueContext::Plug(Variable* var) const { |
488 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 484 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
489 codegen()->GetVar(result_register(), var); | 485 codegen()->GetVar(result_register(), var); |
490 __ push(result_register()); | 486 __ push(result_register()); |
491 } | 487 } |
(...skipping 4747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5239 reinterpret_cast<uint32_t>( | 5235 reinterpret_cast<uint32_t>( |
5240 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5236 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5241 return OSR_AFTER_STACK_CHECK; | 5237 return OSR_AFTER_STACK_CHECK; |
5242 } | 5238 } |
5243 | 5239 |
5244 | 5240 |
5245 } // namespace internal | 5241 } // namespace internal |
5246 } // namespace v8 | 5242 } // namespace v8 |
5247 | 5243 |
5248 #endif // V8_TARGET_ARCH_MIPS | 5244 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |