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

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

Issue 1753173003: [compiler] Introduce initial StrictEqualStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add pseudo-code. Created 4 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 | « src/runtime/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('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 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-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/regexp/jsregexp-inl.h" 10 #include "src/regexp/jsregexp-inl.h"
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 if (is_one_byte) { 1138 if (is_one_byte) {
1139 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1139 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1140 isolate, result, isolate->factory()->NewRawOneByteString(length)); 1140 isolate, result, isolate->factory()->NewRawOneByteString(length));
1141 } else { 1141 } else {
1142 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1142 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1143 isolate, result, isolate->factory()->NewRawTwoByteString(length)); 1143 isolate, result, isolate->factory()->NewRawTwoByteString(length));
1144 } 1144 }
1145 return *result; 1145 return *result;
1146 } 1146 }
1147 1147
1148 1148 RUNTIME_FUNCTION(Runtime_StringEqual) {
1149 RUNTIME_FUNCTION(Runtime_StringEquals) {
1150 HandleScope handle_scope(isolate); 1149 HandleScope handle_scope(isolate);
1151 DCHECK(args.length() == 2); 1150 DCHECK_EQ(2, args.length());
1152
1153 CONVERT_ARG_HANDLE_CHECKED(String, x, 0); 1151 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
1154 CONVERT_ARG_HANDLE_CHECKED(String, y, 1); 1152 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
1155 1153 return isolate->heap()->ToBoolean(String::Equals(x, y));
1156 bool not_equal = !String::Equals(x, y);
1157 // This is slightly convoluted because the value that signifies
1158 // equality is 0 and inequality is 1 so we have to negate the result
1159 // from String::Equals.
1160 DCHECK(not_equal == 0 || not_equal == 1);
1161 STATIC_ASSERT(EQUAL == 0);
1162 STATIC_ASSERT(NOT_EQUAL == 1);
1163 return Smi::FromInt(not_equal);
1164 } 1154 }
1165 1155
1166 1156
1167 RUNTIME_FUNCTION(Runtime_FlattenString) { 1157 RUNTIME_FUNCTION(Runtime_FlattenString) {
1168 HandleScope scope(isolate); 1158 HandleScope scope(isolate);
1169 DCHECK(args.length() == 1); 1159 DCHECK(args.length() == 1);
1170 CONVERT_ARG_HANDLE_CHECKED(String, str, 0); 1160 CONVERT_ARG_HANDLE_CHECKED(String, str, 0);
1171 return *String::Flatten(str); 1161 return *String::Flatten(str);
1172 } 1162 }
1173 1163
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 SealHandleScope shs(isolate); 1230 SealHandleScope shs(isolate);
1241 DCHECK(args.length() == 2); 1231 DCHECK(args.length() == 2);
1242 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1232 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1243 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1233 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1244 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1234 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1245 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1235 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1246 } 1236 }
1247 1237
1248 } // namespace internal 1238 } // namespace internal
1249 } // namespace v8 1239 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698