| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4); | 284 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4); |
| 285 { | 285 { |
| 286 FrameScope scope(masm, StackFrame::INTERNAL); | 286 FrameScope scope(masm, StackFrame::INTERNAL); |
| 287 __ push(argument); | 287 __ push(argument); |
| 288 __ CallRuntime(Runtime::kNewStringWrapper, 1); | 288 __ CallRuntime(Runtime::kNewStringWrapper, 1); |
| 289 } | 289 } |
| 290 __ Ret(); | 290 __ Ret(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 | 293 |
| 294 static void CallRuntimePassFunction(MacroAssembler* masm, |
| 295 Runtime::FunctionId function_id) { |
| 296 FrameScope scope(masm, StackFrame::INTERNAL); |
| 297 // Push a copy of the function onto the stack. |
| 298 __ push(r1); |
| 299 // Push call kind information. |
| 300 __ push(r5); |
| 301 // Function is also the parameter to the runtime call. |
| 302 __ push(r1); |
| 303 |
| 304 __ CallRuntime(function_id, 1); |
| 305 // Restore call kind information. |
| 306 __ pop(r5); |
| 307 // Restore receiver. |
| 308 __ pop(r1); |
| 309 } |
| 310 |
| 311 |
| 294 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { | 312 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { |
| 295 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 313 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 296 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset)); | 314 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset)); |
| 297 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 315 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 298 __ mov(pc, r2); | 316 __ Jump(r2); |
| 299 } | 317 } |
| 300 | 318 |
| 301 | 319 |
| 302 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { | 320 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { |
| 321 // Checking whether the queued function is ready for install is optional, |
| 322 // since we come across interrupts and stack checks elsewhere. However, |
| 323 // not checking may delay installing ready functions, and always checking |
| 324 // would be quite expensive. A good compromise is to first check against |
| 325 // stack limit as a cue for an interrupt signal. |
| 326 Label ok; |
| 327 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
| 328 __ cmp(sp, Operand(ip)); |
| 329 __ b(hs, &ok); |
| 330 |
| 331 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); |
| 332 // Tail call to returned code. |
| 333 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 334 __ Jump(r0); |
| 335 |
| 336 __ bind(&ok); |
| 303 GenerateTailCallToSharedCode(masm); | 337 GenerateTailCallToSharedCode(masm); |
| 304 } | 338 } |
| 305 | 339 |
| 306 | 340 |
| 307 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) { | |
| 308 // Enter an internal frame. | |
| 309 { | |
| 310 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 311 | |
| 312 // Preserve the function. | |
| 313 __ push(r1); | |
| 314 // Push call kind information. | |
| 315 __ push(r5); | |
| 316 | |
| 317 // Push the function on the stack as the argument to the runtime function. | |
| 318 __ push(r1); | |
| 319 __ CallRuntime(Runtime::kInstallRecompiledCode, 1); | |
| 320 // Calculate the entry point. | |
| 321 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 322 | |
| 323 // Restore call kind information. | |
| 324 __ pop(r5); | |
| 325 // Restore saved function. | |
| 326 __ pop(r1); | |
| 327 | |
| 328 // Tear down internal frame. | |
| 329 } | |
| 330 | |
| 331 // Do a tail-call of the compiled function. | |
| 332 __ Jump(r2); | |
| 333 } | |
| 334 | |
| 335 | |
| 336 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { | 341 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { |
| 337 { | 342 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile); |
| 338 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 339 | |
| 340 // Push a copy of the function onto the stack. | |
| 341 __ push(r1); | |
| 342 // Push call kind information. | |
| 343 __ push(r5); | |
| 344 | |
| 345 __ push(r1); // Function is also the parameter to the runtime call. | |
| 346 __ CallRuntime(Runtime::kConcurrentRecompile, 1); | |
| 347 | |
| 348 // Restore call kind information. | |
| 349 __ pop(r5); | |
| 350 // Restore receiver. | |
| 351 __ pop(r1); | |
| 352 | |
| 353 // Tear down internal frame. | |
| 354 } | |
| 355 | |
| 356 GenerateTailCallToSharedCode(masm); | 343 GenerateTailCallToSharedCode(masm); |
| 357 } | 344 } |
| 358 | 345 |
| 359 | 346 |
| 360 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 347 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 361 bool is_api_function, | 348 bool is_api_function, |
| 362 bool count_constructions) { | 349 bool count_constructions) { |
| 363 // ----------- S t a t e ------------- | 350 // ----------- S t a t e ------------- |
| 364 // -- r0 : number of arguments | 351 // -- r0 : number of arguments |
| 365 // -- r1 : constructor function | 352 // -- r1 : constructor function |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 Generate_JSEntryTrampolineHelper(masm, false); | 775 Generate_JSEntryTrampolineHelper(masm, false); |
| 789 } | 776 } |
| 790 | 777 |
| 791 | 778 |
| 792 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 779 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 793 Generate_JSEntryTrampolineHelper(masm, true); | 780 Generate_JSEntryTrampolineHelper(masm, true); |
| 794 } | 781 } |
| 795 | 782 |
| 796 | 783 |
| 797 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { | 784 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
| 798 // Enter an internal frame. | 785 CallRuntimePassFunction(masm, Runtime::kLazyCompile); |
| 799 { | |
| 800 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 801 | |
| 802 // Preserve the function. | |
| 803 __ push(r1); | |
| 804 // Push call kind information. | |
| 805 __ push(r5); | |
| 806 | |
| 807 // Push the function on the stack as the argument to the runtime function. | |
| 808 __ push(r1); | |
| 809 __ CallRuntime(Runtime::kLazyCompile, 1); | |
| 810 // Calculate the entry point. | |
| 811 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 812 | |
| 813 // Restore call kind information. | |
| 814 __ pop(r5); | |
| 815 // Restore saved function. | |
| 816 __ pop(r1); | |
| 817 | |
| 818 // Tear down internal frame. | |
| 819 } | |
| 820 | |
| 821 // Do a tail-call of the compiled function. | 786 // Do a tail-call of the compiled function. |
| 787 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 822 __ Jump(r2); | 788 __ Jump(r2); |
| 823 } | 789 } |
| 824 | 790 |
| 825 | 791 |
| 826 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { | 792 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
| 827 // Enter an internal frame. | 793 CallRuntimePassFunction(masm, Runtime::kLazyRecompile); |
| 828 { | |
| 829 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 830 | |
| 831 // Preserve the function. | |
| 832 __ push(r1); | |
| 833 // Push call kind information. | |
| 834 __ push(r5); | |
| 835 | |
| 836 // Push the function on the stack as the argument to the runtime function. | |
| 837 __ push(r1); | |
| 838 __ CallRuntime(Runtime::kLazyRecompile, 1); | |
| 839 // Calculate the entry point. | |
| 840 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 841 | |
| 842 // Restore call kind information. | |
| 843 __ pop(r5); | |
| 844 // Restore saved function. | |
| 845 __ pop(r1); | |
| 846 | |
| 847 // Tear down internal frame. | |
| 848 } | |
| 849 | |
| 850 // Do a tail-call of the compiled function. | 794 // Do a tail-call of the compiled function. |
| 795 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 851 __ Jump(r2); | 796 __ Jump(r2); |
| 852 } | 797 } |
| 853 | 798 |
| 854 | 799 |
| 855 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 800 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
| 856 // For now, we are relying on the fact that make_code_young doesn't do any | 801 // For now, we are relying on the fact that make_code_young doesn't do any |
| 857 // garbage collection which allows us to save/restore the registers without | 802 // garbage collection which allows us to save/restore the registers without |
| 858 // worrying about which of them contain pointers. We also don't build an | 803 // worrying about which of them contain pointers. We also don't build an |
| 859 // internal frame to make the code faster, since we shouldn't have to do stack | 804 // internal frame to make the code faster, since we shouldn't have to do stack |
| 860 // crawls in MakeCodeYoung. This seems a bit fragile. | 805 // crawls in MakeCodeYoung. This seems a bit fragile. |
| 861 | 806 |
| 862 // The following registers must be saved and restored when calling through to | 807 // The following registers must be saved and restored when calling through to |
| 863 // the runtime: | 808 // the runtime: |
| 864 // r0 - contains return address (beginning of patch sequence) | 809 // r0 - contains return address (beginning of patch sequence) |
| 865 // r1 - function object | 810 // r1 - isolate |
| 866 FrameScope scope(masm, StackFrame::MANUAL); | 811 FrameScope scope(masm, StackFrame::MANUAL); |
| 867 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); | 812 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); |
| 868 __ PrepareCallCFunction(1, 0, r1); | 813 __ PrepareCallCFunction(1, 0, r2); |
| 814 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate()))); |
| 869 __ CallCFunction( | 815 __ CallCFunction( |
| 870 ExternalReference::get_make_code_young_function(masm->isolate()), 1); | 816 ExternalReference::get_make_code_young_function(masm->isolate()), 2); |
| 871 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); | 817 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); |
| 872 __ mov(pc, r0); | 818 __ mov(pc, r0); |
| 873 } | 819 } |
| 874 | 820 |
| 875 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ | 821 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ |
| 876 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ | 822 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ |
| 877 MacroAssembler* masm) { \ | 823 MacroAssembler* masm) { \ |
| 878 GenerateMakeCodeYoungAgainCommon(masm); \ | 824 GenerateMakeCodeYoungAgainCommon(masm); \ |
| 879 } \ | 825 } \ |
| 880 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ | 826 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 __ bind(&dont_adapt_arguments); | 1438 __ bind(&dont_adapt_arguments); |
| 1493 __ Jump(r3); | 1439 __ Jump(r3); |
| 1494 } | 1440 } |
| 1495 | 1441 |
| 1496 | 1442 |
| 1497 #undef __ | 1443 #undef __ |
| 1498 | 1444 |
| 1499 } } // namespace v8::internal | 1445 } } // namespace v8::internal |
| 1500 | 1446 |
| 1501 #endif // V8_TARGET_ARCH_ARM | 1447 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |