| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 | 298 |
| 299 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 299 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| 300 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 300 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
| 301 __ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset)); | 301 __ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset)); |
| 302 __ Add(x2, x2, Code::kHeaderSize - kHeapObjectTag); | 302 __ Add(x2, x2, Code::kHeaderSize - kHeapObjectTag); |
| 303 __ Br(x2); | 303 __ Br(x2); |
| 304 } | 304 } |
| 305 | 305 |
| 306 | 306 |
| 307 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { | 307 static void GenerateTailCallToReturnedCode(MacroAssembler* masm) { |
| 308 __ Add(x0, x0, Code::kHeaderSize - kHeapObjectTag); |
| 309 __ Br(x0); |
| 310 } |
| 311 |
| 312 |
| 313 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { |
| 308 // Checking whether the queued function is ready for install is optional, | 314 // Checking whether the queued function is ready for install is optional, |
| 309 // since we come across interrupts and stack checks elsewhere. However, not | 315 // since we come across interrupts and stack checks elsewhere. However, not |
| 310 // checking may delay installing ready functions, and always checking would be | 316 // checking may delay installing ready functions, and always checking would be |
| 311 // quite expensive. A good compromise is to first check against stack limit as | 317 // quite expensive. A good compromise is to first check against stack limit as |
| 312 // a cue for an interrupt signal. | 318 // a cue for an interrupt signal. |
| 313 Label ok; | 319 Label ok; |
| 314 __ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex); | 320 __ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex); |
| 315 __ B(hs, &ok); | 321 __ B(hs, &ok); |
| 316 | 322 |
| 317 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); | 323 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); |
| 318 | 324 GenerateTailCallToReturnedCode(masm); |
| 319 // Tail call to returned code. | |
| 320 __ Add(x0, x0, Code::kHeaderSize - kHeapObjectTag); | |
| 321 __ Br(x0); | |
| 322 | 325 |
| 323 __ Bind(&ok); | 326 __ Bind(&ok); |
| 324 GenerateTailCallToSharedCode(masm); | 327 GenerateTailCallToSharedCode(masm); |
| 325 } | 328 } |
| 326 | 329 |
| 327 | 330 |
| 328 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { | |
| 329 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile); | |
| 330 GenerateTailCallToSharedCode(masm); | |
| 331 } | |
| 332 | |
| 333 | |
| 334 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 331 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 335 bool is_api_function, | 332 bool is_api_function, |
| 336 bool count_constructions) { | 333 bool count_constructions) { |
| 337 // ----------- S t a t e ------------- | 334 // ----------- S t a t e ------------- |
| 338 // -- x0 : number of arguments | 335 // -- x0 : number of arguments |
| 339 // -- x1 : constructor function | 336 // -- x1 : constructor function |
| 340 // -- lr : return address | 337 // -- lr : return address |
| 341 // -- sp[...]: constructor arguments | 338 // -- sp[...]: constructor arguments |
| 342 // ----------------------------------- | 339 // ----------------------------------- |
| 343 | 340 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 744 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
| 748 Generate_JSEntryTrampolineHelper(masm, false); | 745 Generate_JSEntryTrampolineHelper(masm, false); |
| 749 } | 746 } |
| 750 | 747 |
| 751 | 748 |
| 752 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 749 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 753 Generate_JSEntryTrampolineHelper(masm, true); | 750 Generate_JSEntryTrampolineHelper(masm, true); |
| 754 } | 751 } |
| 755 | 752 |
| 756 | 753 |
| 757 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { | 754 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) { |
| 758 CallRuntimePassFunction(masm, Runtime::kLazyCompile); | 755 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized); |
| 759 // Do a tail-call of the compiled function. | 756 GenerateTailCallToReturnedCode(masm); |
| 760 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag); | |
| 761 __ Br(x2); | |
| 762 } | 757 } |
| 763 | 758 |
| 764 | 759 |
| 765 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { | 760 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) { |
| 766 CallRuntimePassFunction(masm, Runtime::kLazyRecompile); | 761 FrameScope scope(masm, StackFrame::INTERNAL); |
| 767 // Do a tail-call of the compiled function. | 762 Register function = x1; |
| 768 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag); | 763 Register call_kind = x5; |
| 769 __ Br(x2); | 764 |
| 765 // Preserve function and call kind. At the same time, push arguments for |
| 766 // kCompileOptimized. |
| 767 __ LoadObject(x10, masm->isolate()->factory()->ToBoolean(concurrent)); |
| 768 __ Push(function, call_kind, function, x10); |
| 769 |
| 770 __ CallRuntime(Runtime::kCompileOptimized, 2); |
| 771 |
| 772 // Restore preserved call kind and function. |
| 773 __ Pop(call_kind, function); |
| 770 } | 774 } |
| 771 | 775 |
| 772 | 776 |
| 777 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
| 778 CallCompileOptimized(masm, false); |
| 779 GenerateTailCallToReturnedCode(masm); |
| 780 } |
| 781 |
| 782 |
| 783 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
| 784 CallCompileOptimized(masm, true); |
| 785 GenerateTailCallToReturnedCode(masm); |
| 786 } |
| 787 |
| 788 |
| 773 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 789 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
| 774 // For now, we are relying on the fact that make_code_young doesn't do any | 790 // For now, we are relying on the fact that make_code_young doesn't do any |
| 775 // garbage collection which allows us to save/restore the registers without | 791 // garbage collection which allows us to save/restore the registers without |
| 776 // worrying about which of them contain pointers. We also don't build an | 792 // worrying about which of them contain pointers. We also don't build an |
| 777 // internal frame to make the code fast, since we shouldn't have to do stack | 793 // internal frame to make the code fast, since we shouldn't have to do stack |
| 778 // crawls in MakeCodeYoung. This seems a bit fragile. | 794 // crawls in MakeCodeYoung. This seems a bit fragile. |
| 779 | 795 |
| 780 // The following caller-saved registers must be saved and restored when | 796 // The following caller-saved registers must be saved and restored when |
| 781 // calling through to the runtime: | 797 // calling through to the runtime: |
| 782 // x0 - The address from which to resume execution. | 798 // x0 - The address from which to resume execution. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 946 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 931 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 947 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 932 } | 948 } |
| 933 | 949 |
| 934 | 950 |
| 935 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 951 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 936 // Lookup the function in the JavaScript frame. | 952 // Lookup the function in the JavaScript frame. |
| 937 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 953 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 938 { | 954 { |
| 939 FrameScope scope(masm, StackFrame::INTERNAL); | 955 FrameScope scope(masm, StackFrame::INTERNAL); |
| 940 // Lookup and calculate pc offset. | 956 // Pass function as argument. |
| 941 __ Ldr(x1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); | 957 __ Push(x0); |
| 942 __ Ldr(x2, FieldMemOperand(x0, JSFunction::kSharedFunctionInfoOffset)); | 958 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 943 __ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset)); | |
| 944 __ Sub(x1, x1, Code::kHeaderSize - kHeapObjectTag); | |
| 945 __ Sub(x1, x1, x2); | |
| 946 __ SmiTag(x1); | |
| 947 | |
| 948 // Pass both function and pc offset as arguments. | |
| 949 __ Push(x0, x1); | |
| 950 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2); | |
| 951 } | 959 } |
| 952 | 960 |
| 953 // If the code object is null, just return to the unoptimized code. | 961 // If the code object is null, just return to the unoptimized code. |
| 954 Label skip; | 962 Label skip; |
| 955 __ CompareAndBranch(x0, Operand(Smi::FromInt(0)), ne, &skip); | 963 __ CompareAndBranch(x0, Operand(Smi::FromInt(0)), ne, &skip); |
| 956 __ Ret(); | 964 __ Ret(); |
| 957 | 965 |
| 958 __ Bind(&skip); | 966 __ Bind(&skip); |
| 959 | 967 |
| 960 // Load deoptimization data from the code object. | 968 // Load deoptimization data from the code object. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 __ Bind(&dont_adapt_arguments); | 1496 __ Bind(&dont_adapt_arguments); |
| 1489 __ Jump(x3); | 1497 __ Jump(x3); |
| 1490 } | 1498 } |
| 1491 | 1499 |
| 1492 | 1500 |
| 1493 #undef __ | 1501 #undef __ |
| 1494 | 1502 |
| 1495 } } // namespace v8::internal | 1503 } } // namespace v8::internal |
| 1496 | 1504 |
| 1497 #endif // V8_TARGET_ARCH_ARM | 1505 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |