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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 6852015: Support string add in crankshaft: (Closed)
Patch Set: Review fixes and ports Created 9 years, 8 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
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/lithium-codegen-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 break; 439 break;
440 case TRBinaryOpIC::INT32: 440 case TRBinaryOpIC::INT32:
441 GenerateInt32Stub(masm); 441 GenerateInt32Stub(masm);
442 break; 442 break;
443 case TRBinaryOpIC::HEAP_NUMBER: 443 case TRBinaryOpIC::HEAP_NUMBER:
444 GenerateHeapNumberStub(masm); 444 GenerateHeapNumberStub(masm);
445 break; 445 break;
446 case TRBinaryOpIC::ODDBALL: 446 case TRBinaryOpIC::ODDBALL:
447 GenerateOddballStub(masm); 447 GenerateOddballStub(masm);
448 break; 448 break;
449 case TRBinaryOpIC::BOTH_STRING:
450 GenerateBothStringStub(masm);
451 break;
449 case TRBinaryOpIC::STRING: 452 case TRBinaryOpIC::STRING:
450 GenerateStringStub(masm); 453 GenerateStringStub(masm);
451 break; 454 break;
452 case TRBinaryOpIC::GENERIC: 455 case TRBinaryOpIC::GENERIC:
453 GenerateGeneric(masm); 456 GenerateGeneric(masm);
454 break; 457 break;
455 default: 458 default:
456 UNREACHABLE(); 459 UNREACHABLE();
457 } 460 }
458 } 461 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) { 905 void TypeRecordingBinaryOpStub::GenerateStringStub(MacroAssembler* masm) {
903 ASSERT(operands_type_ == TRBinaryOpIC::STRING); 906 ASSERT(operands_type_ == TRBinaryOpIC::STRING);
904 ASSERT(op_ == Token::ADD); 907 ASSERT(op_ == Token::ADD);
905 // Try to add arguments as strings, otherwise, transition to the generic 908 // Try to add arguments as strings, otherwise, transition to the generic
906 // TRBinaryOpIC type. 909 // TRBinaryOpIC type.
907 GenerateAddStrings(masm); 910 GenerateAddStrings(masm);
908 GenerateTypeTransition(masm); 911 GenerateTypeTransition(masm);
909 } 912 }
910 913
911 914
915 void TypeRecordingBinaryOpStub::GenerateBothStringStub(MacroAssembler* masm) {
916 Label call_runtime;
917 ASSERT(operands_type_ == TRBinaryOpIC::BOTH_STRING);
918 ASSERT(op_ == Token::ADD);
919 // If both arguments are strings, call the string add stub.
920 // Otherwise, do a transition.
921
922 // Registers containing left and right operands respectively.
923 Register left = edx;
924 Register right = eax;
925
926 // Test if left operand is a string.
927 __ test(left, Immediate(kSmiTagMask));
928 __ j(zero, &call_runtime);
929 __ CmpObjectType(left, FIRST_NONSTRING_TYPE, ecx);
930 __ j(above_equal, &call_runtime);
931
932 // Test if right operand is a string.
933 __ test(right, Immediate(kSmiTagMask));
934 __ j(zero, &call_runtime);
935 __ CmpObjectType(right, FIRST_NONSTRING_TYPE, ecx);
936 __ j(above_equal, &call_runtime);
937
938 StringAddStub string_add_stub(NO_STRING_CHECK_IN_STUB);
939 GenerateRegisterArgsPush(masm);
940 __ TailCallStub(&string_add_stub);
941
942 __ bind(&call_runtime);
943 GenerateTypeTransition(masm);
944 }
945
946
912 void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) { 947 void TypeRecordingBinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) {
913 Label call_runtime; 948 Label call_runtime;
914 ASSERT(operands_type_ == TRBinaryOpIC::INT32); 949 ASSERT(operands_type_ == TRBinaryOpIC::INT32);
915 950
916 // Floating point case. 951 // Floating point case.
917 switch (op_) { 952 switch (op_) {
918 case Token::ADD: 953 case Token::ADD:
919 case Token::SUB: 954 case Token::SUB:
920 case Token::MUL: 955 case Token::MUL:
921 case Token::DIV: { 956 case Token::DIV: {
(...skipping 4704 matching lines...) Expand 10 before | Expand all | Expand 10 after
5626 // Do a tail call to the rewritten stub. 5661 // Do a tail call to the rewritten stub.
5627 __ jmp(Operand(edi)); 5662 __ jmp(Operand(edi));
5628 } 5663 }
5629 5664
5630 5665
5631 #undef __ 5666 #undef __
5632 5667
5633 } } // namespace v8::internal 5668 } } // namespace v8::internal
5634 5669
5635 #endif // V8_TARGET_ARCH_IA32 5670 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698