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