@@ -101,36 +101,11 @@ namespace Js
101101 }
102102 }
103103
104- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::GetErrorMessage (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_GetErrorMessage));
105- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::LogDebugMessage (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_LogDebugMessage));
106- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::TagPublicLibraryCode (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_TagPublicLibraryCode));
107- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::SetPrototype (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_SetPrototype));
108- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::GetArrayLength (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_GetArrayLength));
109- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::RegexMatch (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_RegexMatch));
110-
111- #ifndef GlobalBuiltIn
112- #define GlobalBuiltIn (global, method ) \
113- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::BuiltIn_##global##_##method##(FORCE_NO_WRITE_BARRIER_TAG (global##::##method##)); \
114-
115- #define GlobalBuiltInConstructor (global )
116-
117- #define BuiltInRaiseException (exceptionType, exceptionID ) \
118- NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::BuiltIn_raise##exceptionID (FORCE_NO_WRITE_BARRIER_TAG (EngineInterfaceObject::Entry_BuiltIn_raise##exceptionID)); \
119-
120- #define BuiltInRaiseException1 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID)
121- #define BuiltInRaiseException2 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID)
122- #define BuiltInRaiseException3 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID##_3)
123-
104+ // initialize EngineInterfaceObject::EntryInfo
105+ #define EngineInterfaceBuiltIn2 (propId, nativeMethod ) NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::nativeMethod (FORCE_NO_WRITE_BARRIER_TAG(EngineInterfaceObject::Entry_##nativeMethod));
106+ #define BuiltInRaiseException (exceptionType, exceptionID ) NoProfileFunctionInfo EngineInterfaceObject::EntryInfo::BuiltIn_raise##exceptionID(FORCE_NO_WRITE_BARRIER_TAG(EngineInterfaceObject::Entry_BuiltIn_raise##exceptionID));
124107#include " EngineInterfaceObjectBuiltIns.h"
125108
126- #undef BuiltInRaiseException
127- #undef BuiltInRaiseException1
128- #undef BuiltInRaiseException2
129- #undef BuiltInRaiseException3
130- #undef GlobalBuiltInConstructor
131- #undef GlobalBuiltIn
132- #endif
133-
134109 EngineInterfaceObject * EngineInterfaceObject::New (Recycler * recycler, DynamicType * type)
135110 {
136111 EngineInterfaceObject* newObject = NewObject<EngineInterfaceObject>(recycler, type);
@@ -205,48 +180,28 @@ namespace Js
205180
206181 bool EngineInterfaceObject::InitializeCommonNativeInterfaces (DynamicObject* commonNativeInterfaces, DeferredTypeHandlerBase * typeHandler, DeferredInitializeMode mode)
207182 {
208- typeHandler->Convert (commonNativeInterfaces, mode, 38 );
209-
210- JavascriptLibrary* library = commonNativeInterfaces->GetScriptContext ()->GetLibrary ();
211-
212- #ifndef GlobalBuiltIn
213- #define GlobalBuiltIn (global, method ) \
214- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtIn##global##method, &EngineInterfaceObject::EntryInfo::BuiltIn_##global##_##method##, 1 ); \
215-
216- #define GlobalBuiltInConstructor (global ) SetPropertyOn(commonNativeInterfaces, Js::PropertyIds::##global##, library->Get##global##Constructor());
217-
218- #define BuiltInRaiseException (exceptionType, exceptionID ) \
219- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::raise##exceptionID, &EngineInterfaceObject::EntryInfo::BuiltIn_raise##exceptionID, 1 ); \
220-
221- #define BuiltInRaiseException1 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID)
222- #define BuiltInRaiseException2 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID)
223- #define BuiltInRaiseException3 (exceptionType, exceptionID ) BuiltInRaiseException(exceptionType, exceptionID##_3)
224-
183+ // start with 1 for CallInstanceFunction
184+ int initSlotCapacity = 1 ;
185+
186+ #define GlobalMathBuiltIn (mathMethod ) initSlotCapacity++;
187+ #define GlobalBuiltIn (global, method ) initSlotCapacity++;
188+ #define GlobalBuiltInConstructor (global ) initSlotCapacity++;
189+ #define BuiltInRaiseException (exceptionType, exceptionID ) initSlotCapacity++;
190+ #define EngineInterfaceBuiltIn2 (propId, nativeMethod ) initSlotCapacity++;
225191#include " EngineInterfaceObjectBuiltIns.h"
226192
227- #undef BuiltInRaiseException
228- #undef BuiltInRaiseException1
229- #undef BuiltInRaiseException2
230- #undef BuiltInRaiseException3
231- #undef GlobalBuiltIn
232- #undef GlobalBuiltInConstructor
233- #endif
234- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInJavascriptObjectCreate, &JavascriptObject::EntryInfo::Create, 1 );
235- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInJavascriptObjectPreventExtensions, &JavascriptObject::EntryInfo::PreventExtensions, 1 );
236- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInJavascriptObjectGetOwnPropertyDescriptor, &JavascriptObject::EntryInfo::GetOwnPropertyDescriptor, 1 );
237-
238- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInGlobalObjectEval, &GlobalObject::EntryInfo::Eval, 2 );
193+ typeHandler->Convert (commonNativeInterfaces, mode, initSlotCapacity);
239194
240- library-> AddMember (commonNativeInterfaces, PropertyIds::Object_prototype, library-> GetObjectPrototype () );
195+ JavascriptLibrary* library = commonNativeInterfaces-> GetScriptContext ()-> GetLibrary ( );
241196
242- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::getErrorMessage, &EngineInterfaceObject::EntryInfo::GetErrorMessage, 1 );
243- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::logDebugMessage, &EngineInterfaceObject::EntryInfo::LogDebugMessage, 1 );
244- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::tagPublicLibraryCode, &EngineInterfaceObject::EntryInfo::TagPublicLibraryCode, 1 );
197+ #define GlobalMathBuiltIn (mathMethod ) library->AddFunctionToLibraryObject (commonNativeInterfaces, PropertyIds::builtInMath##mathMethod, &Math::EntryInfo::mathMethod, 1 );
198+ #define GlobalBuiltIn (global, method ) library->AddFunctionToLibraryObject (commonNativeInterfaces, PropertyIds::builtIn##global##Entry##method, &global::EntryInfo::method, 1 );
199+ #define GlobalBuiltInConstructor (global ) SetPropertyOn(commonNativeInterfaces, PropertyIds::##global##, library->Get##global##Constructor());
200+ #define BuiltInRaiseException (exceptionType, exceptionID ) library->AddFunctionToLibraryObject (commonNativeInterfaces, PropertyIds::raise##exceptionID, &EngineInterfaceObject::EntryInfo::BuiltIn_raise##exceptionID, 1 );
201+ #define EngineInterfaceBuiltIn2 (propId, nativeMethod ) library->AddFunctionToLibraryObject (commonNativeInterfaces, PropertyIds::propId, &EngineInterfaceObject::EntryInfo::nativeMethod, 1 );
202+ #include " EngineInterfaceObjectBuiltIns.h"
245203
246- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInSetPrototype, &EngineInterfaceObject::EntryInfo::SetPrototype, 1 );
247- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInGetArrayLength, &EngineInterfaceObject::EntryInfo::GetArrayLength, 1 );
248- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInRegexMatch, &EngineInterfaceObject::EntryInfo::RegexMatch, 1 );
249- library->AddFunctionToLibraryObject (commonNativeInterfaces, Js::PropertyIds::builtInCallInstanceFunction, &EngineInterfaceObject::EntryInfo::CallInstanceFunction, 1 );
204+ library->AddFunctionToLibraryObject (commonNativeInterfaces, PropertyIds::builtInCallInstanceFunction, &EngineInterfaceObject::EntryInfo::CallInstanceFunction, 1 );
250205
251206 commonNativeInterfaces->SetHasNoEnumerableProperties (true );
252207
@@ -449,10 +404,6 @@ namespace Js
449404 END_SAFE_REENTRANT_CALL
450405 }
451406
452- #ifndef GlobalBuiltIn
453- #define GlobalBuiltIn (global, method )
454- #define GlobalBuiltInConstructor (global )
455-
456407#define BuiltInRaiseException (exceptionType, exceptionID ) \
457408 Var EngineInterfaceObject::Entry_BuiltIn_raise##exceptionID (RecyclableObject *function, CallInfo callInfo, ...) \
458409 { \
@@ -502,13 +453,5 @@ namespace Js
502453
503454#include " EngineInterfaceObjectBuiltIns.h"
504455
505- #undef BuiltInRaiseException
506- #undef BuiltInRaiseException1
507- #undef BuiltInRaiseException2
508- #undef BuiltInRaiseException3
509- #undef GlobalBuiltIn
510- #undef GlobalBuiltInConstructor
511- #endif
512-
513456}
514457#endif // ENABLE_INTL_OBJECT || ENABLE_JS_BUILTINS || ENABLE_PROJECTION
0 commit comments