OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 844 |
845 void FullCodeGenerator::SetSourcePosition(int pos) { | 845 void FullCodeGenerator::SetSourcePosition(int pos) { |
846 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) { | 846 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) { |
847 masm_->RecordPosition(pos); | 847 masm_->RecordPosition(pos); |
848 } | 848 } |
849 } | 849 } |
850 | 850 |
851 | 851 |
852 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* expr) { | 852 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* expr) { |
853 Handle<String> name = expr->name(); | 853 Handle<String> name = expr->name(); |
854 if (strcmp("_IsSmi", *name->ToCString()) == 0) { | 854 SmartPointer<char> cstring = name->ToCString(); |
855 EmitIsSmi(expr->arguments()); | 855 |
856 } else if (strcmp("_IsNonNegativeSmi", *name->ToCString()) == 0) { | 856 #define CHECK_EMIT_INLINE_CALL(name, x, y) \ |
857 EmitIsNonNegativeSmi(expr->arguments()); | 857 if (strcmp("_"#name, *cstring) == 0) { \ |
858 } else if (strcmp("_IsObject", *name->ToCString()) == 0) { | 858 Emit##name(expr->arguments()); \ |
859 EmitIsObject(expr->arguments()); | 859 return; \ |
860 } else if (strcmp("_IsSpecObject", *name->ToCString()) == 0) { | |
861 EmitIsSpecObject(expr->arguments()); | |
862 } else if (strcmp("_IsUndetectableObject", *name->ToCString()) == 0) { | |
863 EmitIsUndetectableObject(expr->arguments()); | |
864 } else if (strcmp("_IsFunction", *name->ToCString()) == 0) { | |
865 EmitIsFunction(expr->arguments()); | |
866 } else if (strcmp("_IsArray", *name->ToCString()) == 0) { | |
867 EmitIsArray(expr->arguments()); | |
868 } else if (strcmp("_IsRegExp", *name->ToCString()) == 0) { | |
869 EmitIsRegExp(expr->arguments()); | |
870 } else if (strcmp("_IsConstructCall", *name->ToCString()) == 0) { | |
871 EmitIsConstructCall(expr->arguments()); | |
872 } else if (strcmp("_ObjectEquals", *name->ToCString()) == 0) { | |
873 EmitObjectEquals(expr->arguments()); | |
874 } else if (strcmp("_Arguments", *name->ToCString()) == 0) { | |
875 EmitArguments(expr->arguments()); | |
876 } else if (strcmp("_ArgumentsLength", *name->ToCString()) == 0) { | |
877 EmitArgumentsLength(expr->arguments()); | |
878 } else if (strcmp("_ClassOf", *name->ToCString()) == 0) { | |
879 EmitClassOf(expr->arguments()); | |
880 } else if (strcmp("_Log", *name->ToCString()) == 0) { | |
881 EmitLog(expr->arguments()); | |
882 } else if (strcmp("_RandomHeapNumber", *name->ToCString()) == 0) { | |
883 EmitRandomHeapNumber(expr->arguments()); | |
884 } else if (strcmp("_SubString", *name->ToCString()) == 0) { | |
885 EmitSubString(expr->arguments()); | |
886 } else if (strcmp("_RegExpExec", *name->ToCString()) == 0) { | |
887 EmitRegExpExec(expr->arguments()); | |
888 } else if (strcmp("_ValueOf", *name->ToCString()) == 0) { | |
889 EmitValueOf(expr->arguments()); | |
890 } else if (strcmp("_SetValueOf", *name->ToCString()) == 0) { | |
891 EmitSetValueOf(expr->arguments()); | |
892 } else if (strcmp("_NumberToString", *name->ToCString()) == 0) { | |
893 EmitNumberToString(expr->arguments()); | |
894 } else if (strcmp("_StringCharFromCode", *name->ToCString()) == 0) { | |
895 EmitStringCharFromCode(expr->arguments()); | |
896 } else if (strcmp("_StringCharCodeAt", *name->ToCString()) == 0) { | |
897 EmitStringCharCodeAt(expr->arguments()); | |
898 } else if (strcmp("_StringCharAt", *name->ToCString()) == 0) { | |
899 EmitStringCharAt(expr->arguments()); | |
900 } else if (strcmp("_StringAdd", *name->ToCString()) == 0) { | |
901 EmitStringAdd(expr->arguments()); | |
902 } else if (strcmp("_StringCompare", *name->ToCString()) == 0) { | |
903 EmitStringCompare(expr->arguments()); | |
904 } else if (strcmp("_MathPow", *name->ToCString()) == 0) { | |
905 EmitMathPow(expr->arguments()); | |
906 } else if (strcmp("_MathSin", *name->ToCString()) == 0) { | |
907 EmitMathSin(expr->arguments()); | |
908 } else if (strcmp("_MathCos", *name->ToCString()) == 0) { | |
909 EmitMathCos(expr->arguments()); | |
910 } else if (strcmp("_MathSqrt", *name->ToCString()) == 0) { | |
911 EmitMathSqrt(expr->arguments()); | |
912 } else if (strcmp("_CallFunction", *name->ToCString()) == 0) { | |
913 EmitCallFunction(expr->arguments()); | |
914 } else if (strcmp("_RegExpConstructResult", *name->ToCString()) == 0) { | |
915 EmitRegExpConstructResult(expr->arguments()); | |
916 } else if (strcmp("_SwapElements", *name->ToCString()) == 0) { | |
917 EmitSwapElements(expr->arguments()); | |
918 } else if (strcmp("_GetFromCache", *name->ToCString()) == 0) { | |
919 EmitGetFromCache(expr->arguments()); | |
920 } else if (strcmp("_IsRegExpEquivalent", *name->ToCString()) == 0) { | |
921 EmitIsRegExpEquivalent(expr->arguments()); | |
922 } else if (strcmp("_IsStringWrapperSafeForDefaultValueOf", | |
923 *name->ToCString()) == 0) { | |
924 EmitIsStringWrapperSafeForDefaultValueOf(expr->arguments()); | |
925 } else { | |
926 UNREACHABLE(); | |
927 } | 860 } |
| 861 |
| 862 INLINE_RUNTIME_FUNCTION_LIST(CHECK_EMIT_INLINE_CALL) |
| 863 UNREACHABLE(); |
| 864 #undef CHECK_EMIT_INLINE_CALL |
928 } | 865 } |
929 | 866 |
930 | 867 |
931 void FullCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) { | 868 void FullCodeGenerator::EmitLogicalOperation(BinaryOperation* expr) { |
932 Label eval_right, done; | 869 Label eval_right, done; |
933 | 870 |
934 // Set up the appropriate context for the left subexpression based | 871 // Set up the appropriate context for the left subexpression based |
935 // on the operation and our own context. Initially assume we can | 872 // on the operation and our own context. Initially assume we can |
936 // inherit both true and false labels from our context. | 873 // inherit both true and false labels from our context. |
937 if (expr->op() == Token::OR) { | 874 if (expr->op() == Token::OR) { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 // The macros used here must preserve the result register. | 1376 // The macros used here must preserve the result register. |
1440 __ Drop(stack_depth); | 1377 __ Drop(stack_depth); |
1441 __ PopTryHandler(); | 1378 __ PopTryHandler(); |
1442 return 0; | 1379 return 0; |
1443 } | 1380 } |
1444 | 1381 |
1445 #undef __ | 1382 #undef __ |
1446 | 1383 |
1447 | 1384 |
1448 } } // namespace v8::internal | 1385 } } // namespace v8::internal |
OLD | NEW |