Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: perf op #181

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions NativeScript/inspector/JsV8InspectorClient.mm
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,8 @@
}

void JsV8InspectorClient::inspectorTimestampCallback(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
double timestamp = std::chrono::seconds(std::chrono::seconds(std::time(NULL))).count();
Local<Number> result = Number::New(isolate, timestamp);
args.GetReturnValue().Set(result);
args.GetReturnValue().Set(timestamp);
}

int JsV8InspectorClient::contextGroupId = 1;
Expand Down
6 changes: 3 additions & 3 deletions NativeScript/runtime/ArgConverter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -825,12 +825,12 @@
}

if (obj == nil || obj == [NSNull null]) {
args.GetReturnValue().Set(Null(isolate));
args.GetReturnValue().SetNull();
return;
}

if ([obj isKindOfClass:[@YES class]]) {
args.GetReturnValue().Set(v8::Boolean::New(isolate, [obj boolValue]));
args.GetReturnValue().Set([obj boolValue]);
return;
}

Expand Down Expand Up @@ -859,7 +859,7 @@

if ([obj isKindOfClass:[NSNumber class]] && ![obj isKindOfClass:[NSDecimalNumber class]]) {
double value = [obj doubleValue];
args.GetReturnValue().Set(Number::New(isolate, value));
args.GetReturnValue().Set(value);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion NativeScript/runtime/ClassBuilder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
});
class_addMethod(extendedClass, @selector(release), newRelease, "v@:");

info.GetReturnValue().Set(v8::Undefined(isolate));
info.GetReturnValue().SetUndefined();
}).ToLocalChecked();

PropertyAttribute flags = static_cast<PropertyAttribute>(PropertyAttribute::DontDelete);
Expand Down
2 changes: 1 addition & 1 deletion NativeScript/runtime/ExtVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void ExtVector::IndexedPropertyGetCallback(uint32_t index, const PropertyCallbac
ffi_type* ffiType = extVectorWrapper->FFIType();
if (offset >= ffiType->size) {
// Trying to access an element outside of the vector size
info.GetReturnValue().Set(v8::Undefined(isolate));
info.GetReturnValue().SetUndefined();
return;
}

Expand Down
4 changes: 2 additions & 2 deletions NativeScript/runtime/InteropTypes.mm
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
std::free(pw->Data());
}

info.GetReturnValue().Set(v8::Undefined(isolate));
info.GetReturnValue().SetUndefined();
}).ToLocal(&func);

Isolate* isolate = context->GetIsolate();
Expand Down Expand Up @@ -294,7 +294,7 @@
if (size == 0) {
throw NativeScriptException("Unknown type");
} else {
info.GetReturnValue().Set(Number::New(isolate, size));
info.GetReturnValue().Set((double)size);
}
} catch (NativeScriptException& ex) {
ex.ReThrowToV8(isolate);
Expand Down
2 changes: 1 addition & 1 deletion NativeScript/runtime/MetadataBuilder.mm
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@
std::vector<StructField> fields = structInfo.Fields();
auto it = std::find_if(fields.begin(), fields.end(), [&propertyName](StructField &f) { return f.Name() == propertyName; });
if (it == fields.end()) {
info.GetReturnValue().Set(v8::Undefined(isolate));
info.GetReturnValue().SetUndefined();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion NativeScript/runtime/Reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void Reference::GetValueCallback(Local<v8::Name> name, const PropertyCallbackInf
Local<Context> context = isolate->GetCurrentContext();
Local<Value> result = Reference::GetReferredValue(context, info.This());
if (result.IsEmpty()) {
info.GetReturnValue().Set(v8::Undefined(isolate));
info.GetReturnValue().SetUndefined();
} else {
info.GetReturnValue().Set(result);
}
Expand Down