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

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

Issue 61893009: Add initial hydrogenized NewStringAddStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test case for --new-string-add. Created 7 years, 1 month 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/code-stubs.cc ('k') | src/flag-definitions.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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 return result; 965 return result;
966 } 966 }
967 967
968 968
969 Handle<Code> BinaryOpStub::GenerateCode(Isolate* isolate) { 969 Handle<Code> BinaryOpStub::GenerateCode(Isolate* isolate) {
970 return DoGenerateCode(isolate, this); 970 return DoGenerateCode(isolate, this);
971 } 971 }
972 972
973 973
974 template <> 974 template <>
975 HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() {
976 NewStringAddStub* stub = casted_stub();
977 StringAddFlags flags = stub->flags();
978 PretenureFlag pretenure_flag = stub->pretenure_flag();
979
980 HValue* left = GetParameter(NewStringAddStub::kLeft);
981 HValue* right = GetParameter(NewStringAddStub::kRight);
982
983 // Make sure that both arguments are strings if not known in advance.
984 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
985 IfBuilder if_leftnotstring(this);
986 if_leftnotstring.IfNot<HIsStringAndBranch>(left);
987 if_leftnotstring.Then();
988 if_leftnotstring.Deopt("Expected string for LHS of string addition");
989 }
990 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
991 IfBuilder if_rightnotstring(this);
992 if_rightnotstring.IfNot<HIsStringAndBranch>(right);
993 if_rightnotstring.Then();
994 if_rightnotstring.Deopt("Expected string for RHS of string addition");
995 }
996
997 return BuildStringAdd(left, right, pretenure_flag);
998 }
999
1000
1001 Handle<Code> NewStringAddStub::GenerateCode(Isolate* isolate) {
1002 return DoGenerateCode(isolate, this);
1003 }
1004
1005
1006 template <>
975 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 1007 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
976 ToBooleanStub* stub = casted_stub(); 1008 ToBooleanStub* stub = casted_stub();
977 1009
978 IfBuilder if_true(this); 1010 IfBuilder if_true(this);
979 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 1011 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
980 if_true.Then(); 1012 if_true.Then();
981 if_true.Return(graph()->GetConstant1()); 1013 if_true.Return(graph()->GetConstant1());
982 if_true.Else(); 1014 if_true.Else();
983 if_true.End(); 1015 if_true.End();
984 return graph()->GetConstant0(); 1016 return graph()->GetConstant0();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 return js_function; 1287 return js_function;
1256 } 1288 }
1257 1289
1258 1290
1259 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { 1291 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) {
1260 return DoGenerateCode(isolate, this); 1292 return DoGenerateCode(isolate, this);
1261 } 1293 }
1262 1294
1263 1295
1264 } } // namespace v8::internal 1296 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698