| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 415 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 416 Label ok; | 416 Label ok; |
| 417 | 417 |
| 418 DCHECK(back_edge_target->is_bound()); | 418 DCHECK(back_edge_target->is_bound()); |
| 419 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + | 419 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + |
| 420 kCodeSizeMultiplier / 2; | 420 kCodeSizeMultiplier / 2; |
| 421 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); | 421 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
| 422 EmitProfilingCounterDecrement(weight); | 422 EmitProfilingCounterDecrement(weight); |
| 423 { | 423 { |
| 424 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 424 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 425 Assembler::BlockConstantPoolEntrySharingScope prevent_entry_sharing(masm_); |
| 425 // BackEdgeTable::PatchAt manipulates this sequence. | 426 // BackEdgeTable::PatchAt manipulates this sequence. |
| 426 __ cmpi(r6, Operand::Zero()); | 427 __ cmpi(r6, Operand::Zero()); |
| 427 __ bc_short(ge, &ok); | 428 __ bc_short(ge, &ok); |
| 428 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 429 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 429 | 430 |
| 430 // Record a mapping of this PC offset to the OSR id. This is used to find | 431 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 431 // the AST id from the unoptimized code in order to use it as a key into | 432 // the AST id from the unoptimized code in order to use it as a key into |
| 432 // the deoptimization input data found in the optimized code. | 433 // the deoptimization input data found in the optimized code. |
| 433 RecordBackEdge(stmt->OsrEntryId()); | 434 RecordBackEdge(stmt->OsrEntryId()); |
| 434 } | 435 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 arg_count++; | 488 arg_count++; |
| 488 } | 489 } |
| 489 int32_t sp_delta = arg_count * kPointerSize; | 490 int32_t sp_delta = arg_count * kPointerSize; |
| 490 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 491 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| 491 __ RecordJSReturn(); | 492 __ RecordJSReturn(); |
| 492 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); | 493 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); |
| 493 #if V8_TARGET_ARCH_PPC64 | 494 #if V8_TARGET_ARCH_PPC64 |
| 494 // With 64bit we may need nop() instructions to ensure we have | 495 // With 64bit we may need nop() instructions to ensure we have |
| 495 // enough space to SetDebugBreakAtReturn() | 496 // enough space to SetDebugBreakAtReturn() |
| 496 if (is_int16(sp_delta)) { | 497 if (is_int16(sp_delta)) { |
| 497 masm_->nop(); | 498 if (!FLAG_enable_embedded_constant_pool) masm_->nop(); |
| 498 masm_->nop(); | 499 masm_->nop(); |
| 499 } | 500 } |
| 500 #endif | 501 #endif |
| 501 __ blr(); | 502 __ blr(); |
| 502 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 503 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 503 } | 504 } |
| 504 | 505 |
| 505 #ifdef DEBUG | 506 #ifdef DEBUG |
| 506 // Check that the size of the code used for returning is large enough | 507 // Check that the size of the code used for returning is large enough |
| 507 // for the debugger's requirements. | 508 // for the debugger's requirements. |
| (...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 __ SmiUntag(r6, SetRC); | 2291 __ SmiUntag(r6, SetRC); |
| 2291 | 2292 |
| 2292 // If we are sending a value and there is no operand stack, we can jump back | 2293 // If we are sending a value and there is no operand stack, we can jump back |
| 2293 // in directly. | 2294 // in directly. |
| 2294 Label call_resume; | 2295 Label call_resume; |
| 2295 if (resume_mode == JSGeneratorObject::NEXT) { | 2296 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2296 Label slow_resume; | 2297 Label slow_resume; |
| 2297 __ bne(&slow_resume, cr0); | 2298 __ bne(&slow_resume, cr0); |
| 2298 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); | 2299 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); |
| 2299 { | 2300 { |
| 2301 ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
| 2302 if (FLAG_enable_embedded_constant_pool) { |
| 2303 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(ip); |
| 2304 } |
| 2300 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); | 2305 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); |
| 2301 __ SmiUntag(r5); | 2306 __ SmiUntag(r5); |
| 2302 __ add(ip, ip, r5); | 2307 __ add(ip, ip, r5); |
| 2303 __ LoadSmiLiteral(r5, | 2308 __ LoadSmiLiteral(r5, |
| 2304 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | 2309 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
| 2305 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), | 2310 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), |
| 2306 r0); | 2311 r0); |
| 2307 __ Jump(ip); | 2312 __ Jump(ip); |
| 2308 __ bind(&slow_resume); | 2313 __ bind(&slow_resume); |
| 2309 } | 2314 } |
| (...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5516 return ON_STACK_REPLACEMENT; | 5521 return ON_STACK_REPLACEMENT; |
| 5517 } | 5522 } |
| 5518 | 5523 |
| 5519 DCHECK(interrupt_address == | 5524 DCHECK(interrupt_address == |
| 5520 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5525 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5521 return OSR_AFTER_STACK_CHECK; | 5526 return OSR_AFTER_STACK_CHECK; |
| 5522 } | 5527 } |
| 5523 } // namespace internal | 5528 } // namespace internal |
| 5524 } // namespace v8 | 5529 } // namespace v8 |
| 5525 #endif // V8_TARGET_ARCH_PPC | 5530 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |