OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 float numberValue = toFloat(value, exceptionState); | 524 float numberValue = toFloat(value, exceptionState); |
525 if (exceptionState.hadException()) | 525 if (exceptionState.hadException()) |
526 return 0; | 526 return 0; |
527 if (!std::isfinite(numberValue)) { | 527 if (!std::isfinite(numberValue)) { |
528 exceptionState.throwTypeError("The provided float value is non-finite.")
; | 528 exceptionState.throwTypeError("The provided float value is non-finite.")
; |
529 return 0; | 529 return 0; |
530 } | 530 } |
531 return numberValue; | 531 return numberValue; |
532 } | 532 } |
533 | 533 |
534 double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState) | 534 double toDoubleSlow(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
535 { | 535 { |
536 if (value->IsNumber()) | |
537 return value->NumberValue(); | |
538 | |
539 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 536 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
540 v8::TryCatch block(isolate); | 537 v8::TryCatch block(isolate); |
541 v8::Local<v8::Number> numberObject(value->ToNumber(isolate)); | 538 double doubleValue = value->NumberValue(); |
542 if (block.HasCaught()) { | 539 if (block.HasCaught()) { |
543 exceptionState.rethrowV8Exception(block.Exception()); | 540 exceptionState.rethrowV8Exception(block.Exception()); |
544 return 0; | 541 return 0; |
545 } | 542 } |
546 return numberObject->NumberValue(); | 543 return doubleValue; |
547 } | 544 } |
548 | 545 |
549 double toRestrictedDouble(v8::Handle<v8::Value> value, ExceptionState& exception
State) | 546 double toRestrictedDouble(v8::Handle<v8::Value> value, ExceptionState& exception
State) |
550 { | 547 { |
551 double numberValue = toDouble(value, exceptionState); | 548 double numberValue = toDouble(value, exceptionState); |
552 if (exceptionState.hadException()) | 549 if (exceptionState.hadException()) |
553 return 0; | 550 return 0; |
554 if (!std::isfinite(numberValue)) { | 551 if (!std::isfinite(numberValue)) { |
555 exceptionState.throwTypeError("The provided double value is non-finite."
); | 552 exceptionState.throwTypeError("The provided double value is non-finite."
); |
556 return 0; | 553 return 0; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 return m_resourceName; | 1047 return m_resourceName; |
1051 } | 1048 } |
1052 | 1049 |
1053 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function) | 1050 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol
ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function) |
1054 { | 1051 { |
1055 DevToolsFunctionInfo info(function); | 1052 DevToolsFunctionInfo info(function); |
1056 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou
rceName(), info.lineNumber()); | 1053 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou
rceName(), info.lineNumber()); |
1057 } | 1054 } |
1058 | 1055 |
1059 } // namespace blink | 1056 } // namespace blink |
OLD | NEW |