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

Side by Side Diff: src/runtime/runtime-strings.cc

Issue 2748253004: [cleanup] The %StringAdd runtime function is always called on Strings. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 isolate->counters()->sub_string_runtime()->Increment(); 185 isolate->counters()->sub_string_runtime()->Increment();
186 186
187 return *isolate->factory()->NewSubString(string, start, end); 187 return *isolate->factory()->NewSubString(string, start, end);
188 } 188 }
189 189
190 190
191 RUNTIME_FUNCTION(Runtime_StringAdd) { 191 RUNTIME_FUNCTION(Runtime_StringAdd) {
192 HandleScope scope(isolate); 192 HandleScope scope(isolate);
193 DCHECK_EQ(2, args.length()); 193 DCHECK_EQ(2, args.length());
194 CONVERT_ARG_HANDLE_CHECKED(Object, obj1, 0); 194 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
195 CONVERT_ARG_HANDLE_CHECKED(Object, obj2, 1); 195 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1);
196 isolate->counters()->string_add_runtime()->Increment(); 196 isolate->counters()->string_add_runtime()->Increment();
197 MaybeHandle<String> maybe_str1(Object::ToString(isolate, obj1));
198 MaybeHandle<String> maybe_str2(Object::ToString(isolate, obj2));
199 Handle<String> str1;
200 Handle<String> str2;
201 maybe_str1.ToHandle(&str1);
202 maybe_str2.ToHandle(&str2);
203 RETURN_RESULT_OR_FAILURE(isolate, 197 RETURN_RESULT_OR_FAILURE(isolate,
204 isolate->factory()->NewConsString(str1, str2)); 198 isolate->factory()->NewConsString(str1, str2));
205 } 199 }
206 200
207 201
208 RUNTIME_FUNCTION(Runtime_InternalizeString) { 202 RUNTIME_FUNCTION(Runtime_InternalizeString) {
209 HandleScope handles(isolate); 203 HandleScope handles(isolate);
210 DCHECK_EQ(1, args.length()); 204 DCHECK_EQ(1, args.length());
211 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 205 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
212 return *isolate->factory()->InternalizeString(string); 206 return *isolate->factory()->InternalizeString(string);
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 SealHandleScope shs(isolate); 745 SealHandleScope shs(isolate);
752 DCHECK_EQ(2, args.length()); 746 DCHECK_EQ(2, args.length());
753 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 747 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
754 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 748 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
755 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 749 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
756 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 750 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
757 } 751 }
758 752
759 } // namespace internal 753 } // namespace internal
760 } // namespace v8 754 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698