| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 395 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 396 Label ok; | 396 Label ok; |
| 397 | 397 |
| 398 DCHECK(back_edge_target->is_bound()); | 398 DCHECK(back_edge_target->is_bound()); |
| 399 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + | 399 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + |
| 400 kCodeSizeMultiplier / 2; | 400 kCodeSizeMultiplier / 2; |
| 401 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); | 401 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
| 402 EmitProfilingCounterDecrement(weight); | 402 EmitProfilingCounterDecrement(weight); |
| 403 { | 403 { |
| 404 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 404 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 405 Assembler::BlockConstantPoolEntrySharingScope prevent_entry_sharing(masm_); |
| 405 // BackEdgeTable::PatchAt manipulates this sequence. | 406 // BackEdgeTable::PatchAt manipulates this sequence. |
| 406 __ cmpi(r6, Operand::Zero()); | 407 __ cmpi(r6, Operand::Zero()); |
| 407 __ bc_short(ge, &ok); | 408 __ bc_short(ge, &ok); |
| 408 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 409 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 409 | 410 |
| 410 // Record a mapping of this PC offset to the OSR id. This is used to find | 411 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 411 // the AST id from the unoptimized code in order to use it as a key into | 412 // the AST id from the unoptimized code in order to use it as a key into |
| 412 // the deoptimization input data found in the optimized code. | 413 // the deoptimization input data found in the optimized code. |
| 413 RecordBackEdge(stmt->OsrEntryId()); | 414 RecordBackEdge(stmt->OsrEntryId()); |
| 414 } | 415 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 arg_count++; | 468 arg_count++; |
| 468 } | 469 } |
| 469 int32_t sp_delta = arg_count * kPointerSize; | 470 int32_t sp_delta = arg_count * kPointerSize; |
| 470 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 471 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| 471 __ RecordJSReturn(); | 472 __ RecordJSReturn(); |
| 472 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); | 473 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); |
| 473 #if V8_TARGET_ARCH_PPC64 | 474 #if V8_TARGET_ARCH_PPC64 |
| 474 // With 64bit we may need nop() instructions to ensure we have | 475 // With 64bit we may need nop() instructions to ensure we have |
| 475 // enough space to SetDebugBreakAtReturn() | 476 // enough space to SetDebugBreakAtReturn() |
| 476 if (is_int16(sp_delta)) { | 477 if (is_int16(sp_delta)) { |
| 477 masm_->nop(); | 478 if (!FLAG_enable_embedded_constant_pool) masm_->nop(); |
| 478 masm_->nop(); | 479 masm_->nop(); |
| 479 } | 480 } |
| 480 #endif | 481 #endif |
| 481 __ blr(); | 482 __ blr(); |
| 482 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 483 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 483 } | 484 } |
| 484 | 485 |
| 485 #ifdef DEBUG | 486 #ifdef DEBUG |
| 486 // Check that the size of the code used for returning is large enough | 487 // Check that the size of the code used for returning is large enough |
| 487 // for the debugger's requirements. | 488 // for the debugger's requirements. |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 __ SmiUntag(r6, SetRC); | 2257 __ SmiUntag(r6, SetRC); |
| 2257 | 2258 |
| 2258 // If we are sending a value and there is no operand stack, we can jump back | 2259 // If we are sending a value and there is no operand stack, we can jump back |
| 2259 // in directly. | 2260 // in directly. |
| 2260 Label call_resume; | 2261 Label call_resume; |
| 2261 if (resume_mode == JSGeneratorObject::NEXT) { | 2262 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2262 Label slow_resume; | 2263 Label slow_resume; |
| 2263 __ bne(&slow_resume, cr0); | 2264 __ bne(&slow_resume, cr0); |
| 2264 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); | 2265 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); |
| 2265 { | 2266 { |
| 2267 ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
| 2268 if (FLAG_enable_embedded_constant_pool) { |
| 2269 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(ip); |
| 2270 } |
| 2266 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); | 2271 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); |
| 2267 __ SmiUntag(r5); | 2272 __ SmiUntag(r5); |
| 2268 __ add(ip, ip, r5); | 2273 __ add(ip, ip, r5); |
| 2269 __ LoadSmiLiteral(r5, | 2274 __ LoadSmiLiteral(r5, |
| 2270 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | 2275 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
| 2271 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), | 2276 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), |
| 2272 r0); | 2277 r0); |
| 2273 __ Jump(ip); | 2278 __ Jump(ip); |
| 2274 __ bind(&slow_resume); | 2279 __ bind(&slow_resume); |
| 2275 } | 2280 } |
| (...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5451 return ON_STACK_REPLACEMENT; | 5456 return ON_STACK_REPLACEMENT; |
| 5452 } | 5457 } |
| 5453 | 5458 |
| 5454 DCHECK(interrupt_address == | 5459 DCHECK(interrupt_address == |
| 5455 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5460 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5456 return OSR_AFTER_STACK_CHECK; | 5461 return OSR_AFTER_STACK_CHECK; |
| 5457 } | 5462 } |
| 5458 } | 5463 } |
| 5459 } // namespace v8::internal | 5464 } // namespace v8::internal |
| 5460 #endif // V8_TARGET_ARCH_PPC | 5465 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |