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

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

Issue 939923002: [bindings] Break V8Binding::toDouble into fast inline and slower non-inline code paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed. Created 5 years, 10 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 | Source/bindings/core/v8/V8Binding.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 // Convert a value to a single precision float, throwing on non-finite values. 471 // Convert a value to a single precision float, throwing on non-finite values.
472 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); 472 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&);
473 473
474 // Convert a value to a single precision float assuming the conversion cannot fa il. 474 // Convert a value to a single precision float assuming the conversion cannot fa il.
475 inline float toFloat(v8::Local<v8::Value> value) 475 inline float toFloat(v8::Local<v8::Value> value)
476 { 476 {
477 return static_cast<float>(value->NumberValue()); 477 return static_cast<float>(value->NumberValue());
478 } 478 }
479 479
480 // Convert a value to a double precision float, which might fail. 480 // Convert a value to a double precision float, which might fail.
481 double toDouble(v8::Handle<v8::Value>, ExceptionState&); 481 double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&);
482
483 inline double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te)
484 {
485 if (value->IsNumber())
486 return value->NumberValue();
487 return toDoubleSlow(value, exceptionState);
488 }
482 489
483 // Convert a value to a double precision float, throwing on non-finite values. 490 // Convert a value to a double precision float, throwing on non-finite values.
484 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); 491 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&);
485 492
486 // Converts a value to a String, throwing if any code unit is outside 0-255. 493 // Converts a value to a String, throwing if any code unit is outside 0-255.
487 String toByteString(v8::Handle<v8::Value>, ExceptionState&); 494 String toByteString(v8::Handle<v8::Value>, ExceptionState&);
488 495
489 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl acement characters. 496 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl acement characters.
490 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); 497 String toUSVString(v8::Handle<v8::Value>, ExceptionState&);
491 498
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 996
990 private: 997 private:
991 v8::TryCatch& m_block; 998 v8::TryCatch& m_block;
992 }; 999 };
993 1000
994 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1001 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
995 1002
996 } // namespace blink 1003 } // namespace blink
997 1004
998 #endif // V8Binding_h 1005 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698