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 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // o fp: our caller's frame pointer | 106 // o fp: our caller's frame pointer |
107 // o sp: stack pointer | 107 // o sp: stack pointer |
108 // o ra: return address | 108 // o ra: return address |
109 // | 109 // |
110 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 110 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
111 // frames-mips.h for its layout. | 111 // frames-mips.h for its layout. |
112 void FullCodeGenerator::Generate() { | 112 void FullCodeGenerator::Generate() { |
113 CompilationInfo* info = info_; | 113 CompilationInfo* info = info_; |
114 profiling_counter_ = isolate()->factory()->NewCell( | 114 profiling_counter_ = isolate()->factory()->NewCell( |
115 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 115 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
116 SetFunctionPosition(function()); | 116 SetFunctionPosition(literal()); |
117 Comment cmnt(masm_, "[ function compiled by full code generator"); | 117 Comment cmnt(masm_, "[ function compiled by full code generator"); |
118 | 118 |
119 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 119 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
120 | 120 |
121 #ifdef DEBUG | 121 #ifdef DEBUG |
122 if (strlen(FLAG_stop_at) > 0 && | 122 if (strlen(FLAG_stop_at) > 0 && |
123 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 123 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
124 __ stop("stop-at"); | 124 __ stop("stop-at"); |
125 } | 125 } |
126 #endif | 126 #endif |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 __ li(a1, Operand(Smi::FromInt(num_parameters))); | 330 __ li(a1, Operand(Smi::FromInt(num_parameters))); |
331 __ Push(a3, a2, a1); | 331 __ Push(a3, a2, a1); |
332 | 332 |
333 // Arguments to ArgumentsAccessStub: | 333 // Arguments to ArgumentsAccessStub: |
334 // function, receiver address, parameter count. | 334 // function, receiver address, parameter count. |
335 // The stub will rewrite receiever and parameter count if the previous | 335 // The stub will rewrite receiever and parameter count if the previous |
336 // stack frame was an arguments adapter frame. | 336 // stack frame was an arguments adapter frame. |
337 ArgumentsAccessStub::Type type; | 337 ArgumentsAccessStub::Type type; |
338 if (is_strict(language_mode()) || !has_simple_parameters()) { | 338 if (is_strict(language_mode()) || !has_simple_parameters()) { |
339 type = ArgumentsAccessStub::NEW_STRICT; | 339 type = ArgumentsAccessStub::NEW_STRICT; |
340 } else if (function()->has_duplicate_parameters()) { | 340 } else if (literal()->has_duplicate_parameters()) { |
341 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 341 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
342 } else { | 342 } else { |
343 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 343 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
344 } | 344 } |
345 ArgumentsAccessStub stub(isolate(), type); | 345 ArgumentsAccessStub stub(isolate(), type); |
346 __ CallStub(&stub); | 346 __ CallStub(&stub); |
347 | 347 |
348 SetVar(arguments, v0, a1, a2); | 348 SetVar(arguments, v0, a1, a2); |
349 } | 349 } |
350 | 350 |
(...skipping 25 matching lines...) Expand all Loading... |
376 __ Branch(&ok, hs, sp, Operand(at)); | 376 __ Branch(&ok, hs, sp, Operand(at)); |
377 Handle<Code> stack_check = isolate()->builtins()->StackCheck(); | 377 Handle<Code> stack_check = isolate()->builtins()->StackCheck(); |
378 PredictableCodeSizeScope predictable(masm_, | 378 PredictableCodeSizeScope predictable(masm_, |
379 masm_->CallSize(stack_check, RelocInfo::CODE_TARGET)); | 379 masm_->CallSize(stack_check, RelocInfo::CODE_TARGET)); |
380 __ Call(stack_check, RelocInfo::CODE_TARGET); | 380 __ Call(stack_check, RelocInfo::CODE_TARGET); |
381 __ bind(&ok); | 381 __ bind(&ok); |
382 } | 382 } |
383 | 383 |
384 { Comment cmnt(masm_, "[ Body"); | 384 { Comment cmnt(masm_, "[ Body"); |
385 DCHECK(loop_depth() == 0); | 385 DCHECK(loop_depth() == 0); |
386 VisitStatements(function()->body()); | 386 VisitStatements(literal()->body()); |
387 DCHECK(loop_depth() == 0); | 387 DCHECK(loop_depth() == 0); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 // Always emit a 'return undefined' in case control fell off the end of | 391 // Always emit a 'return undefined' in case control fell off the end of |
392 // the body. | 392 // the body. |
393 { Comment cmnt(masm_, "[ return <undefined>;"); | 393 { Comment cmnt(masm_, "[ return <undefined>;"); |
394 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 394 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
395 } | 395 } |
396 EmitReturnSequence(); | 396 EmitReturnSequence(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 EmitProfilingCounterReset(); | 488 EmitProfilingCounterReset(); |
489 __ bind(&ok); | 489 __ bind(&ok); |
490 | 490 |
491 // Make sure that the constant pool is not emitted inside of the return | 491 // Make sure that the constant pool is not emitted inside of the return |
492 // sequence. | 492 // sequence. |
493 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 493 { Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
494 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 494 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
495 // tool from instrumenting as we rely on the code size here. | 495 // tool from instrumenting as we rely on the code size here. |
496 int32_t arg_count = info_->scope()->num_parameters() + 1; | 496 int32_t arg_count = info_->scope()->num_parameters() + 1; |
497 int32_t sp_delta = arg_count * kPointerSize; | 497 int32_t sp_delta = arg_count * kPointerSize; |
498 SetReturnPosition(function()); | 498 SetReturnPosition(literal()); |
499 masm_->mov(sp, fp); | 499 masm_->mov(sp, fp); |
500 int no_frame_start = masm_->pc_offset(); | 500 int no_frame_start = masm_->pc_offset(); |
501 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); | 501 masm_->MultiPop(static_cast<RegList>(fp.bit() | ra.bit())); |
502 masm_->Addu(sp, sp, Operand(sp_delta)); | 502 masm_->Addu(sp, sp, Operand(sp_delta)); |
503 masm_->Jump(ra); | 503 masm_->Jump(ra); |
504 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 504 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
505 } | 505 } |
506 } | 506 } |
507 } | 507 } |
508 | 508 |
(...skipping 4867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5376 reinterpret_cast<uint32_t>( | 5376 reinterpret_cast<uint32_t>( |
5377 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5377 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5378 return OSR_AFTER_STACK_CHECK; | 5378 return OSR_AFTER_STACK_CHECK; |
5379 } | 5379 } |
5380 | 5380 |
5381 | 5381 |
5382 } // namespace internal | 5382 } // namespace internal |
5383 } // namespace v8 | 5383 } // namespace v8 |
5384 | 5384 |
5385 #endif // V8_TARGET_ARCH_MIPS | 5385 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |