Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: src/ppc/builtins-ppc.cc

Issue 1553703002: [runtime] TailCallRuntime and CallRuntime should use default argument counts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-29_TailCallRuntime_default_result_size_1_1550923002
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 __ bind(&to_string); 180 __ bind(&to_string);
181 { 181 {
182 ToStringStub stub(masm->isolate()); 182 ToStringStub stub(masm->isolate());
183 __ TailCallStub(&stub); 183 __ TailCallStub(&stub);
184 } 184 }
185 185
186 // 3b. Convert symbol in r3 to a string. 186 // 3b. Convert symbol in r3 to a string.
187 __ bind(&symbol_descriptive_string); 187 __ bind(&symbol_descriptive_string);
188 { 188 {
189 __ Push(r3); 189 __ Push(r3);
190 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1); 190 __ TailCallRuntime(Runtime::kSymbolDescriptiveString);
191 } 191 }
192 } 192 }
193 193
194 194
195 // static 195 // static
196 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { 196 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) {
197 // ----------- S t a t e ------------- 197 // ----------- S t a t e -------------
198 // -- r3 : number of arguments 198 // -- r3 : number of arguments
199 // -- r4 : constructor function 199 // -- r4 : constructor function
200 // -- r6 : new target 200 // -- r6 : new target
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); 263 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0);
264 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); 264 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
265 __ Ret(); 265 __ Ret();
266 } 266 }
267 267
268 // 5. Fallback to the runtime to create new object. 268 // 5. Fallback to the runtime to create new object.
269 __ bind(&new_object); 269 __ bind(&new_object);
270 { 270 {
271 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 271 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
272 __ Push(r5, r4, r6); // first argument, constructor, new target 272 __ Push(r5, r4, r6); // first argument, constructor, new target
273 __ CallRuntime(Runtime::kNewObject, 2); 273 __ CallRuntime(Runtime::kNewObject);
274 __ Pop(r5); 274 __ Pop(r5);
275 } 275 }
276 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); 276 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0);
277 __ Ret(); 277 __ Ret();
278 } 278 }
279 279
280 280
281 static void CallRuntimePassFunction(MacroAssembler* masm, 281 static void CallRuntimePassFunction(MacroAssembler* masm,
282 Runtime::FunctionId function_id) { 282 Runtime::FunctionId function_id) {
283 // ----------- S t a t e ------------- 283 // ----------- S t a t e -------------
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 __ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex); 449 __ LoadRoot(r9, Heap::kOnePointerFillerMapRootIndex);
450 __ InitializeFieldsWithFiller(r8, r10, r9); 450 __ InitializeFieldsWithFiller(r8, r10, r9);
451 451
452 // r11: slack tracking counter value before decreasing. 452 // r11: slack tracking counter value before decreasing.
453 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd)); 453 __ cmpi(r11, Operand(Map::kSlackTrackingCounterEnd));
454 __ bne(&allocated); 454 __ bne(&allocated);
455 455
456 // Push the constructor, new_target and the object to the stack, 456 // Push the constructor, new_target and the object to the stack,
457 // and then the initial map as an argument to the runtime call. 457 // and then the initial map as an argument to the runtime call.
458 __ Push(r4, r6, r7, r5); 458 __ Push(r4, r6, r7, r5);
459 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 459 __ CallRuntime(Runtime::kFinalizeInstanceSize);
460 __ Pop(r4, r6, r7); 460 __ Pop(r4, r6, r7);
461 461
462 // Continue with JSObject being successfully allocated 462 // Continue with JSObject being successfully allocated
463 // r4: constructor function 463 // r4: constructor function
464 // r6: new target 464 // r6: new target
465 // r7: JSObject 465 // r7: JSObject
466 __ b(&allocated); 466 __ b(&allocated);
467 467
468 __ bind(&no_inobject_slack_tracking); 468 __ bind(&no_inobject_slack_tracking);
469 } 469 }
470 470
471 __ InitializeFieldsWithFiller(r8, r10, r9); 471 __ InitializeFieldsWithFiller(r8, r10, r9);
472 472
473 // Continue with JSObject being successfully allocated 473 // Continue with JSObject being successfully allocated
474 // r4: constructor function 474 // r4: constructor function
475 // r6: new target 475 // r6: new target
476 // r7: JSObject 476 // r7: JSObject
477 __ b(&allocated); 477 __ b(&allocated);
478 } 478 }
479 479
480 // Allocate the new receiver object using the runtime call. 480 // Allocate the new receiver object using the runtime call.
481 // r4: constructor function 481 // r4: constructor function
482 // r6: new target 482 // r6: new target
483 __ bind(&rt_call); 483 __ bind(&rt_call);
484 484
485 // Push the constructor and new_target twice, second pair as arguments 485 // Push the constructor and new_target twice, second pair as arguments
486 // to the runtime call. 486 // to the runtime call.
487 __ Push(r4, r6, r4, r6); 487 __ Push(r4, r6, r4, r6);
488 __ CallRuntime(Runtime::kNewObject, 2); 488 __ CallRuntime(Runtime::kNewObject);
489 __ mr(r7, r3); 489 __ mr(r7, r3);
490 __ Pop(r4, r6); 490 __ Pop(r4, r6);
491 491
492 // Receiver for constructor call allocated. 492 // Receiver for constructor call allocated.
493 // r4: constructor function 493 // r4: constructor function
494 // r6: new target 494 // r6: new target
495 // r7: JSObject 495 // r7: JSObject
496 __ bind(&allocated); 496 __ bind(&allocated);
497 497
498 // Retrieve smi-tagged arguments count from the stack. 498 // Retrieve smi-tagged arguments count from the stack.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 611
612 612
613 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { 613 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) {
614 Generate_JSConstructStubHelper(masm, false, false); 614 Generate_JSConstructStubHelper(masm, false, false);
615 } 615 }
616 616
617 617
618 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) { 618 void Builtins::Generate_ConstructedNonConstructable(MacroAssembler* masm) {
619 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 619 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
620 __ push(r4); 620 __ push(r4);
621 __ CallRuntime(Runtime::kThrowConstructedNonConstructable, 1); 621 __ CallRuntime(Runtime::kThrowConstructedNonConstructable);
622 } 622 }
623 623
624 624
625 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt }; 625 enum IsTagged { kArgcIsSmiTagged, kArgcIsUntaggedInt };
626 626
627 627
628 // Clobbers r5; preserves all other registers. 628 // Clobbers r5; preserves all other registers.
629 static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc, 629 static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc,
630 IsTagged argc_is_tagged) { 630 IsTagged argc_is_tagged) {
631 // Check the stack for overflow. We are not trying to catch 631 // Check the stack for overflow. We are not trying to catch
632 // interruptions (e.g. debug break and preemption) here, so the "real stack 632 // interruptions (e.g. debug break and preemption) here, so the "real stack
633 // limit" is checked. 633 // limit" is checked.
634 Label okay; 634 Label okay;
635 __ LoadRoot(r5, Heap::kRealStackLimitRootIndex); 635 __ LoadRoot(r5, Heap::kRealStackLimitRootIndex);
636 // Make r5 the space we have left. The stack might already be overflowed 636 // Make r5 the space we have left. The stack might already be overflowed
637 // here which will cause r5 to become negative. 637 // here which will cause r5 to become negative.
638 __ sub(r5, sp, r5); 638 __ sub(r5, sp, r5);
639 // Check if the arguments will overflow the stack. 639 // Check if the arguments will overflow the stack.
640 if (argc_is_tagged == kArgcIsSmiTagged) { 640 if (argc_is_tagged == kArgcIsSmiTagged) {
641 __ SmiToPtrArrayOffset(r0, argc); 641 __ SmiToPtrArrayOffset(r0, argc);
642 } else { 642 } else {
643 DCHECK(argc_is_tagged == kArgcIsUntaggedInt); 643 DCHECK(argc_is_tagged == kArgcIsUntaggedInt);
644 __ ShiftLeftImm(r0, argc, Operand(kPointerSizeLog2)); 644 __ ShiftLeftImm(r0, argc, Operand(kPointerSizeLog2));
645 } 645 }
646 __ cmp(r5, r0); 646 __ cmp(r5, r0);
647 __ bgt(&okay); // Signed comparison. 647 __ bgt(&okay); // Signed comparison.
648 648
649 // Out of stack space. 649 // Out of stack space.
650 __ CallRuntime(Runtime::kThrowStackOverflow, 0); 650 __ CallRuntime(Runtime::kThrowStackOverflow);
651 651
652 __ bind(&okay); 652 __ bind(&okay);
653 } 653 }
654 654
655 655
656 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, 656 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
657 bool is_construct) { 657 bool is_construct) {
658 // Called from Generate_JS_Entry 658 // Called from Generate_JS_Entry
659 // r3: new.target 659 // r3: new.target
660 // r4: function 660 // r4: function
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 // Load frame size (word) from the BytecodeArray object. 793 // Load frame size (word) from the BytecodeArray object.
794 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, 794 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister,
795 BytecodeArray::kFrameSizeOffset)); 795 BytecodeArray::kFrameSizeOffset));
796 796
797 // Do a stack check to ensure we don't go over the limit. 797 // Do a stack check to ensure we don't go over the limit.
798 Label ok; 798 Label ok;
799 __ sub(r6, sp, r5); 799 __ sub(r6, sp, r5);
800 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); 800 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex);
801 __ cmpl(r6, r0); 801 __ cmpl(r6, r0);
802 __ bge(&ok); 802 __ bge(&ok);
803 __ CallRuntime(Runtime::kThrowStackOverflow, 0); 803 __ CallRuntime(Runtime::kThrowStackOverflow);
804 __ bind(&ok); 804 __ bind(&ok);
805 805
806 // If ok, push undefined as the initial value for all register file entries. 806 // If ok, push undefined as the initial value for all register file entries.
807 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 807 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
808 Label loop, no_args; 808 Label loop, no_args;
809 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); 809 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
810 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC); 810 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC);
811 __ beq(&no_args, cr0); 811 __ beq(&no_args, cr0);
812 __ mtctr(r5); 812 __ mtctr(r5);
813 __ bind(&loop); 813 __ bind(&loop);
814 __ push(r6); 814 __ push(r6);
815 __ bdnz(&loop); 815 __ bdnz(&loop);
816 __ bind(&no_args); 816 __ bind(&no_args);
817 } 817 }
818 818
819 // TODO(rmcilroy): List of things not currently dealt with here but done in 819 // TODO(rmcilroy): List of things not currently dealt with here but done in
820 // fullcodegen's prologue: 820 // fullcodegen's prologue:
821 // - Support profiler (specifically profiling_counter). 821 // - Support profiler (specifically profiling_counter).
822 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 822 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
823 // - Allow simulator stop operations if FLAG_stop_at is set. 823 // - Allow simulator stop operations if FLAG_stop_at is set.
824 // - Code aging of the BytecodeArray object. 824 // - Code aging of the BytecodeArray object.
825 825
826 // Perform stack guard check. 826 // Perform stack guard check.
827 { 827 {
828 Label ok; 828 Label ok;
829 __ LoadRoot(r0, Heap::kStackLimitRootIndex); 829 __ LoadRoot(r0, Heap::kStackLimitRootIndex);
830 __ cmp(sp, r0); 830 __ cmp(sp, r0);
831 __ bge(&ok); 831 __ bge(&ok);
832 __ push(kInterpreterBytecodeArrayRegister); 832 __ push(kInterpreterBytecodeArrayRegister);
833 __ CallRuntime(Runtime::kStackGuard, 0); 833 __ CallRuntime(Runtime::kStackGuard);
834 __ pop(kInterpreterBytecodeArrayRegister); 834 __ pop(kInterpreterBytecodeArrayRegister);
835 __ bind(&ok); 835 __ bind(&ok);
836 } 836 }
837 837
838 // Load accumulator, register file, bytecode offset, dispatch table into 838 // Load accumulator, register file, bytecode offset, dispatch table into
839 // registers. 839 // registers.
840 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 840 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
841 __ addi(kInterpreterRegisterFileRegister, fp, 841 __ addi(kInterpreterRegisterFileRegister, fp,
842 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); 842 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp));
843 __ mov(kInterpreterBytecodeOffsetRegister, 843 __ mov(kInterpreterBytecodeOffsetRegister,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 939
940 static void Generate_InterpreterNotifyDeoptimizedHelper( 940 static void Generate_InterpreterNotifyDeoptimizedHelper(
941 MacroAssembler* masm, Deoptimizer::BailoutType type) { 941 MacroAssembler* masm, Deoptimizer::BailoutType type) {
942 // Enter an internal frame. 942 // Enter an internal frame.
943 { 943 {
944 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 944 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
945 // Save accumulator register and pass the deoptimization type to 945 // Save accumulator register and pass the deoptimization type to
946 // the runtime system. 946 // the runtime system.
947 __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type))); 947 __ LoadSmiLiteral(r4, Smi::FromInt(static_cast<int>(type)));
948 __ Push(kInterpreterAccumulatorRegister, r4); 948 __ Push(kInterpreterAccumulatorRegister, r4);
949 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); 949 __ CallRuntime(Runtime::kNotifyDeoptimized);
950 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register. 950 __ pop(kInterpreterAccumulatorRegister); // Restore accumulator register.
951 // Tear down internal frame. 951 // Tear down internal frame.
952 } 952 }
953 953
954 // Drop state (we don't use these for interpreter deopts) and push PC at top 954 // Drop state (we don't use these for interpreter deopts) and push PC at top
955 // of stack (to simulate initial call to bytecode handler in interpreter entry 955 // of stack (to simulate initial call to bytecode handler in interpreter entry
956 // trampoline). 956 // trampoline).
957 __ pop(r4); 957 __ pop(r4);
958 __ StoreP(r4, MemOperand(sp, 0)); 958 __ StoreP(r4, MemOperand(sp, 0));
959 959
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, 1132 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
1133 SaveFPRegsMode save_doubles) { 1133 SaveFPRegsMode save_doubles) {
1134 { 1134 {
1135 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1135 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1136 1136
1137 // Preserve registers across notification, this is important for compiled 1137 // Preserve registers across notification, this is important for compiled
1138 // stubs that tail call the runtime on deopts passing their parameters in 1138 // stubs that tail call the runtime on deopts passing their parameters in
1139 // registers. 1139 // registers.
1140 __ MultiPush(kJSCallerSaved | kCalleeSaved); 1140 __ MultiPush(kJSCallerSaved | kCalleeSaved);
1141 // Pass the function and deoptimization type to the runtime system. 1141 // Pass the function and deoptimization type to the runtime system.
1142 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); 1142 __ CallRuntime(Runtime::kNotifyStubFailure, save_doubles);
1143 __ MultiPop(kJSCallerSaved | kCalleeSaved); 1143 __ MultiPop(kJSCallerSaved | kCalleeSaved);
1144 } 1144 }
1145 1145
1146 __ addi(sp, sp, Operand(kPointerSize)); // Ignore state 1146 __ addi(sp, sp, Operand(kPointerSize)); // Ignore state
1147 __ blr(); // Jump to miss handler 1147 __ blr(); // Jump to miss handler
1148 } 1148 }
1149 1149
1150 1150
1151 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { 1151 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
1152 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); 1152 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
1153 } 1153 }
1154 1154
1155 1155
1156 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { 1156 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
1157 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); 1157 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
1158 } 1158 }
1159 1159
1160 1160
1161 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, 1161 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
1162 Deoptimizer::BailoutType type) { 1162 Deoptimizer::BailoutType type) {
1163 { 1163 {
1164 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1164 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1165 // Pass the function and deoptimization type to the runtime system. 1165 // Pass the function and deoptimization type to the runtime system.
1166 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type))); 1166 __ LoadSmiLiteral(r3, Smi::FromInt(static_cast<int>(type)));
1167 __ push(r3); 1167 __ push(r3);
1168 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); 1168 __ CallRuntime(Runtime::kNotifyDeoptimized);
1169 } 1169 }
1170 1170
1171 // Get the full codegen state from the stack and untag it -> r9. 1171 // Get the full codegen state from the stack and untag it -> r9.
1172 __ LoadP(r9, MemOperand(sp, 0 * kPointerSize)); 1172 __ LoadP(r9, MemOperand(sp, 0 * kPointerSize));
1173 __ SmiUntag(r9); 1173 __ SmiUntag(r9);
1174 // Switch on the state. 1174 // Switch on the state.
1175 Label with_tos_register, unknown_state; 1175 Label with_tos_register, unknown_state;
1176 __ cmpi(r9, Operand(FullCodeGenerator::NO_REGISTERS)); 1176 __ cmpi(r9, Operand(FullCodeGenerator::NO_REGISTERS));
1177 __ bne(&with_tos_register); 1177 __ bne(&with_tos_register);
1178 __ addi(sp, sp, Operand(1 * kPointerSize)); // Remove state. 1178 __ addi(sp, sp, Operand(1 * kPointerSize)); // Remove state.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 __ bind(&set_global_proxy); 1313 __ bind(&set_global_proxy);
1314 __ LoadGlobalProxy(r5); 1314 __ LoadGlobalProxy(r5);
1315 __ StorePX(r5, MemOperand(sp, r11)); 1315 __ StorePX(r5, MemOperand(sp, r11));
1316 __ b(&valid_receiver); 1316 __ b(&valid_receiver);
1317 1317
1318 // Compatible receiver check failed: throw an Illegal Invocation exception. 1318 // Compatible receiver check failed: throw an Illegal Invocation exception.
1319 __ bind(&receiver_check_failed); 1319 __ bind(&receiver_check_failed);
1320 // Drop the arguments (including the receiver); 1320 // Drop the arguments (including the receiver);
1321 __ addi(r11, r11, Operand(kPointerSize)); 1321 __ addi(r11, r11, Operand(kPointerSize));
1322 __ add(sp, sp, r11); 1322 __ add(sp, sp, r11);
1323 __ TailCallRuntime(Runtime::kThrowIllegalInvocation, 0); 1323 __ TailCallRuntime(Runtime::kThrowIllegalInvocation);
1324 } 1324 }
1325 1325
1326 1326
1327 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1327 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1328 // Lookup the function in the JavaScript frame. 1328 // Lookup the function in the JavaScript frame.
1329 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1329 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1330 { 1330 {
1331 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1331 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1332 // Pass function as argument. 1332 // Pass function as argument.
1333 __ push(r3); 1333 __ push(r3);
1334 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); 1334 __ CallRuntime(Runtime::kCompileForOnStackReplacement);
1335 } 1335 }
1336 1336
1337 // If the code object is null, just return to the unoptimized code. 1337 // If the code object is null, just return to the unoptimized code.
1338 Label skip; 1338 Label skip;
1339 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); 1339 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0);
1340 __ bne(&skip); 1340 __ bne(&skip);
1341 __ Ret(); 1341 __ Ret();
1342 1342
1343 __ bind(&skip); 1343 __ bind(&skip);
1344 1344
(...skipping 27 matching lines...) Expand all
1372 1372
1373 1373
1374 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { 1374 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) {
1375 // We check the stack limit as indicator that recompilation might be done. 1375 // We check the stack limit as indicator that recompilation might be done.
1376 Label ok; 1376 Label ok;
1377 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 1377 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
1378 __ cmpl(sp, ip); 1378 __ cmpl(sp, ip);
1379 __ bge(&ok); 1379 __ bge(&ok);
1380 { 1380 {
1381 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1381 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1382 __ CallRuntime(Runtime::kStackGuard, 0); 1382 __ CallRuntime(Runtime::kStackGuard);
1383 } 1383 }
1384 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), 1384 __ Jump(masm->isolate()->builtins()->OnStackReplacement(),
1385 RelocInfo::CODE_TARGET); 1385 RelocInfo::CODE_TARGET);
1386 1386
1387 __ bind(&ok); 1387 __ bind(&ok);
1388 __ Ret(); 1388 __ Ret();
1389 } 1389 }
1390 1390
1391 1391
1392 // static 1392 // static
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 __ bind(&no_arguments); 1450 __ bind(&no_arguments);
1451 { 1451 {
1452 __ li(r3, Operand::Zero()); 1452 __ li(r3, Operand::Zero());
1453 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 1453 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
1454 } 1454 }
1455 1455
1456 // 4c. The receiver is not callable, throw an appropriate TypeError. 1456 // 4c. The receiver is not callable, throw an appropriate TypeError.
1457 __ bind(&receiver_not_callable); 1457 __ bind(&receiver_not_callable);
1458 { 1458 {
1459 __ StoreP(r4, MemOperand(sp, 0)); 1459 __ StoreP(r4, MemOperand(sp, 0));
1460 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); 1460 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
1461 } 1461 }
1462 } 1462 }
1463 1463
1464 1464
1465 // static 1465 // static
1466 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { 1466 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) {
1467 // 1. Make sure we have at least one argument. 1467 // 1. Make sure we have at least one argument.
1468 // r3: actual number of arguments 1468 // r3: actual number of arguments
1469 { 1469 {
1470 Label done; 1470 Label done;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 1559
1560 // 3a. Apply the target to the given argumentsList (passing undefined for 1560 // 3a. Apply the target to the given argumentsList (passing undefined for
1561 // new.target). 1561 // new.target).
1562 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); 1562 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
1563 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); 1563 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET);
1564 1564
1565 // 3b. The target is not callable, throw an appropriate TypeError. 1565 // 3b. The target is not callable, throw an appropriate TypeError.
1566 __ bind(&target_not_callable); 1566 __ bind(&target_not_callable);
1567 { 1567 {
1568 __ StoreP(r4, MemOperand(sp, 0)); 1568 __ StoreP(r4, MemOperand(sp, 0));
1569 __ TailCallRuntime(Runtime::kThrowApplyNonFunction, 1); 1569 __ TailCallRuntime(Runtime::kThrowApplyNonFunction);
1570 } 1570 }
1571 } 1571 }
1572 1572
1573 1573
1574 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { 1574 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) {
1575 // ----------- S t a t e ------------- 1575 // ----------- S t a t e -------------
1576 // -- r3 : argc 1576 // -- r3 : argc
1577 // -- sp[0] : new.target (optional) 1577 // -- sp[0] : new.target (optional)
1578 // -- sp[4] : argumentsList 1578 // -- sp[4] : argumentsList
1579 // -- sp[8] : target 1579 // -- sp[8] : target
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 __ TestBit(r7, Map::kIsConstructor, r0); 1630 __ TestBit(r7, Map::kIsConstructor, r0);
1631 __ beq(&new_target_not_constructor, cr0); 1631 __ beq(&new_target_not_constructor, cr0);
1632 1632
1633 // 4a. Construct the target with the given new.target and argumentsList. 1633 // 4a. Construct the target with the given new.target and argumentsList.
1634 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET); 1634 __ Jump(masm->isolate()->builtins()->Apply(), RelocInfo::CODE_TARGET);
1635 1635
1636 // 4b. The target is not a constructor, throw an appropriate TypeError. 1636 // 4b. The target is not a constructor, throw an appropriate TypeError.
1637 __ bind(&target_not_constructor); 1637 __ bind(&target_not_constructor);
1638 { 1638 {
1639 __ StoreP(r4, MemOperand(sp, 0)); 1639 __ StoreP(r4, MemOperand(sp, 0));
1640 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); 1640 __ TailCallRuntime(Runtime::kThrowCalledNonCallable);
1641 } 1641 }
1642 1642
1643 // 4c. The new.target is not a constructor, throw an appropriate TypeError. 1643 // 4c. The new.target is not a constructor, throw an appropriate TypeError.
1644 __ bind(&new_target_not_constructor); 1644 __ bind(&new_target_not_constructor);
1645 { 1645 {
1646 __ StoreP(r6, MemOperand(sp, 0)); 1646 __ StoreP(r6, MemOperand(sp, 0));
1647 __ TailCallRuntime(Runtime::kThrowCalledNonCallable, 1); 1647 __ TailCallRuntime(Runtime::kThrowCalledNonCallable);
1648 } 1648 }
1649 } 1649 }
1650 1650
1651 1651
1652 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, 1652 static void ArgumentAdaptorStackCheck(MacroAssembler* masm,
1653 Label* stack_overflow) { 1653 Label* stack_overflow) {
1654 // ----------- S t a t e ------------- 1654 // ----------- S t a t e -------------
1655 // -- r3 : actual number of arguments 1655 // -- r3 : actual number of arguments
1656 // -- r4 : function (passed through to callee) 1656 // -- r4 : function (passed through to callee)
1657 // -- r5 : expected number of arguments 1657 // -- r5 : expected number of arguments
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 1731
1732 // Check if argumentsList is a fast JSArray. 1732 // Check if argumentsList is a fast JSArray.
1733 __ CompareInstanceType(r5, ip, JS_ARRAY_TYPE); 1733 __ CompareInstanceType(r5, ip, JS_ARRAY_TYPE);
1734 __ beq(&create_array); 1734 __ beq(&create_array);
1735 1735
1736 // Ask the runtime to create the list (actually a FixedArray). 1736 // Ask the runtime to create the list (actually a FixedArray).
1737 __ bind(&create_runtime); 1737 __ bind(&create_runtime);
1738 { 1738 {
1739 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1739 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1740 __ Push(r4, r6, r3); 1740 __ Push(r4, r6, r3);
1741 __ CallRuntime(Runtime::kCreateListFromArrayLike, 1); 1741 __ CallRuntime(Runtime::kCreateListFromArrayLike);
1742 __ Pop(r4, r6); 1742 __ Pop(r4, r6);
1743 __ LoadP(r5, FieldMemOperand(r3, FixedArray::kLengthOffset)); 1743 __ LoadP(r5, FieldMemOperand(r3, FixedArray::kLengthOffset));
1744 __ SmiUntag(r5); 1744 __ SmiUntag(r5);
1745 } 1745 }
1746 __ b(&done_create); 1746 __ b(&done_create);
1747 1747
1748 // Try to create the list from an arguments object. 1748 // Try to create the list from an arguments object.
1749 __ bind(&create_arguments); 1749 __ bind(&create_arguments);
1750 __ LoadP(r5, FieldMemOperand( 1750 __ LoadP(r5, FieldMemOperand(
1751 r3, JSObject::kHeaderSize + 1751 r3, JSObject::kHeaderSize +
(...skipping 30 matching lines...) Expand all
1782 // (i.e. debug break and preemption) here, so check the "real stack limit". 1782 // (i.e. debug break and preemption) here, so check the "real stack limit".
1783 Label done; 1783 Label done;
1784 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex); 1784 __ LoadRoot(ip, Heap::kRealStackLimitRootIndex);
1785 // Make ip the space we have left. The stack might already be overflowed 1785 // Make ip the space we have left. The stack might already be overflowed
1786 // here which will cause ip to become negative. 1786 // here which will cause ip to become negative.
1787 __ sub(ip, sp, ip); 1787 __ sub(ip, sp, ip);
1788 // Check if the arguments will overflow the stack. 1788 // Check if the arguments will overflow the stack.
1789 __ ShiftLeftImm(r0, r5, Operand(kPointerSizeLog2)); 1789 __ ShiftLeftImm(r0, r5, Operand(kPointerSizeLog2));
1790 __ cmp(ip, r0); // Signed comparison. 1790 __ cmp(ip, r0); // Signed comparison.
1791 __ bgt(&done); 1791 __ bgt(&done);
1792 __ TailCallRuntime(Runtime::kThrowStackOverflow, 1); 1792 __ TailCallRuntime(Runtime::kThrowStackOverflow);
1793 __ bind(&done); 1793 __ bind(&done);
1794 } 1794 }
1795 1795
1796 // ----------- S t a t e ------------- 1796 // ----------- S t a t e -------------
1797 // -- r4 : target 1797 // -- r4 : target
1798 // -- r3 : args (a FixedArray built from argumentsList) 1798 // -- r3 : args (a FixedArray built from argumentsList)
1799 // -- r5 : len (number of elements to push from args) 1799 // -- r5 : len (number of elements to push from args)
1800 // -- r6 : new.target (checked to be constructor or undefined) 1800 // -- r6 : new.target (checked to be constructor or undefined)
1801 // -- sp[0] : thisArgument 1801 // -- sp[0] : thisArgument
1802 // ----------------------------------- 1802 // -----------------------------------
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 ParameterCount actual(r3); 1921 ParameterCount actual(r3);
1922 ParameterCount expected(r5); 1922 ParameterCount expected(r5);
1923 __ InvokeFunctionCode(r4, no_reg, expected, actual, JUMP_FUNCTION, 1923 __ InvokeFunctionCode(r4, no_reg, expected, actual, JUMP_FUNCTION,
1924 CheckDebugStepCallWrapper()); 1924 CheckDebugStepCallWrapper());
1925 1925
1926 // The function is a "classConstructor", need to raise an exception. 1926 // The function is a "classConstructor", need to raise an exception.
1927 __ bind(&class_constructor); 1927 __ bind(&class_constructor);
1928 { 1928 {
1929 FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL); 1929 FrameAndConstantPoolScope frame(masm, StackFrame::INTERNAL);
1930 __ push(r4); 1930 __ push(r4);
1931 __ CallRuntime(Runtime::kThrowConstructorNonCallableError, 1); 1931 __ CallRuntime(Runtime::kThrowConstructorNonCallableError);
1932 } 1932 }
1933 } 1933 }
1934 1934
1935 1935
1936 // static 1936 // static
1937 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) { 1937 void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode) {
1938 // ----------- S t a t e ------------- 1938 // ----------- S t a t e -------------
1939 // -- r3 : the number of arguments (not including the receiver) 1939 // -- r3 : the number of arguments (not including the receiver)
1940 // -- r4 : the target to call (can be any Object). 1940 // -- r4 : the target to call (can be any Object).
1941 // ----------------------------------- 1941 // -----------------------------------
(...skipping 30 matching lines...) Expand all
1972 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); 1972 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4);
1973 __ Jump(masm->isolate()->builtins()->CallFunction( 1973 __ Jump(masm->isolate()->builtins()->CallFunction(
1974 ConvertReceiverMode::kNotNullOrUndefined), 1974 ConvertReceiverMode::kNotNullOrUndefined),
1975 RelocInfo::CODE_TARGET); 1975 RelocInfo::CODE_TARGET);
1976 1976
1977 // 3. Call to something that is not callable. 1977 // 3. Call to something that is not callable.
1978 __ bind(&non_callable); 1978 __ bind(&non_callable);
1979 { 1979 {
1980 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1980 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1981 __ Push(r4); 1981 __ Push(r4);
1982 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); 1982 __ CallRuntime(Runtime::kThrowCalledNonCallable);
1983 } 1983 }
1984 } 1984 }
1985 1985
1986 1986
1987 // static 1987 // static
1988 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { 1988 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
1989 // ----------- S t a t e ------------- 1989 // ----------- S t a t e -------------
1990 // -- r3 : the number of arguments (not including the receiver) 1990 // -- r3 : the number of arguments (not including the receiver)
1991 // -- r4 : the constructor to call (checked to be a JSFunction) 1991 // -- r4 : the constructor to call (checked to be a JSFunction)
1992 // -- r6 : the new target (checked to be a constructor) 1992 // -- r6 : the new target (checked to be a constructor)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 __ srawi(r7, r7, kSmiTagSize); 2143 __ srawi(r7, r7, kSmiTagSize);
2144 #else 2144 #else
2145 __ SmiUntag(r7); 2145 __ SmiUntag(r7);
2146 #endif 2146 #endif
2147 __ cmp(r3, r7); 2147 __ cmp(r3, r7);
2148 __ bge(&no_strong_error); 2148 __ bge(&no_strong_error);
2149 2149
2150 { 2150 {
2151 FrameScope frame(masm, StackFrame::MANUAL); 2151 FrameScope frame(masm, StackFrame::MANUAL);
2152 EnterArgumentsAdaptorFrame(masm); 2152 EnterArgumentsAdaptorFrame(masm);
2153 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); 2153 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments);
2154 } 2154 }
2155 2155
2156 __ bind(&no_strong_error); 2156 __ bind(&no_strong_error);
2157 EnterArgumentsAdaptorFrame(masm); 2157 EnterArgumentsAdaptorFrame(masm);
2158 ArgumentAdaptorStackCheck(masm, &stack_overflow); 2158 ArgumentAdaptorStackCheck(masm, &stack_overflow);
2159 2159
2160 // Calculate copy start address into r0 and copy end address is fp. 2160 // Calculate copy start address into r0 and copy end address is fp.
2161 // r3: actual number of arguments as a smi 2161 // r3: actual number of arguments as a smi
2162 // r4: function 2162 // r4: function
2163 // r5: expected number of arguments 2163 // r5: expected number of arguments
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 2218
2219 // ------------------------------------------- 2219 // -------------------------------------------
2220 // Dont adapt arguments. 2220 // Dont adapt arguments.
2221 // ------------------------------------------- 2221 // -------------------------------------------
2222 __ bind(&dont_adapt_arguments); 2222 __ bind(&dont_adapt_arguments);
2223 __ JumpToJSEntry(ip); 2223 __ JumpToJSEntry(ip);
2224 2224
2225 __ bind(&stack_overflow); 2225 __ bind(&stack_overflow);
2226 { 2226 {
2227 FrameScope frame(masm, StackFrame::MANUAL); 2227 FrameScope frame(masm, StackFrame::MANUAL);
2228 __ CallRuntime(Runtime::kThrowStackOverflow, 0); 2228 __ CallRuntime(Runtime::kThrowStackOverflow);
2229 __ bkpt(0); 2229 __ bkpt(0);
2230 } 2230 }
2231 } 2231 }
2232 2232
2233 2233
2234 #undef __ 2234 #undef __
2235 } // namespace internal 2235 } // namespace internal
2236 } // namespace v8 2236 } // namespace v8
2237 2237
2238 #endif // V8_TARGET_ARCH_PPC 2238 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698