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

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

Issue 153913002: A64: Synchronize with r16756. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/isolate.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0); 292 __ IncrementCounter(counters->string_ctor_gc_required(), 1, a3, t0);
293 { 293 {
294 FrameScope scope(masm, StackFrame::INTERNAL); 294 FrameScope scope(masm, StackFrame::INTERNAL);
295 __ push(argument); 295 __ push(argument);
296 __ CallRuntime(Runtime::kNewStringWrapper, 1); 296 __ CallRuntime(Runtime::kNewStringWrapper, 1);
297 } 297 }
298 __ Ret(); 298 __ Ret();
299 } 299 }
300 300
301 301
302 static void CallRuntimePassFunction(MacroAssembler* masm,
303 Runtime::FunctionId function_id) {
304 FrameScope scope(masm, StackFrame::INTERNAL);
305 // Push a copy of the function onto the stack.
306 __ push(a1);
307 // Push call kind information.
308 __ push(t1);
309 // Function is also the parameter to the runtime call.
310 __ push(a1);
311
312 __ CallRuntime(function_id, 1);
313 // Restore call kind information.
314 __ pop(t1);
315 // Restore receiver.
316 __ pop(a1);
317 }
318
319
302 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 320 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
303 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 321 __ lw(a2, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
304 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset)); 322 __ lw(a2, FieldMemOperand(a2, SharedFunctionInfo::kCodeOffset));
305 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag)); 323 __ Addu(at, a2, Operand(Code::kHeaderSize - kHeapObjectTag));
306 __ Jump(at); 324 __ Jump(at);
307 } 325 }
308 326
309 327
310 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { 328 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
329 // Checking whether the queued function is ready for install is optional,
330 // since we come across interrupts and stack checks elsewhere. However,
331 // not checking may delay installing ready functions, and always checking
332 // would be quite expensive. A good compromise is to first check against
333 // stack limit as a cue for an interrupt signal.
334 Label ok;
335 __ LoadRoot(t0, Heap::kStackLimitRootIndex);
336 __ Branch(&ok, hs, sp, Operand(t0));
337
338 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
339 // Tail call to returned code.
340 __ Addu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
341 __ Jump(at);
342
343 __ bind(&ok);
311 GenerateTailCallToSharedCode(masm); 344 GenerateTailCallToSharedCode(masm);
312 } 345 }
313 346
314 347
315 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
316 // Enter an internal frame.
317 {
318 FrameScope scope(masm, StackFrame::INTERNAL);
319
320 // Preserve the function.
321 __ push(a1);
322 // Push call kind information.
323 __ push(t1);
324
325 // Push the function on the stack as the argument to the runtime function.
326 __ push(a1);
327 __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
328 // Calculate the entry point.
329 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
330
331 // Restore call kind information.
332 __ pop(t1);
333 // Restore saved function.
334 __ pop(a1);
335
336 // Tear down temporary frame.
337 }
338
339 // Do a tail-call of the compiled function.
340 __ Jump(t9);
341 }
342
343
344 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { 348 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
345 { 349 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
346 FrameScope scope(masm, StackFrame::INTERNAL);
347
348 // Push a copy of the function onto the stack.
349 __ push(a1);
350 // Push call kind information.
351 __ push(t1);
352
353 __ push(a1); // Function is also the parameter to the runtime call.
354 __ CallRuntime(Runtime::kConcurrentRecompile, 1);
355
356 // Restore call kind information.
357 __ pop(t1);
358 // Restore receiver.
359 __ pop(a1);
360
361 // Tear down internal frame.
362 }
363
364 GenerateTailCallToSharedCode(masm); 350 GenerateTailCallToSharedCode(masm);
365 } 351 }
366 352
367 353
368 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 354 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
369 bool is_api_function, 355 bool is_api_function,
370 bool count_constructions) { 356 bool count_constructions) {
371 // ----------- S t a t e ------------- 357 // ----------- S t a t e -------------
372 // -- a0 : number of arguments 358 // -- a0 : number of arguments
373 // -- a1 : constructor function 359 // -- a1 : constructor function
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 Generate_JSEntryTrampolineHelper(masm, false); 794 Generate_JSEntryTrampolineHelper(masm, false);
809 } 795 }
810 796
811 797
812 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 798 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
813 Generate_JSEntryTrampolineHelper(masm, true); 799 Generate_JSEntryTrampolineHelper(masm, true);
814 } 800 }
815 801
816 802
817 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 803 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
818 // Enter an internal frame. 804 CallRuntimePassFunction(masm, Runtime::kLazyCompile);
819 {
820 FrameScope scope(masm, StackFrame::INTERNAL);
821
822 // Preserve the function.
823 __ push(a1);
824 // Push call kind information.
825 __ push(t1);
826
827 // Push the function on the stack as the argument to the runtime function.
828 __ push(a1);
829 // Call the runtime function.
830 __ CallRuntime(Runtime::kLazyCompile, 1);
831 // Calculate the entry point.
832 __ addiu(t9, v0, Code::kHeaderSize - kHeapObjectTag);
833
834 // Restore call kind information.
835 __ pop(t1);
836 // Restore saved function.
837 __ pop(a1);
838
839 // Tear down temporary frame.
840 }
841
842 // Do a tail-call of the compiled function. 805 // Do a tail-call of the compiled function.
806 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
843 __ Jump(t9); 807 __ Jump(t9);
844 } 808 }
845 809
846 810
847 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 811 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
848 // Enter an internal frame. 812 CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
849 {
850 FrameScope scope(masm, StackFrame::INTERNAL);
851
852 // Preserve the function.
853 __ push(a1);
854 // Push call kind information.
855 __ push(t1);
856
857 // Push the function on the stack as the argument to the runtime function.
858 __ push(a1);
859 __ CallRuntime(Runtime::kLazyRecompile, 1);
860 // Calculate the entry point.
861 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
862
863 // Restore call kind information.
864 __ pop(t1);
865 // Restore saved function.
866 __ pop(a1);
867
868 // Tear down temporary frame.
869 }
870
871 // Do a tail-call of the compiled function. 813 // Do a tail-call of the compiled function.
814 __ Addu(t9, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
872 __ Jump(t9); 815 __ Jump(t9);
873 } 816 }
874 817
875 818
876 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 819 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
877 // For now, we are relying on the fact that make_code_young doesn't do any 820 // For now, we are relying on the fact that make_code_young doesn't do any
878 // garbage collection which allows us to save/restore the registers without 821 // garbage collection which allows us to save/restore the registers without
879 // worrying about which of them contain pointers. We also don't build an 822 // worrying about which of them contain pointers. We also don't build an
880 // internal frame to make the code faster, since we shouldn't have to do stack 823 // internal frame to make the code faster, since we shouldn't have to do stack
881 // crawls in MakeCodeYoung. This seems a bit fragile. 824 // crawls in MakeCodeYoung. This seems a bit fragile.
882 825
883 __ mov(a0, ra); 826 __ mov(a0, ra);
884 // Adjust a0 to point to the head of the PlatformCodeAge sequence 827 // Adjust a0 to point to the head of the PlatformCodeAge sequence
885 __ Subu(a0, a0, 828 __ Subu(a0, a0,
886 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize)); 829 Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize));
887 // Restore the original return address of the function 830 // Restore the original return address of the function
888 __ mov(ra, at); 831 __ mov(ra, at);
889 832
890 // The following registers must be saved and restored when calling through to 833 // The following registers must be saved and restored when calling through to
891 // the runtime: 834 // the runtime:
892 // a0 - contains return address (beginning of patch sequence) 835 // a0 - contains return address (beginning of patch sequence)
893 // a1 - function object 836 // a1 - isolate
894 RegList saved_regs = 837 RegList saved_regs =
895 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit(); 838 (a0.bit() | a1.bit() | ra.bit() | fp.bit()) & ~sp.bit();
896 FrameScope scope(masm, StackFrame::MANUAL); 839 FrameScope scope(masm, StackFrame::MANUAL);
897 __ MultiPush(saved_regs); 840 __ MultiPush(saved_regs);
898 __ PrepareCallCFunction(1, 0, a1); 841 __ PrepareCallCFunction(1, 0, a2);
842 __ li(a1, Operand(ExternalReference::isolate_address(masm->isolate())));
899 __ CallCFunction( 843 __ CallCFunction(
900 ExternalReference::get_make_code_young_function(masm->isolate()), 1); 844 ExternalReference::get_make_code_young_function(masm->isolate()), 2);
901 __ MultiPop(saved_regs); 845 __ MultiPop(saved_regs);
902 __ Jump(a0); 846 __ Jump(a0);
903 } 847 }
904 848
905 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ 849 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \
906 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ 850 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \
907 MacroAssembler* masm) { \ 851 MacroAssembler* masm) { \
908 GenerateMakeCodeYoungAgainCommon(masm); \ 852 GenerateMakeCodeYoungAgainCommon(masm); \
909 } \ 853 } \
910 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \ 854 void Builtins::Generate_Make##C##CodeYoungAgainOddMarking( \
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 __ bind(&dont_adapt_arguments); 1476 __ bind(&dont_adapt_arguments);
1533 __ Jump(a3); 1477 __ Jump(a3);
1534 } 1478 }
1535 1479
1536 1480
1537 #undef __ 1481 #undef __
1538 1482
1539 } } // namespace v8::internal 1483 } } // namespace v8::internal
1540 1484
1541 #endif // V8_TARGET_ARCH_MIPS 1485 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698