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

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

Issue 157503002: A64: Synchronize with r18444. (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/arm/assembler-arm.cc ('k') | src/arm/code-stubs-arm.h » ('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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4); 282 __ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4);
283 { 283 {
284 FrameScope scope(masm, StackFrame::INTERNAL); 284 FrameScope scope(masm, StackFrame::INTERNAL);
285 __ push(argument); 285 __ push(argument);
286 __ CallRuntime(Runtime::kNewStringWrapper, 1); 286 __ CallRuntime(Runtime::kNewStringWrapper, 1);
287 } 287 }
288 __ Ret(); 288 __ Ret();
289 } 289 }
290 290
291 291
292 static void CallRuntimePassFunction(MacroAssembler* masm, 292 static void CallRuntimePassFunction(
293 Runtime::FunctionId function_id) { 293 MacroAssembler* masm, Runtime::FunctionId function_id) {
294 FrameScope scope(masm, StackFrame::INTERNAL); 294 FrameScope scope(masm, StackFrame::INTERNAL);
295 // Push a copy of the function onto the stack. 295 // Push a copy of the function onto the stack.
296 __ push(r1); 296 __ push(r1);
297 // Push call kind information and function as parameter to the runtime call. 297 // Push call kind information and function as parameter to the runtime call.
298 __ Push(r5, r1); 298 __ Push(r5, r1);
299 299
300 __ CallRuntime(function_id, 1); 300 __ CallRuntime(function_id, 1);
301 // Restore call kind information. 301 // Restore call kind information.
302 __ pop(r5); 302 __ pop(r5);
303 // Restore receiver. 303 // Restore receiver.
304 __ pop(r1); 304 __ pop(r1);
305 } 305 }
306 306
307 307
308 static void GenerateTailCallToSharedCode(MacroAssembler* masm) { 308 static void GenerateTailCallToSharedCode(MacroAssembler* masm) {
309 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 309 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
310 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset)); 310 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
311 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); 311 __ add(r2, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
312 __ Jump(r2); 312 __ Jump(r2);
313 } 313 }
314 314
315 315
316 void Builtins::Generate_InRecompileQueue(MacroAssembler* masm) { 316 static void GenerateTailCallToReturnedCode(MacroAssembler* masm) {
317 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
318 __ Jump(r0);
319 }
320
321
322 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
317 // Checking whether the queued function is ready for install is optional, 323 // Checking whether the queued function is ready for install is optional,
318 // since we come across interrupts and stack checks elsewhere. However, 324 // since we come across interrupts and stack checks elsewhere. However,
319 // not checking may delay installing ready functions, and always checking 325 // not checking may delay installing ready functions, and always checking
320 // would be quite expensive. A good compromise is to first check against 326 // would be quite expensive. A good compromise is to first check against
321 // stack limit as a cue for an interrupt signal. 327 // stack limit as a cue for an interrupt signal.
322 Label ok; 328 Label ok;
323 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 329 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
324 __ cmp(sp, Operand(ip)); 330 __ cmp(sp, Operand(ip));
325 __ b(hs, &ok); 331 __ b(hs, &ok);
326 332
327 CallRuntimePassFunction(masm, Runtime::kTryInstallRecompiledCode); 333 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode);
328 // Tail call to returned code. 334 GenerateTailCallToReturnedCode(masm);
329 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
330 __ Jump(r0);
331 335
332 __ bind(&ok); 336 __ bind(&ok);
333 GenerateTailCallToSharedCode(masm); 337 GenerateTailCallToSharedCode(masm);
334 } 338 }
335 339
336 340
337 void Builtins::Generate_ConcurrentRecompile(MacroAssembler* masm) {
338 CallRuntimePassFunction(masm, Runtime::kConcurrentRecompile);
339 GenerateTailCallToSharedCode(masm);
340 }
341
342
343 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 341 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
344 bool is_api_function, 342 bool is_api_function,
345 bool count_constructions) { 343 bool count_constructions) {
346 // ----------- S t a t e ------------- 344 // ----------- S t a t e -------------
347 // -- r0 : number of arguments 345 // -- r0 : number of arguments
348 // -- r1 : constructor function 346 // -- r1 : constructor function
349 // -- lr : return address 347 // -- lr : return address
350 // -- sp[...]: constructor arguments 348 // -- sp[...]: constructor arguments
351 // ----------------------------------- 349 // -----------------------------------
352 350
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 765 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
768 Generate_JSEntryTrampolineHelper(masm, false); 766 Generate_JSEntryTrampolineHelper(masm, false);
769 } 767 }
770 768
771 769
772 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 770 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
773 Generate_JSEntryTrampolineHelper(masm, true); 771 Generate_JSEntryTrampolineHelper(masm, true);
774 } 772 }
775 773
776 774
777 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { 775 void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
778 CallRuntimePassFunction(masm, Runtime::kLazyCompile); 776 CallRuntimePassFunction(masm, Runtime::kCompileUnoptimized);
779 // Do a tail-call of the compiled function. 777 GenerateTailCallToReturnedCode(masm);
780 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag));
781 __ Jump(r2);
782 } 778 }
783 779
784 780
785 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { 781 static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
786 CallRuntimePassFunction(masm, Runtime::kLazyRecompile); 782 FrameScope scope(masm, StackFrame::INTERNAL);
787 // Do a tail-call of the compiled function. 783 // Push a copy of the function onto the stack.
788 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); 784 __ push(r1);
789 __ Jump(r2); 785 // Push call kind information and function as parameter to the runtime call.
786 __ Push(r5, r1);
787 // Whether to compile in a background thread.
788 __ Push(masm->isolate()->factory()->ToBoolean(concurrent));
789
790 __ CallRuntime(Runtime::kCompileOptimized, 2);
791 // Restore call kind information.
792 __ pop(r5);
793 // Restore receiver.
794 __ pop(r1);
790 } 795 }
791 796
792 797
798 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
799 CallCompileOptimized(masm, false);
800 GenerateTailCallToReturnedCode(masm);
801 }
802
803
804 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) {
805 CallCompileOptimized(masm, true);
806 GenerateTailCallToReturnedCode(masm);
807 }
808
809
793 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { 810 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
794 // For now, we are relying on the fact that make_code_young doesn't do any 811 // For now, we are relying on the fact that make_code_young doesn't do any
795 // garbage collection which allows us to save/restore the registers without 812 // garbage collection which allows us to save/restore the registers without
796 // worrying about which of them contain pointers. We also don't build an 813 // worrying about which of them contain pointers. We also don't build an
797 // internal frame to make the code faster, since we shouldn't have to do stack 814 // internal frame to make the code faster, since we shouldn't have to do stack
798 // crawls in MakeCodeYoung. This seems a bit fragile. 815 // crawls in MakeCodeYoung. This seems a bit fragile.
799 816
800 // The following registers must be saved and restored when calling through to 817 // The following registers must be saved and restored when calling through to
801 // the runtime: 818 // the runtime:
802 // r0 - contains return address (beginning of patch sequence) 819 // r0 - contains return address (beginning of patch sequence)
803 // r1 - isolate 820 // r1 - isolate
804 FrameScope scope(masm, StackFrame::MANUAL); 821 FrameScope scope(masm, StackFrame::MANUAL);
805 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); 822 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
806 __ PrepareCallCFunction(1, 0, r2); 823 __ PrepareCallCFunction(2, 0, r2);
807 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate()))); 824 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate())));
808 __ CallCFunction( 825 __ CallCFunction(
809 ExternalReference::get_make_code_young_function(masm->isolate()), 2); 826 ExternalReference::get_make_code_young_function(masm->isolate()), 2);
810 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); 827 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
811 __ mov(pc, r0); 828 __ mov(pc, r0);
812 } 829 }
813 830
814 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \ 831 #define DEFINE_CODE_AGE_BUILTIN_GENERATOR(C) \
815 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \ 832 void Builtins::Generate_Make##C##CodeYoungAgainEvenMarking( \
816 MacroAssembler* masm) { \ 833 MacroAssembler* masm) { \
(...skipping 12 matching lines...) Expand all
829 // that make_code_young doesn't do any garbage collection which allows us to 846 // that make_code_young doesn't do any garbage collection which allows us to
830 // save/restore the registers without worrying about which of them contain 847 // save/restore the registers without worrying about which of them contain
831 // pointers. 848 // pointers.
832 849
833 // The following registers must be saved and restored when calling through to 850 // The following registers must be saved and restored when calling through to
834 // the runtime: 851 // the runtime:
835 // r0 - contains return address (beginning of patch sequence) 852 // r0 - contains return address (beginning of patch sequence)
836 // r1 - isolate 853 // r1 - isolate
837 FrameScope scope(masm, StackFrame::MANUAL); 854 FrameScope scope(masm, StackFrame::MANUAL);
838 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); 855 __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
839 __ PrepareCallCFunction(1, 0, r2); 856 __ PrepareCallCFunction(2, 0, r2);
840 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate()))); 857 __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate())));
841 __ CallCFunction(ExternalReference::get_mark_code_as_executed_function( 858 __ CallCFunction(ExternalReference::get_mark_code_as_executed_function(
842 masm->isolate()), 2); 859 masm->isolate()), 2);
843 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit()); 860 __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
844 861
845 // Perform prologue operations usually performed by the young code stub. 862 // Perform prologue operations usually performed by the young code stub.
846 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); 863 __ PushFixedFrame(r1);
847 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); 864 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
848 865
849 // Jump to point after the code-age stub. 866 // Jump to point after the code-age stub.
850 __ add(r0, r0, Operand(kNoCodeAgeSequenceLength * Assembler::kInstrSize)); 867 __ add(r0, r0, Operand(kNoCodeAgeSequenceLength * Assembler::kInstrSize));
851 __ mov(pc, r0); 868 __ mov(pc, r0);
852 } 869 }
853 870
854 871
855 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) { 872 void Builtins::Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm) {
856 GenerateMakeCodeYoungAgainCommon(masm); 873 GenerateMakeCodeYoungAgainCommon(masm);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { 948 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) {
932 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); 949 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
933 } 950 }
934 951
935 952
936 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 953 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
937 // Lookup the function in the JavaScript frame. 954 // Lookup the function in the JavaScript frame.
938 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 955 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
939 { 956 {
940 FrameScope scope(masm, StackFrame::INTERNAL); 957 FrameScope scope(masm, StackFrame::INTERNAL);
941 // Lookup and calculate pc offset. 958 // Pass function as argument.
942 __ ldr(r1, MemOperand(fp, StandardFrameConstants::kCallerPCOffset));
943 __ ldr(r2, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset));
944 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
945 __ sub(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag));
946 __ sub(r1, r1, r2);
947 __ SmiTag(r1);
948
949 // Pass both function and pc offset as arguments.
950 __ push(r0); 959 __ push(r0);
951 __ push(r1); 960 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1);
952 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 2);
953 } 961 }
954 962
955 // If the code object is null, just return to the unoptimized code. 963 // If the code object is null, just return to the unoptimized code.
956 Label skip; 964 Label skip;
957 __ cmp(r0, Operand(Smi::FromInt(0))); 965 __ cmp(r0, Operand(Smi::FromInt(0)));
958 __ b(ne, &skip); 966 __ b(ne, &skip);
959 __ Ret(); 967 __ Ret();
960 968
961 __ bind(&skip); 969 __ bind(&skip);
962 970
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 // Tear down the internal frame and remove function, receiver and args. 1354 // Tear down the internal frame and remove function, receiver and args.
1347 } 1355 }
1348 __ add(sp, sp, Operand(3 * kPointerSize)); 1356 __ add(sp, sp, Operand(3 * kPointerSize));
1349 __ Jump(lr); 1357 __ Jump(lr);
1350 } 1358 }
1351 1359
1352 1360
1353 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1361 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1354 __ SmiTag(r0); 1362 __ SmiTag(r0);
1355 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1363 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1356 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit()); 1364 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() |
1365 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) |
1366 fp.bit() | lr.bit());
1357 __ add(fp, sp, 1367 __ add(fp, sp,
1358 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); 1368 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
1359 } 1369 }
1360 1370
1361 1371
1362 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { 1372 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
1363 // ----------- S t a t e ------------- 1373 // ----------- S t a t e -------------
1364 // -- r0 : result being passed through 1374 // -- r0 : result being passed through
1365 // ----------------------------------- 1375 // -----------------------------------
1366 // Get the number of arguments passed (as a smi), tear down the frame and 1376 // Get the number of arguments passed (as a smi), tear down the frame and
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 __ bind(&dont_adapt_arguments); 1492 __ bind(&dont_adapt_arguments);
1483 __ Jump(r3); 1493 __ Jump(r3);
1484 } 1494 }
1485 1495
1486 1496
1487 #undef __ 1497 #undef __
1488 1498
1489 } } // namespace v8::internal 1499 } } // namespace v8::internal
1490 1500
1491 #endif // V8_TARGET_ARCH_ARM 1501 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/code-stubs-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698