Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 1cf5d529119ce42fa92a1f65767ccba8153fb6fc..b23c2a117c95a79d779e9d8c7116debed6838049 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3264,14 +3264,16 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const { |
i::Handle<i::Object> num; |
if (obj->IsNumber()) { |
num = obj; |
+ return Just(num->IsSmi() ? static_cast<int64_t>(i::Smi::cast(*num)->value()) |
+ : static_cast<int64_t>(num->Number())); |
} else { |
PREPARE_FOR_EXECUTION_PRIMITIVE(context, "IntegerValue", int64_t); |
has_pending_exception = |
jochen (gone - plz use gerrit)
2015/09/09 14:16:59
can you pull the if() case in here instead of dupl
noordhuis
2015/09/09 23:35:56
That pessimizes the common case when the input is
|
!i::Execution::ToInteger(isolate, obj).ToHandle(&num); |
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(int64_t); |
+ return Just(num->IsSmi() ? static_cast<int64_t>(i::Smi::cast(*num)->value()) |
+ : static_cast<int64_t>(num->Number())); |
} |
- return Just(num->IsSmi() ? static_cast<int64_t>(i::Smi::cast(*num)->value()) |
- : static_cast<int64_t>(num->Number())); |
} |