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

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

Issue 110203002: Refactor the compiling pipeline. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years 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/api.cc ('k') | src/bootstrapper.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 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)
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 __ bind(&dont_adapt_arguments); 1490 __ bind(&dont_adapt_arguments);
1474 __ Jump(r3); 1491 __ Jump(r3);
1475 } 1492 }
1476 1493
1477 1494
1478 #undef __ 1495 #undef __
1479 1496
1480 } } // namespace v8::internal 1497 } } // namespace v8::internal
1481 1498
1482 #endif // V8_TARGET_ARCH_ARM 1499 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698