On Tue, Aug 18, 2015 at 2:58 AM, Gavin Glynn <[email protected]> wrote: > Hi > > We are in the process of porting our application from Windows (using the > Microsoft JScript engine) to Linux (using v8). Our application executes > JavaScript in multiple separate threads of execution, and requires a large > number of callbacks (i.e. ~ 200) into our server architecture. > > What we are finding is that executing the following statement where "global" > is an v8::ObjectTemplate with 200 methods takes over 300ms. If we do the > same with a v8::ObjectTemplate with 2 methods, it takes 40ms. > > // Create a new context based on the global object template > v8::Handle<v8::Context> oContext = v8::Context::New( pIsolate, NULL, > global ); > > Is there someway of improving the performance of this? > > Currently, I am running each script invocation (i.e. which are on different > threads in the same process) as a separate v8::Isolation and consequently > v8::Context. The global object template never changes. Is there away of > sharing the global template across the threads? I have seen that snapshots > may help, but the documentation is not very good. Is there any examples as > the web? > > Thanks > > Gavin Glynn :) > > NB: The full code for my script execution function is as follows: > > ---------------------------- > > // Declare the return value > DataObjects::DAttributeInstanceValue vResult; > > // Create a v8 isolate object > v8::Isolate* pIsolate = v8::Isolate::New(); > > // Execute the script > { > // Lock the v8 isolate object > v8::Locker oLocker( pIsolate ); > > // Create a scope for the v8 isolate object > v8::Isolate::Scope oIsolateScope( pIsolate ); > > // Create a handle scope > v8::HandleScope oHandleScope( pIsolate ); > > // Create a template for the global object where we set the built-in > global functions. > v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New( > pIsolate ); > > // Bind the functions to the global object template > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageFilterExecute" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageFilterExecute, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageFilterReset" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageFilterReset, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageFilterAdd" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageFilterAdd, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageFilterStart" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageFilterStart, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VESessionToken" > ), v8::FunctionTemplate::New( pIsolate, LocalSessionToken, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetDocumentFromText" ), v8::FunctionTemplate::New( pIsolate, > LocalSetDocumentFromText, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEEnablePageObjectActions" ), v8::FunctionTemplate::New( pIsolate, > LocalEnablePageObjectActions, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEGuid" ), > v8::FunctionTemplate::New( pIsolate, LocalGuid, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSAddRelationshipSearch" ), v8::FunctionTemplate::New( pIsolate, > LocalDSAddRelationshipSearch, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeFromIsoFormat" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeFromIsoFormat, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeToIsoFormat" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeToIsoFormat, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetRecordsetFieldByIndex" ), v8::FunctionTemplate::New( pIsolate, > LocalGetRecordsetFieldByIndex, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetRecordsetField" ), v8::FunctionTemplate::New( pIsolate, > LocalGetRecordsetField, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEResetRecordset" > ), v8::FunctionTemplate::New( pIsolate, LocalResetRecordset, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetNextRecordsetRow" ), v8::FunctionTemplate::New( pIsolate, > LocalGetNextRecordsetRow, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsMoreRecordsetRows" ), v8::FunctionTemplate::New( pIsolate, > LocalIsMoreRecordsetRows, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetToFirstRecordsetRow" ), v8::FunctionTemplate::New( pIsolate, > LocalSetToFirstRecordsetRow, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEHasRecordset" > ), v8::FunctionTemplate::New( pIsolate, LocalAccountIsActivated, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VERemoveAllAttributeOptions" ), v8::FunctionTemplate::New( pIsolate, > LocalRemoveAllAttributeOptions, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VERemoveAttributeOption" ), v8::FunctionTemplate::New( pIsolate, > LocalRemoveAttributeOption, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAddAttributeOption" ), v8::FunctionTemplate::New( pIsolate, > LocalAddAttributeOption, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VESingleSpace" ), > v8::FunctionTemplate::New( pIsolate, LocalSingleSpace, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsCurrentUser" > ), v8::FunctionTemplate::New( pIsolate, LocalIsCurrentUser, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetDocumentFileName" ), v8::FunctionTemplate::New( pIsolate, > LocalGetDocumentFileName, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetDocumentType" ), v8::FunctionTemplate::New( pIsolate, > LocalGetDocumentType, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsUniqueUserName" ), v8::FunctionTemplate::New( pIsolate, > LocalIsUniqueUserName, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEResetPasswordForPortal" ), v8::FunctionTemplate::New( pIsolate, > LocalResetPasswordForPortal, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAllocateAndActivateAccountForPortal" ), v8::FunctionTemplate::New( > pIsolate, LocalAllocateAndActivateAccountForPortal, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEActivateAccountForPortal" ), v8::FunctionTemplate::New( pIsolate, > LocalActivateAccountForPortal, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetProcessParameter" ), v8::FunctionTemplate::New( pIsolate, > LocalGetProcessParameter, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAccountIsActivated" ), v8::FunctionTemplate::New( pIsolate, > LocalAccountIsActivated, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAccountIsNotActivated" ), v8::FunctionTemplate::New( pIsolate, > LocalAccountIsNotActivated, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEActivateAccount" ), v8::FunctionTemplate::New( pIsolate, > LocalActivateAccount, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEActivitiesAreDelegated" ), v8::FunctionTemplate::New( pIsolate, > LocalActivitiesAreDelegated, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAllocateAccount" ), v8::FunctionTemplate::New( pIsolate, > LocalAllocateAccount, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAllocateAndActivateAccount" ), v8::FunctionTemplate::New( pIsolate, > LocalAllocateAndActivateAccount, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAttributeDocumentCopy" ), v8::FunctionTemplate::New( pIsolate, > LocalAttributeDocumentCopy, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAttributeFormat" ), v8::FunctionTemplate::New( pIsolate, > LocalAttributeFormat, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAttributeHasValue" ), v8::FunctionTemplate::New( pIsolate, > LocalAttributeHasValue, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEAttributeModified" ), v8::FunctionTemplate::New( pIsolate, > LocalAttributeModified, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarCurrentWeek" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarCurrentWeek, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarCurrentYear" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarCurrentYear, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarDate" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarDate, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarDateTime" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarDateTime, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarDay" ), > v8::FunctionTemplate::New( pIsolate, LocalCalendarDay, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarDayNumber" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarDayNumber, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarDayOfWeek" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarDayOfWeek, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarDayOfYear" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarDayOfYear, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarDaysSince" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarDaysSince, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarEarliestOf" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarEarliestOf, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarElapsed" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarElapsed, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarEndDate" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarEndDate, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarHour" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarHour, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarIsFirstDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarIsFirstDay, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarIsLastDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarIsLastDay, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarIsWeekday" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarIsWeekday, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarIsWeekend" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarIsWeekend, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarIsWorkDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarIsWorkDay, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarLatestOf" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarLatestOf, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarMinute" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarMinute, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarMonth" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarMonth, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarMonthName" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarMonthName, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarNearWorkDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarNearWorkDay, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarNextWeek" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarNextWeek, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarNextWorkDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarNextWorkDay, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarNextYear" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarNextYear, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarNumberOf" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarNumberOf, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarPrevWorkDay" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarPreviousWeek, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarPreviousWeek" ), v8::FunctionTemplate::New( pIsolate, > LocalAccountIsActivated, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarPreviousYear" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarPreviousYear, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarSecond" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarSecond, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarStartDate" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarStartDate, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarStartOf" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarStartOf, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarTime" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarTime, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarTimespanOf" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarTimespanOf, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarWeek" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarWeek, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarWeekNumber" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarWeekNumber, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECalendarWeekOfYear" ), v8::FunctionTemplate::New( pIsolate, > LocalCalendarWeekOfYear, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECalendarYear" > ), v8::FunctionTemplate::New( pIsolate, LocalCalendarYear, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECancel" ), > v8::FunctionTemplate::New( pIsolate, LocalCancel, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECancelDelegation" ), v8::FunctionTemplate::New( pIsolate, > LocalCancelDelegation, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VECheckLoop" ), > v8::FunctionTemplate::New( pIsolate, LocalCheckLoop, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VECopyActivityOutput" ), v8::FunctionTemplate::New( pIsolate, > LocalCopyActivityOutput, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSAddDependentSearch" ), v8::FunctionTemplate::New( pIsolate, > LocalDSAddDependentSearch, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSAddSimpleSearch" ), v8::FunctionTemplate::New( pIsolate, > LocalDSAddSimpleSearch, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSAddWorkflowSearch" ), v8::FunctionTemplate::New( pIsolate, > LocalDSAddWorkflowSearch, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSIntersectionOperator" ), v8::FunctionTemplate::New( pIsolate, > LocalDSIntersectionOperator, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEDSProcessStack" > ), v8::FunctionTemplate::New( pIsolate, LocalDSProcessStack, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEDSResetStack" > ), v8::FunctionTemplate::New( pIsolate, LocalDSResetStack, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDSUnionOperator" ), v8::FunctionTemplate::New( pIsolate, > LocalDSUnionOperator, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEDateTimeAdjust" > ), v8::FunctionTemplate::New( pIsolate, LocalDateTimeAdjust, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeCompare" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeCompare, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeDifference" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeDifference, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeIsBetween" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeIsBetween, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDateTimeIsEqual" ), v8::FunctionTemplate::New( pIsolate, > LocalDateTimeIsEqual, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEDateToString" > ), v8::FunctionTemplate::New( pIsolate, LocalDateToString, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDelegateActivities" ), v8::FunctionTemplate::New( pIsolate, > LocalDelegateActivities, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDeregisterOrganisation" ), v8::FunctionTemplate::New( pIsolate, > LocalDeregisterOrganisation, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEDoesPackageHaveAnAttribute" ), v8::FunctionTemplate::New( pIsolate, > LocalDoesPackageHaveAnAttribute, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEEmptyString" ), > v8::FunctionTemplate::New( pIsolate, LocalEmptyString, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEEnablePageObject" ), v8::FunctionTemplate::New( pIsolate, > LocalEnablePageObject, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEEndLoop" ), > v8::FunctionTemplate::New( pIsolate, LocalEndLoop, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEExtMethod" ), > v8::FunctionTemplate::New( pIsolate, LocalExtMethod, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEFireAction" ), > v8::FunctionTemplate::New( pIsolate, LocalFireAction, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEGet" ), > v8::FunctionTemplate::New( pIsolate, LocalGet, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetAttributePackageIndex" ), v8::FunctionTemplate::New( pIsolate, > LocalGetAttributePackageIndex, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEGetList" ), > v8::FunctionTemplate::New( pIsolate, LocalGetList, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEGetNextAnchor" > ), v8::FunctionTemplate::New( pIsolate, LocalGetNextAnchor, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEGetNextConditionAnchor" ), v8::FunctionTemplate::New( pIsolate, > LocalGetNextConditionAnchor, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEGetNextContext" > ), v8::FunctionTemplate::New( pIsolate, LocalGetNextContext, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEHidePageObject" > ), v8::FunctionTemplate::New( pIsolate, LocalHidePageObject, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEInactivateAccount" ), v8::FunctionTemplate::New( pIsolate, > LocalInactivateAccount, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEInternalMethod" > ), v8::FunctionTemplate::New( pIsolate, LocalInternalMethod, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsAnchorValid" > ), v8::FunctionTemplate::New( pIsolate, LocalIsAnchorValid, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsConditionAnchorValid" ), v8::FunctionTemplate::New( pIsolate, > LocalIsConditionAnchorValid, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsEqual" ), > v8::FunctionTemplate::New( pIsolate, LocalIsEqual, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsGreaterThan" > ), v8::FunctionTemplate::New( pIsolate, LocalIsGreaterThan, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsGreaterThanEqual" ), v8::FunctionTemplate::New( pIsolate, > LocalIsGreaterThanEqual, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsLessThan" ), > v8::FunctionTemplate::New( pIsolate, LocalIsLessThan, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsLessThanEqual" ), v8::FunctionTemplate::New( pIsolate, > LocalIsLessThanEqual, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsPackageCreatedInProcess" ), v8::FunctionTemplate::New( pIsolate, > LocalIsPackageCreatedInProcess, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEIsPackageRelated" ), v8::FunctionTemplate::New( pIsolate, > LocalIsPackageRelated, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsValueBetween" > ), v8::FunctionTemplate::New( pIsolate, LocalIsValueBetween, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsValueIn" ), > v8::FunctionTemplate::New( pIsolate, LocalIsValueIn, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEIsValueLike" ), > v8::FunctionTemplate::New( pIsolate, LocalIsValueLike, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEMathPercentAdjustment" ), v8::FunctionTemplate::New( pIsolate, > LocalMathPercentAdjustment, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VENewLine" ), > v8::FunctionTemplate::New( pIsolate, LocalNewLine, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VENow" ), > v8::FunctionTemplate::New( pIsolate, LocalNow, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEOrganisationIsDeregistered" ), v8::FunctionTemplate::New( pIsolate, > LocalOrganisationIsDeregistered, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEOrganisationIsRegistered" ), v8::FunctionTemplate::New( pIsolate, > LocalOrganisationIsRegistered, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEPackageAdd" ), > v8::FunctionTemplate::New( pIsolate, LocalPackageAdd, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageAddForUpdate" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageAddForUpdate, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageAssociate" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageAssociate, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEPackageRemove" > ), v8::FunctionTemplate::New( pIsolate, LocalPackageRemove, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEPackageSet" ), > v8::FunctionTemplate::New( pIsolate, LocalPackageSet, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEPackageSet2" ), > v8::FunctionTemplate::New( pIsolate, LocalPackageSet2, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPackageSetInstance" ), v8::FunctionTemplate::New( pIsolate, > LocalPackageSetInstance, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPercentAdjustment" ), v8::FunctionTemplate::New( pIsolate, > LocalPercentAdjustment, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEPercentOf" ), > v8::FunctionTemplate::New( pIsolate, LocalPercentOf, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPreExecuteSetCondition" ), v8::FunctionTemplate::New( pIsolate, > LocalPreExecuteSetCondition, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEPreExecuteSetExpression" ), v8::FunctionTemplate::New( pIsolate, > LocalPreExecuteSetExpression, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VERegisterOrganisation" ), v8::FunctionTemplate::New( pIsolate, > LocalRegisterOrganisation, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEReset" ), > v8::FunctionTemplate::New( pIsolate, LocalReset, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEResetAnchorList" ), v8::FunctionTemplate::New( pIsolate, > LocalResetAnchorList, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEResetContextStack" ), v8::FunctionTemplate::New( pIsolate, > LocalResetContextStack, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEResetPackage" > ), v8::FunctionTemplate::New( pIsolate, LocalResetPackage, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEResetPassword" > ), v8::FunctionTemplate::New( pIsolate, LocalResetPassword, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VEResolveContextStack" ), v8::FunctionTemplate::New( pIsolate, > LocalResolveContextStack, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VESet" ), > v8::FunctionTemplate::New( pIsolate, LocalSet, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetActivityOutput" ), v8::FunctionTemplate::New( pIsolate, > LocalSetActivityOutput, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetAttributeDelta" ), v8::FunctionTemplate::New( pIsolate, > LocalSetAttributeDelta, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetConditionAnchorResult" ), v8::FunctionTemplate::New( pIsolate, > LocalSetConditionAnchorResult, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VESetDefault" ), > v8::FunctionTemplate::New( pIsolate, LocalSetDefault, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetDocumentFileName" ), v8::FunctionTemplate::New( pIsolate, > LocalSetDocumentFileName, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetDocumentType" ), v8::FunctionTemplate::New( pIsolate, > LocalSetDocumentType, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetObjectProperty" ), v8::FunctionTemplate::New( pIsolate, > LocalSetObjectProperty, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetObjectPropertyColor" ), v8::FunctionTemplate::New( pIsolate, > LocalSetObjectPropertyColor, v8::External::New( pIsolate, m_pScriptObject ) > ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VESetRuleResult" > ), v8::FunctionTemplate::New( pIsolate, LocalSetRuleResult, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetToFirstAnchor" ), v8::FunctionTemplate::New( pIsolate, > LocalSetToFirstAnchor, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetToFirstConditionAnchor" ), v8::FunctionTemplate::New( pIsolate, > LocalSetToFirstConditionAnchor, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESetToFirstContext" ), v8::FunctionTemplate::New( pIsolate, > LocalSetToFirstContext, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESimpleCondition" ), v8::FunctionTemplate::New( pIsolate, > LocalSimpleCondition, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VESimpleExpression" ), v8::FunctionTemplate::New( pIsolate, > LocalSimpleExpression, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEStartLoop" ), > v8::FunctionTemplate::New( pIsolate, LocalStartLoop, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEStop" ), > v8::FunctionTemplate::New( pIsolate, LocalStop, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VETextConcatenateGroup" ), v8::FunctionTemplate::New( pIsolate, > LocalTextConcatenateGroup, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VETextJoinGroup" > ), v8::FunctionTemplate::New( pIsolate, LocalTextJoinGroup, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VETimespanAverage" ), v8::FunctionTemplate::New( pIsolate, > LocalTimespanAverage, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VETimespanCompare" ), v8::FunctionTemplate::New( pIsolate, > LocalTimespanCompare, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"VETimespanIsBetween" ), v8::FunctionTemplate::New( pIsolate, > LocalTimespanIsBetween, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEToday" ), > v8::FunctionTemplate::New( pIsolate, LocalToday, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEVerify" ), > v8::FunctionTemplate::New( pIsolate, LocalVerify, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"VEWarn" ), > v8::FunctionTemplate::New( pIsolate, LocalWarn, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"__addLog" ), > v8::FunctionTemplate::New( pIsolate, LocalAddLog, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"__getActivityID" > ), v8::FunctionTemplate::New( pIsolate, LocalGetActivityID, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"__getActivityInstanceID" ), v8::FunctionTemplate::New( pIsolate, > LocalGetActivityInstanceID, v8::External::New( pIsolate, m_pScriptObject ) ) > ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"__getAnchorEntityID" ), v8::FunctionTemplate::New( pIsolate, > LocalGetAnchorEntityID, v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"__getAnchorEntityInstanceID" ), v8::FunctionTemplate::New( pIsolate, > LocalGetAnchorEntityInstanceID, v8::External::New( pIsolate, m_pScriptObject > ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"__getAnchorPropertyCollectionID" ), v8::FunctionTemplate::New( pIsolate, > LocalGetAnchorPropertyCollectionID, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, > u8"__getGlobalAnchorEntityInstanceID" ), v8::FunctionTemplate::New( > pIsolate, LocalGetGlobalAnchorEntityInstanceID, v8::External::New( pIsolate, > m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"__getSessionID" > ), v8::FunctionTemplate::New( pIsolate, LocalGetSessionID, > v8::External::New( pIsolate, m_pScriptObject ) ) ); > global->Set( v8::String::NewFromUtf8( pIsolate, u8"__saveLog" ), > v8::FunctionTemplate::New( pIsolate, LocalSaveLog, v8::External::New( > pIsolate, m_pScriptObject ) ) ); > > // Create a new context based on the global object template > v8::Handle<v8::Context> oContext = v8::Context::New( pIsolate, NULL, > global ); > > // Create a scope for the v8 context object > v8::Context::Scope oContextScope( oContext ); > > // Create a new v8 try/catch object > v8::TryCatch oTryCatch; > > // Initialise the scripting engine ready to execute > v8::Handle<v8::String> oSource = v8::String::NewFromUtf8( pIsolate, > Utility::ConvertUTF32ToUTF8( sJavaScript ).c_str( ) ); > > // Parse the script > v8::Handle<v8::Script> oScript = v8::Script::Compile( oSource ); > > // Confirm the script is empty > if ( oScript.IsEmpty( ) == true ) { > // Report the error > ReportScriptError( pIsolate, &oTryCatch ); > } else { > // Execute the script > v8::Handle<v8::Value> result = oScript->Run( ); > > // Confirm there is an exception > if ( oTryCatch.HasCaught( ) == true ) { > // Report the error > ReportScriptError( pIsolate, &oTryCatch ); > } else { > // Confirm the pre-execution state is unknown > if ( m_lPreExecutionState == Common::PES_None ) { > // Confirm there is a result > if ( result.IsEmpty( ) == false ) { > // Confirm this is a boolean value > if ( ( result->IsBoolean( ) == true ) || ( > result->IsBooleanObject( ) == true ) ) { > // Get the boolean value > v8::Local<v8::Boolean> bValue = > result->ToBoolean( ); > > // Set the return value > vResult = DataObjects::DAttributeInstanceValue( > bValue->Value( ) ); > } > > // Confirm this is a signed integer value > else if ( result->IsInt32( ) == true ) { > // Get the numeric value > v8::Local<v8::Int32> nValue = result->ToInt32( > ); > > // Set the return value > vResult = DataObjects::DAttributeInstanceValue( > (long) nValue->Value( ) ); > } > > // Confirm this is a unsigned integer value > else if ( result->IsUint32( ) == true ) { > // Get the numeric value > v8::Local<v8::Uint32> nValue = result->ToUint32( > ); > > // Set the return value > vResult = DataObjects::DAttributeInstanceValue( > (long) nValue->Value( ) ); > } > > // Confirm this is a floating point value > else if ( ( result->IsNumber( ) == true ) || ( > result->IsNumberObject( ) == true ) ) { > // Get the numeric value > v8::Local<v8::Number> nValue = result->ToNumber( > ); > > // Set the return value > vResult = DataObjects::DAttributeInstanceValue( > nValue->Value( ) ); > } > > // Confirm this is a string value > else if ( ( result->IsString( ) == true ) || ( > result->IsStringObject( ) == true ) ) { > // Get the string value > v8::String::Utf8Value sUnicodeValue( result ); > > // Set the return value > vResult = DataObjects::DAttributeInstanceValue( > Utility::ConvertUTF8ToUTF32( *sUnicodeValue ) ); > } > > // Confirm this a date value > else if ( result->IsDate( ) == true ) { > // Get the date value in milliseconds > time_t tmValue = (time_t) result->NumberValue( > ); > > // Convert the epoch date value to date/time > string > struct tm* pTimeInfo = gmtime( &tmValue ); > > // Set the return value > std::ostringstream streamValue; > streamValue << std::setfill( '0' ) > << std::setw( 4 ) << ( > pTimeInfo->tm_year + 1900 ) > << u8"-" > << std::setw( 2 ) << ( > pTimeInfo->tm_mon + 1 ) > << u8"-" > << std::setw( 2 ) << > pTimeInfo->tm_mday > << u8" " > << std::setw( 2 ) << > pTimeInfo->tm_hour > << u8":" > << std::setw( 2 ) << > pTimeInfo->tm_min > << u8":" > << std::setw( 2 ) << > pTimeInfo->tm_sec > << u8";" > << std::setw( 2 ) << lTimeZoneID > << u8";" > << std::setw( 2 ) << lCalendarID; > vResult = DataObjects::DAttributeInstanceValue( > Utility::ConvertUTF8ToUTF32( streamValue.str( ) ) ); > } > } > } > } > } > } > > // Free the v8 isolate object > pIsolate->Dispose( ); > > // Return the result > return vResult;
See https://groups.google.com/d/msg/v8-users/oSb33KvbURY/24y8F9IfFUcJ for possible solutions. Jane reported that using SetAccessor() sped up things considerably. You can also simply cache the global object's ObjectTemplate in a Persistent handle if it's the same between runs. -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
