| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 // Always emit a 'return undefined' in case control fell off the end of | 396 // Always emit a 'return undefined' in case control fell off the end of |
| 397 // the body. | 397 // the body. |
| 398 { | 398 { |
| 399 Comment cmnt(masm_, "[ return <undefined>;"); | 399 Comment cmnt(masm_, "[ return <undefined>;"); |
| 400 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | 400 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
| 401 } | 401 } |
| 402 EmitReturnSequence(); | 402 EmitReturnSequence(); |
| 403 |
| 404 if (HasStackOverflow()) { |
| 405 masm_->AbortConstantPoolBuilding(); |
| 406 } |
| 403 } | 407 } |
| 404 | 408 |
| 405 | 409 |
| 406 void FullCodeGenerator::ClearAccumulator() { | 410 void FullCodeGenerator::ClearAccumulator() { |
| 407 __ LoadSmiLiteral(r3, Smi::FromInt(0)); | 411 __ LoadSmiLiteral(r3, Smi::FromInt(0)); |
| 408 } | 412 } |
| 409 | 413 |
| 410 | 414 |
| 411 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 415 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
| 412 __ mov(r5, Operand(profiling_counter_)); | 416 __ mov(r5, Operand(profiling_counter_)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 433 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 437 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
| 434 Label ok; | 438 Label ok; |
| 435 | 439 |
| 436 DCHECK(back_edge_target->is_bound()); | 440 DCHECK(back_edge_target->is_bound()); |
| 437 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + | 441 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target) + |
| 438 kCodeSizeMultiplier / 2; | 442 kCodeSizeMultiplier / 2; |
| 439 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); | 443 int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
| 440 EmitProfilingCounterDecrement(weight); | 444 EmitProfilingCounterDecrement(weight); |
| 441 { | 445 { |
| 442 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 446 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 447 Assembler::BlockConstantPoolEntrySharingScope prevent_entry_sharing(masm_); |
| 443 // BackEdgeTable::PatchAt manipulates this sequence. | 448 // BackEdgeTable::PatchAt manipulates this sequence. |
| 444 __ cmpi(r6, Operand::Zero()); | 449 __ cmpi(r6, Operand::Zero()); |
| 445 __ bc_short(ge, &ok); | 450 __ bc_short(ge, &ok); |
| 446 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 451 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
| 447 | 452 |
| 448 // Record a mapping of this PC offset to the OSR id. This is used to find | 453 // Record a mapping of this PC offset to the OSR id. This is used to find |
| 449 // the AST id from the unoptimized code in order to use it as a key into | 454 // the AST id from the unoptimized code in order to use it as a key into |
| 450 // the deoptimization input data found in the optimized code. | 455 // the deoptimization input data found in the optimized code. |
| 451 RecordBackEdge(stmt->OsrEntryId()); | 456 RecordBackEdge(stmt->OsrEntryId()); |
| 452 } | 457 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 arg_count++; | 510 arg_count++; |
| 506 } | 511 } |
| 507 int32_t sp_delta = arg_count * kPointerSize; | 512 int32_t sp_delta = arg_count * kPointerSize; |
| 508 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 513 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| 509 __ RecordJSReturn(); | 514 __ RecordJSReturn(); |
| 510 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); | 515 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); |
| 511 #if V8_TARGET_ARCH_PPC64 | 516 #if V8_TARGET_ARCH_PPC64 |
| 512 // With 64bit we may need nop() instructions to ensure we have | 517 // With 64bit we may need nop() instructions to ensure we have |
| 513 // enough space to SetDebugBreakAtReturn() | 518 // enough space to SetDebugBreakAtReturn() |
| 514 if (is_int16(sp_delta)) { | 519 if (is_int16(sp_delta)) { |
| 515 masm_->nop(); | 520 if (!FLAG_enable_embedded_constant_pool) masm_->nop(); |
| 516 masm_->nop(); | 521 masm_->nop(); |
| 517 } | 522 } |
| 518 #endif | 523 #endif |
| 519 __ blr(); | 524 __ blr(); |
| 520 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 525 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 521 } | 526 } |
| 522 | 527 |
| 523 #ifdef DEBUG | 528 #ifdef DEBUG |
| 524 // Check that the size of the code used for returning is large enough | 529 // Check that the size of the code used for returning is large enough |
| 525 // for the debugger's requirements. | 530 // for the debugger's requirements. |
| (...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 __ SmiUntag(r6, SetRC); | 2315 __ SmiUntag(r6, SetRC); |
| 2311 | 2316 |
| 2312 // If we are sending a value and there is no operand stack, we can jump back | 2317 // If we are sending a value and there is no operand stack, we can jump back |
| 2313 // in directly. | 2318 // in directly. |
| 2314 Label call_resume; | 2319 Label call_resume; |
| 2315 if (resume_mode == JSGeneratorObject::NEXT) { | 2320 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2316 Label slow_resume; | 2321 Label slow_resume; |
| 2317 __ bne(&slow_resume, cr0); | 2322 __ bne(&slow_resume, cr0); |
| 2318 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); | 2323 __ LoadP(ip, FieldMemOperand(r7, JSFunction::kCodeEntryOffset)); |
| 2319 { | 2324 { |
| 2325 ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
| 2326 if (FLAG_enable_embedded_constant_pool) { |
| 2327 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(ip); |
| 2328 } |
| 2320 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); | 2329 __ LoadP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset)); |
| 2321 __ SmiUntag(r5); | 2330 __ SmiUntag(r5); |
| 2322 __ add(ip, ip, r5); | 2331 __ add(ip, ip, r5); |
| 2323 __ LoadSmiLiteral(r5, | 2332 __ LoadSmiLiteral(r5, |
| 2324 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); | 2333 Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)); |
| 2325 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), | 2334 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kContinuationOffset), |
| 2326 r0); | 2335 r0); |
| 2327 __ Jump(ip); | 2336 __ Jump(ip); |
| 2328 __ bind(&slow_resume); | 2337 __ bind(&slow_resume); |
| 2329 } | 2338 } |
| (...skipping 3225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5555 return ON_STACK_REPLACEMENT; | 5564 return ON_STACK_REPLACEMENT; |
| 5556 } | 5565 } |
| 5557 | 5566 |
| 5558 DCHECK(interrupt_address == | 5567 DCHECK(interrupt_address == |
| 5559 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5568 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5560 return OSR_AFTER_STACK_CHECK; | 5569 return OSR_AFTER_STACK_CHECK; |
| 5561 } | 5570 } |
| 5562 } // namespace internal | 5571 } // namespace internal |
| 5563 } // namespace v8 | 5572 } // namespace v8 |
| 5564 #endif // V8_TARGET_ARCH_PPC | 5573 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |