OLD | NEW |
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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() { | 985 HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() { |
986 NewStringAddStub* stub = casted_stub(); | 986 NewStringAddStub* stub = casted_stub(); |
987 StringAddFlags flags = stub->flags(); | 987 StringAddFlags flags = stub->flags(); |
988 PretenureFlag pretenure_flag = stub->pretenure_flag(); | 988 PretenureFlag pretenure_flag = stub->pretenure_flag(); |
989 | 989 |
990 HValue* left = GetParameter(NewStringAddStub::kLeft); | 990 HValue* left = GetParameter(NewStringAddStub::kLeft); |
991 HValue* right = GetParameter(NewStringAddStub::kRight); | 991 HValue* right = GetParameter(NewStringAddStub::kRight); |
992 | 992 |
993 // Make sure that both arguments are strings if not known in advance. | 993 // Make sure that both arguments are strings if not known in advance. |
994 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | 994 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
995 IfBuilder if_leftnotstring(this); | 995 left = BuildCheckString(left); |
996 if_leftnotstring.IfNot<HIsStringAndBranch>(left); | |
997 if_leftnotstring.Then(); | |
998 if_leftnotstring.Deopt("Expected string for LHS of string addition"); | |
999 } | 996 } |
1000 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { | 997 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { |
1001 IfBuilder if_rightnotstring(this); | 998 right = BuildCheckString(right); |
1002 if_rightnotstring.IfNot<HIsStringAndBranch>(right); | |
1003 if_rightnotstring.Then(); | |
1004 if_rightnotstring.Deopt("Expected string for RHS of string addition"); | |
1005 } | 999 } |
1006 | 1000 |
1007 return BuildStringAdd(left, right, pretenure_flag); | 1001 return BuildStringAdd(left, right, pretenure_flag); |
1008 } | 1002 } |
1009 | 1003 |
1010 | 1004 |
1011 Handle<Code> NewStringAddStub::GenerateCode(Isolate* isolate) { | 1005 Handle<Code> NewStringAddStub::GenerateCode(Isolate* isolate) { |
1012 return DoGenerateCode(isolate, this); | 1006 return DoGenerateCode(isolate, this); |
1013 } | 1007 } |
1014 | 1008 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 return BuildUncheckedDictionaryElementLoad(receiver, key); | 1307 return BuildUncheckedDictionaryElementLoad(receiver, key); |
1314 } | 1308 } |
1315 | 1309 |
1316 | 1310 |
1317 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { | 1311 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { |
1318 return DoGenerateCode(isolate, this); | 1312 return DoGenerateCode(isolate, this); |
1319 } | 1313 } |
1320 | 1314 |
1321 | 1315 |
1322 } } // namespace v8::internal | 1316 } } // namespace v8::internal |
OLD | NEW |