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

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

Issue 652118: Refactored TailCallRuntime (splitted to TailCallRuntime and TailCallExternalReference) (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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/builtins-arm.cc ('k') | src/arm/ic-arm.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 4493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4504 } 4504 }
4505 } 4505 }
4506 4506
4507 // Return result. The argument boilerplate has been popped already. 4507 // Return result. The argument boilerplate has been popped already.
4508 __ Ret(); 4508 __ Ret();
4509 4509
4510 // Create a new closure through the slower runtime call. 4510 // Create a new closure through the slower runtime call.
4511 __ bind(&gc); 4511 __ bind(&gc);
4512 __ push(cp); 4512 __ push(cp);
4513 __ push(r3); 4513 __ push(r3);
4514 __ TailCallRuntime(ExternalReference(Runtime::kNewClosure), 2, 1); 4514 __ TailCallRuntime(Runtime::kNewClosure, 2, 1);
4515 } 4515 }
4516 4516
4517 4517
4518 void FastNewContextStub::Generate(MacroAssembler* masm) { 4518 void FastNewContextStub::Generate(MacroAssembler* masm) {
4519 // Try to allocate the context in new space. 4519 // Try to allocate the context in new space.
4520 Label gc; 4520 Label gc;
4521 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 4521 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
4522 4522
4523 // Attempt to allocate the context in new space. 4523 // Attempt to allocate the context in new space.
4524 __ AllocateInNewSpace(length + (FixedArray::kHeaderSize / kPointerSize), 4524 __ AllocateInNewSpace(length + (FixedArray::kHeaderSize / kPointerSize),
(...skipping 29 matching lines...) Expand all
4554 __ str(r1, MemOperand(r0, Context::SlotOffset(i))); 4554 __ str(r1, MemOperand(r0, Context::SlotOffset(i)));
4555 } 4555 }
4556 4556
4557 // Remove the on-stack argument and return. 4557 // Remove the on-stack argument and return.
4558 __ mov(cp, r0); 4558 __ mov(cp, r0);
4559 __ pop(); 4559 __ pop();
4560 __ Ret(); 4560 __ Ret();
4561 4561
4562 // Need to collect. Call into runtime system. 4562 // Need to collect. Call into runtime system.
4563 __ bind(&gc); 4563 __ bind(&gc);
4564 __ TailCallRuntime(ExternalReference(Runtime::kNewContext), 1, 1); 4564 __ TailCallRuntime(Runtime::kNewContext, 1, 1);
4565 } 4565 }
4566 4566
4567 4567
4568 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { 4568 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
4569 // Stack layout on entry: 4569 // Stack layout on entry:
4570 // 4570 //
4571 // [sp]: constant elements. 4571 // [sp]: constant elements.
4572 // [sp + kPointerSize]: literal index. 4572 // [sp + kPointerSize]: literal index.
4573 // [sp + (2 * kPointerSize)]: literals array. 4573 // [sp + (2 * kPointerSize)]: literals array.
4574 4574
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4616 __ ldr(r1, FieldMemOperand(r3, i)); 4616 __ ldr(r1, FieldMemOperand(r3, i));
4617 __ str(r1, FieldMemOperand(r2, i)); 4617 __ str(r1, FieldMemOperand(r2, i));
4618 } 4618 }
4619 } 4619 }
4620 4620
4621 // Return and remove the on-stack parameters. 4621 // Return and remove the on-stack parameters.
4622 __ add(sp, sp, Operand(3 * kPointerSize)); 4622 __ add(sp, sp, Operand(3 * kPointerSize));
4623 __ Ret(); 4623 __ Ret();
4624 4624
4625 __ bind(&slow_case); 4625 __ bind(&slow_case);
4626 ExternalReference runtime(Runtime::kCreateArrayLiteralShallow); 4626 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
4627 __ TailCallRuntime(runtime, 3, 1);
4628 } 4627 }
4629 4628
4630 4629
4631 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz 4630 // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz
4632 // instruction. On pre-ARM5 hardware this routine gives the wrong answer for 0 4631 // instruction. On pre-ARM5 hardware this routine gives the wrong answer for 0
4633 // (31 instead of 32). 4632 // (31 instead of 32).
4634 static void CountLeadingZeros( 4633 static void CountLeadingZeros(
4635 MacroAssembler* masm, 4634 MacroAssembler* masm,
4636 Register source, 4635 Register source,
4637 Register scratch, 4636 Register scratch,
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
6190 // This code should be unreachable. 6189 // This code should be unreachable.
6191 __ stop("Unreachable"); 6190 __ stop("Unreachable");
6192 } 6191 }
6193 6192
6194 6193
6195 void StackCheckStub::Generate(MacroAssembler* masm) { 6194 void StackCheckStub::Generate(MacroAssembler* masm) {
6196 // Do tail-call to runtime routine. Runtime routines expect at least one 6195 // Do tail-call to runtime routine. Runtime routines expect at least one
6197 // argument, so give it a Smi. 6196 // argument, so give it a Smi.
6198 __ mov(r0, Operand(Smi::FromInt(0))); 6197 __ mov(r0, Operand(Smi::FromInt(0)));
6199 __ push(r0); 6198 __ push(r0);
6200 __ TailCallRuntime(ExternalReference(Runtime::kStackGuard), 1, 1); 6199 __ TailCallRuntime(Runtime::kStackGuard, 1, 1);
6201 6200
6202 __ StubReturn(1); 6201 __ StubReturn(1);
6203 } 6202 }
6204 6203
6205 6204
6206 void GenericUnaryOpStub::Generate(MacroAssembler* masm) { 6205 void GenericUnaryOpStub::Generate(MacroAssembler* masm) {
6207 Label slow, done; 6206 Label slow, done;
6208 6207
6209 if (op_ == Token::SUB) { 6208 if (op_ == Token::SUB) {
6210 // Check whether the value is a smi. 6209 // Check whether the value is a smi.
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
6799 // Read the argument from the adaptor frame and return it. 6798 // Read the argument from the adaptor frame and return it.
6800 __ sub(r3, r0, r1); 6799 __ sub(r3, r0, r1);
6801 __ add(r3, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize)); 6800 __ add(r3, r2, Operand(r3, LSL, kPointerSizeLog2 - kSmiTagSize));
6802 __ ldr(r0, MemOperand(r3, kDisplacement)); 6801 __ ldr(r0, MemOperand(r3, kDisplacement));
6803 __ Jump(lr); 6802 __ Jump(lr);
6804 6803
6805 // Slow-case: Handle non-smi or out-of-bounds access to arguments 6804 // Slow-case: Handle non-smi or out-of-bounds access to arguments
6806 // by calling the runtime system. 6805 // by calling the runtime system.
6807 __ bind(&slow); 6806 __ bind(&slow);
6808 __ push(r1); 6807 __ push(r1);
6809 __ TailCallRuntime(ExternalReference(Runtime::kGetArgumentsProperty), 1, 1); 6808 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1);
6810 } 6809 }
6811 6810
6812 6811
6813 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) { 6812 void ArgumentsAccessStub::GenerateNewObject(MacroAssembler* masm) {
6814 // sp[0] : number of parameters 6813 // sp[0] : number of parameters
6815 // sp[4] : receiver displacement 6814 // sp[4] : receiver displacement
6816 // sp[8] : function 6815 // sp[8] : function
6817 6816
6818 // Check if the calling frame is an arguments adaptor frame. 6817 // Check if the calling frame is an arguments adaptor frame.
6819 Label adaptor_frame, try_allocate, runtime; 6818 Label adaptor_frame, try_allocate, runtime;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
6902 __ cmp(r1, Operand(0)); 6901 __ cmp(r1, Operand(0));
6903 __ b(ne, &loop); 6902 __ b(ne, &loop);
6904 6903
6905 // Return and remove the on-stack parameters. 6904 // Return and remove the on-stack parameters.
6906 __ bind(&done); 6905 __ bind(&done);
6907 __ add(sp, sp, Operand(3 * kPointerSize)); 6906 __ add(sp, sp, Operand(3 * kPointerSize));
6908 __ Ret(); 6907 __ Ret();
6909 6908
6910 // Do the runtime call to allocate the arguments object. 6909 // Do the runtime call to allocate the arguments object.
6911 __ bind(&runtime); 6910 __ bind(&runtime);
6912 __ TailCallRuntime(ExternalReference(Runtime::kNewArgumentsFast), 3, 1); 6911 __ TailCallRuntime(Runtime::kNewArgumentsFast, 3, 1);
6913 } 6912 }
6914 6913
6915 6914
6916 void CallFunctionStub::Generate(MacroAssembler* masm) { 6915 void CallFunctionStub::Generate(MacroAssembler* masm) {
6917 Label slow; 6916 Label slow;
6918 6917
6919 // If the receiver might be a value (string, number or boolean) check for this 6918 // If the receiver might be a value (string, number or boolean) check for this
6920 // and box it if it is. 6919 // and box it if it is.
6921 if (ReceiverMightBeValue()) { 6920 if (ReceiverMightBeValue()) {
6922 // Get the receiver from the stack. 6921 // Get the receiver from the stack.
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
7346 // r5: first character of string to copy. 7345 // r5: first character of string to copy.
7347 ASSERT_EQ(0, SeqTwoByteString::kHeaderSize & kObjectAlignmentMask); 7346 ASSERT_EQ(0, SeqTwoByteString::kHeaderSize & kObjectAlignmentMask);
7348 GenerateCopyCharactersLong(masm, r1, r5, r2, r3, r4, r6, r7, r9, 7347 GenerateCopyCharactersLong(masm, r1, r5, r2, r3, r4, r6, r7, r9,
7349 DEST_ALWAYS_ALIGNED); 7348 DEST_ALWAYS_ALIGNED);
7350 __ IncrementCounter(&Counters::sub_string_native, 1, r3, r4); 7349 __ IncrementCounter(&Counters::sub_string_native, 1, r3, r4);
7351 __ add(sp, sp, Operand(3 * kPointerSize)); 7350 __ add(sp, sp, Operand(3 * kPointerSize));
7352 __ Ret(); 7351 __ Ret();
7353 7352
7354 // Just jump to runtime to create the sub string. 7353 // Just jump to runtime to create the sub string.
7355 __ bind(&runtime); 7354 __ bind(&runtime);
7356 __ TailCallRuntime(ExternalReference(Runtime::kSubString), 3, 1); 7355 __ TailCallRuntime(Runtime::kSubString, 3, 1);
7357 } 7356 }
7358 7357
7359 7358
7360 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm, 7359 void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
7361 Register left, 7360 Register left,
7362 Register right, 7361 Register right,
7363 Register scratch1, 7362 Register scratch1,
7364 Register scratch2, 7363 Register scratch2,
7365 Register scratch3, 7364 Register scratch3,
7366 Register scratch4) { 7365 Register scratch4) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
7437 __ JumpIfNotBothSequentialAsciiStrings(r0, r1, r2, r3, &runtime); 7436 __ JumpIfNotBothSequentialAsciiStrings(r0, r1, r2, r3, &runtime);
7438 7437
7439 // Compare flat ascii strings natively. Remove arguments from stack first. 7438 // Compare flat ascii strings natively. Remove arguments from stack first.
7440 __ IncrementCounter(&Counters::string_compare_native, 1, r2, r3); 7439 __ IncrementCounter(&Counters::string_compare_native, 1, r2, r3);
7441 __ add(sp, sp, Operand(2 * kPointerSize)); 7440 __ add(sp, sp, Operand(2 * kPointerSize));
7442 GenerateCompareFlatAsciiStrings(masm, r0, r1, r2, r3, r4, r5); 7441 GenerateCompareFlatAsciiStrings(masm, r0, r1, r2, r3, r4, r5);
7443 7442
7444 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 7443 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
7445 // tagged as a small integer. 7444 // tagged as a small integer.
7446 __ bind(&runtime); 7445 __ bind(&runtime);
7447 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); 7446 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
7448 } 7447 }
7449 7448
7450 7449
7451 void StringAddStub::Generate(MacroAssembler* masm) { 7450 void StringAddStub::Generate(MacroAssembler* masm) {
7452 Label string_add_runtime; 7451 Label string_add_runtime;
7453 // Stack on entry: 7452 // Stack on entry:
7454 // sp[0]: second argument. 7453 // sp[0]: second argument.
7455 // sp[4]: first argument. 7454 // sp[4]: first argument.
7456 7455
7457 // Load the two arguments. 7456 // Load the two arguments.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
7651 // r7: result string. 7650 // r7: result string.
7652 GenerateCopyCharacters(masm, r6, r1, r3, r4, false); 7651 GenerateCopyCharacters(masm, r6, r1, r3, r4, false);
7653 7652
7654 __ mov(r0, Operand(r7)); 7653 __ mov(r0, Operand(r7));
7655 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3); 7654 __ IncrementCounter(&Counters::string_add_native, 1, r2, r3);
7656 __ add(sp, sp, Operand(2 * kPointerSize)); 7655 __ add(sp, sp, Operand(2 * kPointerSize));
7657 __ Ret(); 7656 __ Ret();
7658 7657
7659 // Just jump to runtime to add the two strings. 7658 // Just jump to runtime to add the two strings.
7660 __ bind(&string_add_runtime); 7659 __ bind(&string_add_runtime);
7661 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1); 7660 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
7662 } 7661 }
7663 7662
7664 7663
7665 #undef __ 7664 #undef __
7666 7665
7667 } } // namespace v8::internal 7666 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/ic-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698