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

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

Issue 1333843002: [runtime] Move binary operator fallbacks into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No need for frame states in bytecode handlers. Add test case. Created 5 years, 3 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
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 5
6 #ifdef V8_I18N_SUPPORT 6 #ifdef V8_I18N_SUPPORT
7 #include "src/runtime/runtime-utils.h" 7 #include "src/runtime/runtime-utils.h"
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/api-natives.h" 10 #include "src/api-natives.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 RUNTIME_FUNCTION(Runtime_InternalDateFormat) { 346 RUNTIME_FUNCTION(Runtime_InternalDateFormat) {
347 HandleScope scope(isolate); 347 HandleScope scope(isolate);
348 348
349 DCHECK(args.length() == 2); 349 DCHECK(args.length() == 2);
350 350
351 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0); 351 CONVERT_ARG_HANDLE_CHECKED(JSObject, date_format_holder, 0);
352 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1); 352 CONVERT_ARG_HANDLE_CHECKED(JSDate, date, 1);
353 353
354 Handle<Object> value; 354 Handle<Object> value;
355 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, 355 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, Object::ToNumber(date));
356 Object::ToNumber(isolate, date));
357 356
358 icu::SimpleDateFormat* date_format = 357 icu::SimpleDateFormat* date_format =
359 DateFormat::UnpackDateFormat(isolate, date_format_holder); 358 DateFormat::UnpackDateFormat(isolate, date_format_holder);
360 if (!date_format) return isolate->ThrowIllegalOperation(); 359 if (!date_format) return isolate->ThrowIllegalOperation();
361 360
362 icu::UnicodeString result; 361 icu::UnicodeString result;
363 date_format->format(value->Number(), result); 362 date_format->format(value->Number(), result);
364 363
365 Handle<String> result_str; 364 Handle<String> result_str;
366 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 365 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 438
440 RUNTIME_FUNCTION(Runtime_InternalNumberFormat) { 439 RUNTIME_FUNCTION(Runtime_InternalNumberFormat) {
441 HandleScope scope(isolate); 440 HandleScope scope(isolate);
442 441
443 DCHECK(args.length() == 2); 442 DCHECK(args.length() == 2);
444 443
445 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0); 444 CONVERT_ARG_HANDLE_CHECKED(JSObject, number_format_holder, 0);
446 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1); 445 CONVERT_ARG_HANDLE_CHECKED(Object, number, 1);
447 446
448 Handle<Object> value; 447 Handle<Object> value;
449 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, 448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, Object::ToNumber(number));
450 Object::ToNumber(isolate, number));
451 449
452 icu::DecimalFormat* number_format = 450 icu::DecimalFormat* number_format =
453 NumberFormat::UnpackNumberFormat(isolate, number_format_holder); 451 NumberFormat::UnpackNumberFormat(isolate, number_format_holder);
454 if (!number_format) return isolate->ThrowIllegalOperation(); 452 if (!number_format) return isolate->ThrowIllegalOperation();
455 453
456 icu::UnicodeString result; 454 icu::UnicodeString result;
457 number_format->format(value->Number(), result); 455 number_format->format(value->Number(), result);
458 456
459 Handle<String> result_str; 457 Handle<String> result_str;
460 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 458 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) { 742 } else if (status >= UBRK_WORD_IDEO && status < UBRK_WORD_IDEO_LIMIT) {
745 return *isolate->factory()->NewStringFromStaticChars("ideo"); 743 return *isolate->factory()->NewStringFromStaticChars("ideo");
746 } else { 744 } else {
747 return *isolate->factory()->NewStringFromStaticChars("unknown"); 745 return *isolate->factory()->NewStringFromStaticChars("unknown");
748 } 746 }
749 } 747 }
750 } // namespace internal 748 } // namespace internal
751 } // namespace v8 749 } // namespace v8
752 750
753 #endif // V8_I18N_SUPPORT 751 #endif // V8_I18N_SUPPORT
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698