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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 462 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
463 __ Push(r5, r4, r6); // first argument, constructor, new target | 463 __ Push(r5, r4, r6); // first argument, constructor, new target |
464 __ CallRuntime(Runtime::kNewObject); | 464 __ CallRuntime(Runtime::kNewObject); |
465 __ Pop(r5); | 465 __ Pop(r5); |
466 } | 466 } |
467 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); | 467 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); |
468 __ Ret(); | 468 __ Ret(); |
469 } | 469 } |
470 | 470 |
471 | 471 |
472 static void CallRuntimePassFunction(MacroAssembler* masm, | |
473 Runtime::FunctionId function_id) { | |
474 // ----------- S t a t e ------------- | |
475 // -- r4 : target function (preserved for callee) | |
476 // -- r6 : new target (preserved for callee) | |
477 // ----------------------------------- | |
478 | |
479 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
480 // Push a copy of the target function and the new target. | |
481 // Push function as parameter to the runtime call. | |
482 __ Push(r4, r6, r4); | |
483 | |
484 __ CallRuntime(function_id, 1); | |
485 // Restore target function and new target. | |
486 __ Pop(r4, r6); | |
487 } | |
488 | |
489 | |
490 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 472 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
491 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 473 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
492 __ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset)); | 474 __ LoadP(ip, FieldMemOperand(ip, SharedFunctionInfo::kCodeOffset)); |
493 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 475 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
494 __ JumpToJSEntry(ip); | 476 __ JumpToJSEntry(ip); |
495 } | 477 } |
496 | 478 |
| 479 static void GenerateTailCallToReturnedCode(MacroAssembler* masm, |
| 480 Runtime::FunctionId function_id) { |
| 481 // ----------- S t a t e ------------- |
| 482 // -- r3 : argument count (preserved for callee) |
| 483 // -- r4 : target function (preserved for callee) |
| 484 // -- r6 : new target (preserved for callee) |
| 485 // ----------------------------------- |
| 486 { |
| 487 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 488 // Push the number of arguments to the callee. |
| 489 // Push a copy of the target function and the new target. |
| 490 // Push function as parameter to the runtime call. |
| 491 __ SmiTag(r3); |
| 492 __ Push(r3, r4, r6, r4); |
497 | 493 |
498 static void GenerateTailCallToReturnedCode(MacroAssembler* masm) { | 494 __ CallRuntime(function_id, 1); |
499 __ addi(ip, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); | 495 __ mr(r5, r3); |
| 496 |
| 497 // Restore target function and new target. |
| 498 __ Pop(r3, r4, r6); |
| 499 __ SmiUntag(r3); |
| 500 } |
| 501 __ addi(ip, r5, Operand(Code::kHeaderSize - kHeapObjectTag)); |
500 __ JumpToJSEntry(ip); | 502 __ JumpToJSEntry(ip); |
501 } | 503 } |
502 | 504 |
503 | 505 |
504 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { | 506 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { |
505 // Checking whether the queued function is ready for install is optional, | 507 // Checking whether the queued function is ready for install is optional, |
506 // since we come across interrupts and stack checks elsewhere. However, | 508 // since we come across interrupts and stack checks elsewhere. However, |
507 // not checking may delay installing ready functions, and always checking | 509 // not checking may delay installing ready functions, and always checking |
508 // would be quite expensive. A good compromise is to first check against | 510 // would be quite expensive. A good compromise is to first check against |
509 // stack limit as a cue for an interrupt signal. | 511 // stack limit as a cue for an interrupt signal. |
510 Label ok; | 512 Label ok; |
511 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 513 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
512 __ cmpl(sp, ip); | 514 __ cmpl(sp, ip); |
513 __ bge(&ok); | 515 __ bge(&ok); |
514 | 516 |
515 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); | 517 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); |
516 GenerateTailCallToReturnedCode(masm); | |
517 | 518 |
518 __ bind(&ok); | 519 __ bind(&ok); |
519 GenerateTailCallToSharedCode(masm); | 520 GenerateTailCallToSharedCode(masm); |
520 } | 521 } |
521 | 522 |
522 | 523 |
523 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 524 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
524 bool is_api_function, | 525 bool is_api_function, |
525 bool create_implicit_receiver, | 526 bool create_implicit_receiver, |
526 bool check_derived_construct) { | 527 bool check_derived_construct) { |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 // uses this address to determine whether a frame is interpreted. | 1226 // uses this address to determine whether a frame is interpreted. |
1226 __ mov(r0, | 1227 __ mov(r0, |
1227 Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1228 Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
1228 __ mtlr(r0); | 1229 __ mtlr(r0); |
1229 | 1230 |
1230 Generate_EnterBytecodeDispatch(masm); | 1231 Generate_EnterBytecodeDispatch(masm); |
1231 } | 1232 } |
1232 | 1233 |
1233 | 1234 |
1234 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1235 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1235 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1236 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
1236 GenerateTailCallToReturnedCode(masm); | |
1237 } | 1237 } |
1238 | 1238 |
1239 | 1239 |
1240 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1240 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1241 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); | 1241 GenerateTailCallToReturnedCode(masm, |
1242 GenerateTailCallToReturnedCode(masm); | 1242 Runtime::kCompileOptimized_NotConcurrent); |
1243 } | 1243 } |
1244 | 1244 |
1245 | 1245 |
1246 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1246 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1247 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_Concurrent); | 1247 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1248 GenerateTailCallToReturnedCode(masm); | |
1249 } | 1248 } |
1250 | 1249 |
1251 | 1250 |
1252 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1251 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1253 // For now, we are relying on the fact that make_code_young doesn't do any | 1252 // For now, we are relying on the fact that make_code_young doesn't do any |
1254 // garbage collection which allows us to save/restore the registers without | 1253 // garbage collection which allows us to save/restore the registers without |
1255 // worrying about which of them contain pointers. We also don't build an | 1254 // worrying about which of them contain pointers. We also don't build an |
1256 // internal frame to make the code faster, since we shouldn't have to do stack | 1255 // internal frame to make the code faster, since we shouldn't have to do stack |
1257 // crawls in MakeCodeYoung. This seems a bit fragile. | 1256 // crawls in MakeCodeYoung. This seems a bit fragile. |
1258 | 1257 |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2753 __ bkpt(0); | 2752 __ bkpt(0); |
2754 } | 2753 } |
2755 } | 2754 } |
2756 | 2755 |
2757 | 2756 |
2758 #undef __ | 2757 #undef __ |
2759 } // namespace internal | 2758 } // namespace internal |
2760 } // namespace v8 | 2759 } // namespace v8 |
2761 | 2760 |
2762 #endif // V8_TARGET_ARCH_PPC | 2761 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |