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

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

Issue 99173002: Use constant types to represent the fixed right arg of a MOD. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comment. 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/ast.h ('k') | src/hydrogen.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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 // For the generic add stub a fast case for string addition is performance 915 // For the generic add stub a fast case for string addition is performance
916 // critical. 916 // critical.
917 if (left_type->Maybe(Type::String())) { 917 if (left_type->Maybe(Type::String())) {
918 IfBuilder if_leftisstring(this); 918 IfBuilder if_leftisstring(this);
919 if_leftisstring.If<HIsStringAndBranch>(left); 919 if_leftisstring.If<HIsStringAndBranch>(left);
920 if_leftisstring.Then(); 920 if_leftisstring.Then();
921 { 921 {
922 Push(BuildBinaryOperation( 922 Push(BuildBinaryOperation(
923 state.op(), left, right, 923 state.op(), left, right,
924 handle(Type::String(), isolate()), right_type, 924 handle(Type::String(), isolate()), right_type,
925 result_type, state.fixed_right_arg())); 925 result_type));
926 } 926 }
927 if_leftisstring.Else(); 927 if_leftisstring.Else();
928 { 928 {
929 Push(BuildBinaryOperation( 929 Push(BuildBinaryOperation(
930 state.op(), left, right, 930 state.op(), left, right,
931 left_type, right_type, result_type, 931 left_type, right_type, result_type));
932 state.fixed_right_arg()));
933 } 932 }
934 if_leftisstring.End(); 933 if_leftisstring.End();
935 result = Pop(); 934 result = Pop();
936 } else { 935 } else {
937 IfBuilder if_rightisstring(this); 936 IfBuilder if_rightisstring(this);
938 if_rightisstring.If<HIsStringAndBranch>(right); 937 if_rightisstring.If<HIsStringAndBranch>(right);
939 if_rightisstring.Then(); 938 if_rightisstring.Then();
940 { 939 {
941 Push(BuildBinaryOperation( 940 Push(BuildBinaryOperation(
942 state.op(), left, right, 941 state.op(), left, right,
943 left_type, handle(Type::String(), isolate()), 942 left_type, handle(Type::String(), isolate()),
944 result_type, state.fixed_right_arg())); 943 result_type));
945 } 944 }
946 if_rightisstring.Else(); 945 if_rightisstring.Else();
947 { 946 {
948 Push(BuildBinaryOperation( 947 Push(BuildBinaryOperation(
949 state.op(), left, right, 948 state.op(), left, right,
950 left_type, right_type, result_type, 949 left_type, right_type, result_type));
951 state.fixed_right_arg()));
952 } 950 }
953 if_rightisstring.End(); 951 if_rightisstring.End();
954 result = Pop(); 952 result = Pop();
955 } 953 }
956 } else { 954 } else {
957 result = BuildBinaryOperation( 955 result = BuildBinaryOperation(
958 state.op(), left, right, 956 state.op(), left, right,
959 left_type, right_type, result_type, 957 left_type, right_type, result_type);
960 state.fixed_right_arg());
961 } 958 }
962 959
963 // If we encounter a generic argument, the number conversion is 960 // If we encounter a generic argument, the number conversion is
964 // observable, thus we cannot afford to bail out after the fact. 961 // observable, thus we cannot afford to bail out after the fact.
965 if (!state.HasSideEffects()) { 962 if (!state.HasSideEffects()) {
966 if (result_type->Is(Type::Smi())) { 963 if (result_type->Is(Type::Smi())) {
967 if (state.op() == Token::SHR) { 964 if (state.op() == Token::SHR) {
968 // TODO(olivf) Replace this by a SmiTagU Instruction. 965 // TODO(olivf) Replace this by a SmiTagU Instruction.
969 // 0x40000000: this number would convert to negative when interpreting 966 // 0x40000000: this number would convert to negative when interpreting
970 // the register as signed value; 967 // the register as signed value;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 return BuildUncheckedDictionaryElementLoad(receiver, key); 1327 return BuildUncheckedDictionaryElementLoad(receiver, key);
1331 } 1328 }
1332 1329
1333 1330
1334 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { 1331 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) {
1335 return DoGenerateCode(isolate, this); 1332 return DoGenerateCode(isolate, this);
1336 } 1333 }
1337 1334
1338 1335
1339 } } // namespace v8::internal 1336 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698