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

Side by Side Diff: src/a64/builtins-a64.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 | « samples/samples.gyp ('k') | src/a64/code-stubs-a64.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 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 __ IncrementCounter(counters->string_ctor_gc_required(), 1, x10, x11); 275 __ IncrementCounter(counters->string_ctor_gc_required(), 1, x10, x11);
276 { 276 {
277 FrameScope scope(masm, StackFrame::INTERNAL); 277 FrameScope scope(masm, StackFrame::INTERNAL);
278 __ Push(argument); 278 __ Push(argument);
279 __ CallRuntime(Runtime::kNewStringWrapper, 1); 279 __ CallRuntime(Runtime::kNewStringWrapper, 1);
280 } 280 }
281 __ Ret(); 281 __ Ret();
282 } 282 }
283 283
284 284
285 static void CallRuntimePassFunction(MacroAssembler* masm,
286 Runtime::FunctionId function_id) {
287 FrameScope scope(masm, StackFrame::INTERNAL);
288 // - Push a copy of the function onto the stack.
289 // - Push call kind information.
290 // - Function is also the parameter to the runtime call.
291 __ Push(x1, x5, x1);
292
293 __ CallRuntime(function_id, 1);
294
295 // - Restore call kind information.
296 // - Restore receiver.
297 __ Pop(x5, x1);
298 }
299
300
285 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 301 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
286 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); 302 __ Ldr(x2, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset));
287 __ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset)); 303 __ Ldr(x2, FieldMemOperand(x2, SharedFunctionInfo::kCodeOffset));
288 __ Add(x2, x2, Code::kHeaderSize - kHeapObjectTag); 304 __ Add(x2, x2, Code::kHeaderSize - kHeapObjectTag);
289 __ Br(x2); 305 __ Br(x2);
290 } 306 }
291 307
292 308
293 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { 309 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) {
310 // Checking whether the queued function is ready for install is optional,
311 // since we come across interrupts and stack checks elsewhere. However, not
312 // checking may delay installing ready functions, and always checking would be
313 // quite expensive. A good compromise is to first check against stack limit as
314 // a cue for an interrupt signal.
315 Label ok;
316 __ CompareRoot(masm->StackPointer(), Heap::kStackLimitRootIndex);
317 __ B(hs, &ok);
318
319 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode);
320
321 // Tail call to returned code.
322 __ Add(x0, x0, Code::kHeaderSize - kHeapObjectTag);
323 __ Br(x0);
324
325 __ Bind(&ok);
294 GenerateTailCallToSharedCode(masm); 326 GenerateTailCallToSharedCode(masm);
295 } 327 }
296 328
297 329
298 void Builtins::Generate_InstallRecompiledCode(MacroAssembler* masm) {
299 // Enter an internal frame.
300 {
301 FrameScope scope(masm, StackFrame::INTERNAL);
302
303 // Preserve the function and the call kind information.
304 __ Push(x1, x5);
305
306 // Push the function on the stack as the argument to the runtime function.
307 __ Push(x1);
308 __ CallRuntime(Runtime::kInstallRecompiledCode, 1);
309 // Calculate the entry point.
310 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag);
311
312 // Restore call kind information and saved function.
313 __ Pop(x5, x1);
314
315 // Tear down internal frame.
316 }
317
318 // Do a tail-call of the compiled function.
319 __ Jump(x2);
320 }
321
322
323 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) { 330 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
324 { 331 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
325 FrameScope scope(masm, StackFrame::INTERNAL);
326
327 // Push a copy of the function and call kind information on to the stack.
328 __ Push(x1, x5);
329
330 // Pointer to the function is also the parameter to the runtime call.
331 __ Push(x1);
332 __ CallRuntime(Runtime::kConcurrentRecompile, 1);
333
334 // Restore call kind information and receiver.
335 __ Pop(x5, x1);
336
337 // Tear down internal frame.
338 }
339 GenerateTailCallToSharedCode(masm); 332 GenerateTailCallToSharedCode(masm);
340 } 333 }
341 334
342 335
343 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 336 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
344 bool is_api_function, 337 bool is_api_function,
345 bool count_constructions) { 338 bool count_constructions) {
346 // ----------- S t a t e ------------- 339 // ----------- S t a t e -------------
347 // -- x0 : number of arguments 340 // -- x0 : number of arguments
348 // -- x1 : constructor function 341 // -- x1 : constructor function
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 749 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
757 Generate_JSEntryTrampolineHelper(masm, false); 750 Generate_JSEntryTrampolineHelper(masm, false);
758 } 751 }
759 752
760 753
761 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 754 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
762 Generate_JSEntryTrampolineHelper(masm, true); 755 Generate_JSEntryTrampolineHelper(masm, true);
763 } 756 }
764 757
765 758
766 static void GenerateLazyCompile(MacroAssembler* masm, Runtime::FunctionId fid) {
767 ASSERT((fid == Runtime::kLazyCompile) || (fid == Runtime::kLazyRecompile));
768 // x1: function.
769 // x5: call kind (set by SetCallKind()).
770 Register function = x1;
771 Register call_kind = x5;
772
773 // Enter an internal frame.
774 {
775 FrameScope scope(masm, StackFrame::INTERNAL);
776
777 // Preserve the function and push the call kind information.
778 __ Push(function, call_kind);
779
780 // Push the function on the stack as the argument to the runtime function.
781 __ Push(function);
782
783 __ CallRuntime(fid, 1);
784 // Calculate the entry point.
785 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag);
786
787 // Restore call kind information and the saved function.
788 __ Pop(call_kind, function);
789
790 // Tear down internal frame.
791 }
792
793 // Do a tail-call of the compiled function.
794 __ Jump(x2);
795 }
796
797
798 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 759 void Builtins::Generate_LazyCompile(MacroAssembler* masm) {
799 GenerateLazyCompile(masm, Runtime::kLazyCompile); 760 CallRuntimePassFunction(masm, Runtime::kLazyCompile);
761 // Do a tail-call of the compiled function.
762 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag);
763 __ Br(x2);
800 } 764 }
801 765
802 766
803 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 767 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) {
804 GenerateLazyCompile(masm, Runtime::kLazyRecompile); 768 CallRuntimePassFunction(masm, Runtime::kLazyRecompile);
769 // Do a tail-call of the compiled function.
770 __ Add(x2, x0, Code::kHeaderSize - kHeapObjectTag);
771 __ Br(x2);
805 } 772 }
806 773
807 774
808 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 775 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
809 // For now, we are relying on the fact that make_code_young doesn't do any 776 // For now, we are relying on the fact that make_code_young doesn't do any
810 // garbage collection which allows us to save/restore the registers without 777 // garbage collection which allows us to save/restore the registers without
811 // worrying about which of them contain pointers. We also don't build an 778 // worrying about which of them contain pointers. We also don't build an
812 // internal frame to make the code fast, since we shouldn't have to do stack 779 // internal frame to make the code fast, since we shouldn't have to do stack
813 // crawls in MakeCodeYoung. This seems a bit fragile. 780 // crawls in MakeCodeYoung. This seems a bit fragile.
814 781
815 // The following caller-saved registers must be saved and restored when 782 // The following caller-saved registers must be saved and restored when
816 // calling through to the runtime: 783 // calling through to the runtime:
817 // x0 - The address from which to resume execution. 784 // x0 - The address from which to resume execution.
818 // x1 - The JSFunction object. 785 // x1 - isolate
819 // lr - The return address for the JSFunction itself. It has not yet been 786 // lr - The return address for the JSFunction itself. It has not yet been
820 // preserved on the stack because the frame setup code was replaced 787 // preserved on the stack because the frame setup code was replaced
821 // with a call to this stub, to handle code ageing. 788 // with a call to this stub, to handle code ageing.
822 { 789 {
823 FrameScope scope(masm, StackFrame::MANUAL); 790 FrameScope scope(masm, StackFrame::MANUAL);
824 __ Push(x0, x1, fp, lr); 791 __ Push(x0, x1, fp, lr);
792 __ Mov(x1, Operand(ExternalReference::isolate_address(masm->isolate())));
825 __ CallCFunction( 793 __ CallCFunction(
826 ExternalReference::get_make_code_young_function(masm->isolate()), 1); 794 ExternalReference::get_make_code_young_function(masm->isolate()), 2);
827 __ Pop(lr, fp, x1, x0); 795 __ Pop(lr, fp, x1, x0);
828 } 796 }
829 797
830 // The calling function has been made young again, so return to execute the 798 // The calling function has been made young again, so return to execute the
831 // real frame set-up code. 799 // real frame set-up code.
832 __ Br(x0); 800 __ Br(x0);
833 } 801 }
834 802
835 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ 803 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \
836 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ 804 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 __ Bind(&dont_adapt_arguments); 1440 __ Bind(&dont_adapt_arguments);
1473 __ Jump(x3); 1441 __ Jump(x3);
1474 } 1442 }
1475 1443
1476 1444
1477 #undef __ 1445 #undef __
1478 1446
1479 } } // namespace v8::internal 1447 } } // namespace v8::internal
1480 1448
1481 #endif // V8_TARGET_ARCH_ARM 1449 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « samples/samples.gyp ('k') | src/a64/code-stubs-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698