OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Checking whether the queued function is ready for install is optional, | 296 // Checking whether the queued function is ready for install is optional, |
297 // since we come across interrupts and stack checks elsewhere. However, | 297 // since we come across interrupts and stack checks elsewhere. However, |
298 // not checking may delay installing ready functions, and always checking | 298 // not checking may delay installing ready functions, and always checking |
299 // would be quite expensive. A good compromise is to first check against | 299 // would be quite expensive. A good compromise is to first check against |
300 // stack limit as a cue for an interrupt signal. | 300 // stack limit as a cue for an interrupt signal. |
301 Label ok; | 301 Label ok; |
302 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 302 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
303 __ cmp(sp, Operand(ip)); | 303 __ cmp(sp, Operand(ip)); |
304 __ b(hs, &ok); | 304 __ b(hs, &ok); |
305 | 305 |
306 CallRuntimePassFunction(masm, Runtime::kHiddenTryInstallOptimizedCode); | 306 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); |
307 GenerateTailCallToReturnedCode(masm); | 307 GenerateTailCallToReturnedCode(masm); |
308 | 308 |
309 __ bind(&ok); | 309 __ bind(&ok); |
310 GenerateTailCallToSharedCode(masm); | 310 GenerateTailCallToSharedCode(masm); |
311 } | 311 } |
312 | 312 |
313 | 313 |
314 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 314 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
315 bool is_api_function, | 315 bool is_api_function, |
316 bool create_memento) { | 316 bool create_memento) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 __ b(eq, &allocate); | 378 __ b(eq, &allocate); |
379 // Decrease generous allocation count. | 379 // Decrease generous allocation count. |
380 __ sub(r4, r4, Operand(1 << Map::ConstructionCount::kShift)); | 380 __ sub(r4, r4, Operand(1 << Map::ConstructionCount::kShift)); |
381 __ str(r4, bit_field3); | 381 __ str(r4, bit_field3); |
382 __ cmp(r3, Operand(JSFunction::kFinishSlackTracking)); | 382 __ cmp(r3, Operand(JSFunction::kFinishSlackTracking)); |
383 __ b(ne, &allocate); | 383 __ b(ne, &allocate); |
384 | 384 |
385 __ push(r1); | 385 __ push(r1); |
386 | 386 |
387 __ Push(r2, r1); // r1 = constructor | 387 __ Push(r2, r1); // r1 = constructor |
388 __ CallRuntime(Runtime::kHiddenFinalizeInstanceSize, 1); | 388 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); |
389 | 389 |
390 __ pop(r2); | 390 __ pop(r2); |
391 __ pop(r1); | 391 __ pop(r1); |
392 | 392 |
393 __ bind(&allocate); | 393 __ bind(&allocate); |
394 } | 394 } |
395 | 395 |
396 // Now allocate the JSObject on the heap. | 396 // Now allocate the JSObject on the heap. |
397 // r1: constructor function | 397 // r1: constructor function |
398 // r2: initial map | 398 // r2: initial map |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // r1: constructor function | 571 // r1: constructor function |
572 __ bind(&rt_call); | 572 __ bind(&rt_call); |
573 if (create_memento) { | 573 if (create_memento) { |
574 // Get the cell or allocation site. | 574 // Get the cell or allocation site. |
575 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); | 575 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); |
576 __ push(r2); | 576 __ push(r2); |
577 } | 577 } |
578 | 578 |
579 __ push(r1); // argument for Runtime_NewObject | 579 __ push(r1); // argument for Runtime_NewObject |
580 if (create_memento) { | 580 if (create_memento) { |
581 __ CallRuntime(Runtime::kHiddenNewObjectWithAllocationSite, 2); | 581 __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2); |
582 } else { | 582 } else { |
583 __ CallRuntime(Runtime::kHiddenNewObject, 1); | 583 __ CallRuntime(Runtime::kNewObject, 1); |
584 } | 584 } |
585 __ mov(r4, r0); | 585 __ mov(r4, r0); |
586 | 586 |
587 // If we ended up using the runtime, and we want a memento, then the | 587 // If we ended up using the runtime, and we want a memento, then the |
588 // runtime call made it for us, and we shouldn't do create count | 588 // runtime call made it for us, and we shouldn't do create count |
589 // increment. | 589 // increment. |
590 Label count_incremented; | 590 Label count_incremented; |
591 if (create_memento) { | 591 if (create_memento) { |
592 __ jmp(&count_incremented); | 592 __ jmp(&count_incremented); |
593 } | 593 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 Generate_JSEntryTrampolineHelper(masm, false); | 802 Generate_JSEntryTrampolineHelper(masm, false); |
803 } | 803 } |
804 | 804 |
805 | 805 |
806 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 806 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
807 Generate_JSEntryTrampolineHelper(masm, true); | 807 Generate_JSEntryTrampolineHelper(masm, true); |
808 } | 808 } |
809 | 809 |
810 | 810 |
811 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { | 811 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { |
812 CallRuntimePassFunction(masm, Runtime::kHiddenCompileUnoptimized); | 812 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); |
813 GenerateTailCallToReturnedCode(masm); | 813 GenerateTailCallToReturnedCode(masm); |
814 } | 814 } |
815 | 815 |
816 | 816 |
817 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { | 817 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
818 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 818 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
819 // Push a copy of the function onto the stack. | 819 // Push a copy of the function onto the stack. |
820 __ push(r1); | 820 __ push(r1); |
821 // Push function as parameter to the runtime call. | 821 // Push function as parameter to the runtime call. |
822 __ Push(r1); | 822 __ Push(r1); |
823 // Whether to compile in a background thread. | 823 // Whether to compile in a background thread. |
824 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); | 824 __ Push(masm->isolate()->factory()->ToBoolean(concurrent)); |
825 | 825 |
826 __ CallRuntime(Runtime::kHiddenCompileOptimized, 2); | 826 __ CallRuntime(Runtime::kCompileOptimized, 2); |
827 // Restore receiver. | 827 // Restore receiver. |
828 __ pop(r1); | 828 __ pop(r1); |
829 } | 829 } |
830 | 830 |
831 | 831 |
832 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 832 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
833 CallCompileOptimized(masm, false); | 833 CallCompileOptimized(masm, false); |
834 GenerateTailCallToReturnedCode(masm); | 834 GenerateTailCallToReturnedCode(masm); |
835 } | 835 } |
836 | 836 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, | 911 static void Generate_NotifyStubFailureHelper(MacroAssembler* masm, |
912 SaveFPRegsMode save_doubles) { | 912 SaveFPRegsMode save_doubles) { |
913 { | 913 { |
914 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 914 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
915 | 915 |
916 // Preserve registers across notification, this is important for compiled | 916 // Preserve registers across notification, this is important for compiled |
917 // stubs that tail call the runtime on deopts passing their parameters in | 917 // stubs that tail call the runtime on deopts passing their parameters in |
918 // registers. | 918 // registers. |
919 __ stm(db_w, sp, kJSCallerSaved | kCalleeSaved); | 919 __ stm(db_w, sp, kJSCallerSaved | kCalleeSaved); |
920 // Pass the function and deoptimization type to the runtime system. | 920 // Pass the function and deoptimization type to the runtime system. |
921 __ CallRuntime(Runtime::kHiddenNotifyStubFailure, 0, save_doubles); | 921 __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles); |
922 __ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved); | 922 __ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved); |
923 } | 923 } |
924 | 924 |
925 __ add(sp, sp, Operand(kPointerSize)); // Ignore state | 925 __ add(sp, sp, Operand(kPointerSize)); // Ignore state |
926 __ mov(pc, lr); // Jump to miss handler | 926 __ mov(pc, lr); // Jump to miss handler |
927 } | 927 } |
928 | 928 |
929 | 929 |
930 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 930 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
931 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 931 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
932 } | 932 } |
933 | 933 |
934 | 934 |
935 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 935 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
936 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 936 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
937 } | 937 } |
938 | 938 |
939 | 939 |
940 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 940 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
941 Deoptimizer::BailoutType type) { | 941 Deoptimizer::BailoutType type) { |
942 { | 942 { |
943 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 943 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
944 // Pass the function and deoptimization type to the runtime system. | 944 // Pass the function and deoptimization type to the runtime system. |
945 __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type)))); | 945 __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type)))); |
946 __ push(r0); | 946 __ push(r0); |
947 __ CallRuntime(Runtime::kHiddenNotifyDeoptimized, 1); | 947 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
948 } | 948 } |
949 | 949 |
950 // Get the full codegen state from the stack and untag it -> r6. | 950 // Get the full codegen state from the stack and untag it -> r6. |
951 __ ldr(r6, MemOperand(sp, 0 * kPointerSize)); | 951 __ ldr(r6, MemOperand(sp, 0 * kPointerSize)); |
952 __ SmiUntag(r6); | 952 __ SmiUntag(r6); |
953 // Switch on the state. | 953 // Switch on the state. |
954 Label with_tos_register, unknown_state; | 954 Label with_tos_register, unknown_state; |
955 __ cmp(r6, Operand(FullCodeGenerator::NO_REGISTERS)); | 955 __ cmp(r6, Operand(FullCodeGenerator::NO_REGISTERS)); |
956 __ b(ne, &with_tos_register); | 956 __ b(ne, &with_tos_register); |
957 __ add(sp, sp, Operand(1 * kPointerSize)); // Remove state. | 957 __ add(sp, sp, Operand(1 * kPointerSize)); // Remove state. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 | 1028 |
1029 | 1029 |
1030 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { | 1030 void Builtins::Generate_OsrAfterStackCheck(MacroAssembler* masm) { |
1031 // We check the stack limit as indicator that recompilation might be done. | 1031 // We check the stack limit as indicator that recompilation might be done. |
1032 Label ok; | 1032 Label ok; |
1033 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 1033 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
1034 __ cmp(sp, Operand(ip)); | 1034 __ cmp(sp, Operand(ip)); |
1035 __ b(hs, &ok); | 1035 __ b(hs, &ok); |
1036 { | 1036 { |
1037 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1037 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1038 __ CallRuntime(Runtime::kHiddenStackGuard, 0); | 1038 __ CallRuntime(Runtime::kStackGuard, 0); |
1039 } | 1039 } |
1040 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), | 1040 __ Jump(masm->isolate()->builtins()->OnStackReplacement(), |
1041 RelocInfo::CODE_TARGET); | 1041 RelocInfo::CODE_TARGET); |
1042 | 1042 |
1043 __ bind(&ok); | 1043 __ bind(&ok); |
1044 __ Ret(); | 1044 __ Ret(); |
1045 } | 1045 } |
1046 | 1046 |
1047 | 1047 |
1048 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 1048 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 __ bkpt(0); | 1551 __ bkpt(0); |
1552 } | 1552 } |
1553 } | 1553 } |
1554 | 1554 |
1555 | 1555 |
1556 #undef __ | 1556 #undef __ |
1557 | 1557 |
1558 } } // namespace v8::internal | 1558 } } // namespace v8::internal |
1559 | 1559 |
1560 #endif // V8_TARGET_ARCH_ARM | 1560 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |