1
1
/*
2
- * Copyright (C) 2006, 2008, 2016 Apple Inc. All rights reserved.
2
+ * Copyright (C) 2006-2019 Apple Inc. All rights reserved.
3
3
* Copyright (C) 2007 Eric Seidel <[email protected] >
4
4
*
5
5
* Redistribution and use in source and binary forms, with or without
@@ -43,22 +43,22 @@ namespace JSC {
43
43
template <class Parent >
44
44
inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(JSValue value)
45
45
{
46
- ASSERT (asObject (value)->inherits (* value.getObject ()->vm (), info ()));
46
+ ASSERT (asObject (value)->inherits (value.getObject ()->vm (), info ()));
47
47
return jsCast<JSCallbackObject*>(asObject (value));
48
48
}
49
49
50
50
template <class Parent >
51
51
inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(EncodedJSValue encodedValue)
52
52
{
53
53
JSValue value = JSValue::decode (encodedValue);
54
- ASSERT (asObject (value)->inherits (* value.getObject ()->vm (), info ()));
54
+ ASSERT (asObject (value)->inherits (value.getObject ()->vm (), info ()));
55
55
return jsCast<JSCallbackObject*>(asObject (value));
56
56
}
57
57
58
58
template <class Parent >
59
59
JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure, JSClassRef jsClass, void * data)
60
60
: Parent(exec->vm (), structure)
61
- , m_callbackObjectData(std::make_unique <JSCallbackObjectData>(data, jsClass))
61
+ , m_callbackObjectData(makeUnique <JSCallbackObjectData>(data, jsClass))
62
62
{
63
63
}
64
64
@@ -67,24 +67,24 @@ JSCallbackObject<Parent>::JSCallbackObject(ExecState* exec, Structure* structure
67
67
template <class Parent >
68
68
JSCallbackObject<Parent>::JSCallbackObject(VM& vm, JSClassRef jsClass, Structure* structure)
69
69
: Parent(vm, structure)
70
- , m_callbackObjectData(std::make_unique <JSCallbackObjectData>(nullptr , jsClass))
70
+ , m_callbackObjectData(makeUnique <JSCallbackObjectData>(nullptr , jsClass))
71
71
{
72
72
}
73
73
74
74
template <class Parent >
75
75
JSCallbackObject<Parent>::~JSCallbackObject ()
76
76
{
77
- VM* vm = this ->HeapCell ::vm ();
78
- vm-> currentlyDestructingCallbackObject = this ;
77
+ VM& vm = this ->HeapCell ::vm ();
78
+ vm. currentlyDestructingCallbackObject = this ;
79
79
ASSERT (m_classInfo);
80
- vm-> currentlyDestructingCallbackObjectClassInfo = m_classInfo;
80
+ vm. currentlyDestructingCallbackObjectClassInfo = m_classInfo;
81
81
JSObjectRef thisRef = toRef (static_cast <JSObject*>(this ));
82
82
for (JSClassRef jsClass = classRef (); jsClass; jsClass = jsClass->parentClass ) {
83
83
if (JSObjectFinalizeCallback finalize = jsClass->finalize )
84
84
finalize (thisRef);
85
85
}
86
- vm-> currentlyDestructingCallbackObject = nullptr ;
87
- vm-> currentlyDestructingCallbackObjectClassInfo = nullptr ;
86
+ vm. currentlyDestructingCallbackObject = nullptr ;
87
+ vm. currentlyDestructingCallbackObjectClassInfo = nullptr ;
88
88
}
89
89
90
90
template <class Parent >
@@ -215,7 +215,8 @@ bool JSCallbackObject<Parent>::getOwnPropertySlot(JSObject* object, ExecState* e
215
215
template <class Parent >
216
216
bool JSCallbackObject<Parent>::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned propertyName, PropertySlot& slot)
217
217
{
218
- return object->methodTable (exec->vm ())->getOwnPropertySlot (object, exec, Identifier::from (exec, propertyName), slot);
218
+ VM& vm = exec->vm ();
219
+ return object->methodTable (vm)->getOwnPropertySlot (object, exec, Identifier::from (vm, propertyName), slot);
219
220
}
220
221
221
222
template <class Parent >
@@ -320,7 +321,7 @@ bool JSCallbackObject<Parent>::putByIndex(JSCell* cell, ExecState* exec, unsigne
320
321
JSObjectRef thisRef = toRef (thisObject);
321
322
RefPtr<OpaqueJSString> propertyNameRef;
322
323
JSValueRef valueRef = toRef (exec, value);
323
- Identifier propertyName = Identifier::from (exec , propertyIndex);
324
+ Identifier propertyName = Identifier::from (vm , propertyIndex);
324
325
325
326
for (JSClassRef jsClass = thisObject->classRef (); jsClass; jsClass = jsClass->parentClass ) {
326
327
if (JSObjectSetPropertyCallback setProperty = jsClass->setProperty ) {
@@ -421,8 +422,9 @@ bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, Pro
421
422
template <class Parent >
422
423
bool JSCallbackObject<Parent>::deletePropertyByIndex(JSCell* cell, ExecState* exec, unsigned propertyName)
423
424
{
425
+ VM& vm = exec->vm ();
424
426
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(cell);
425
- return thisObject->methodTable (exec-> vm ()) ->deleteProperty (thisObject, exec, Identifier::from (exec , propertyName));
427
+ return thisObject->methodTable (vm) ->deleteProperty (thisObject, exec, Identifier::from (vm , propertyName));
426
428
}
427
429
428
430
template <class Parent >
@@ -547,6 +549,7 @@ EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec)
547
549
template <class Parent >
548
550
void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
549
551
{
552
+ VM& vm = exec->vm ();
550
553
JSCallbackObject* thisObject = jsCast<JSCallbackObject*>(object);
551
554
JSContextRef execRef = toRef (exec);
552
555
JSObjectRef thisRef = toRef (thisObject);
@@ -565,7 +568,7 @@ void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, Exe
565
568
StaticValueEntry* entry = it->value .get ();
566
569
if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum ) || mode.includeDontEnumProperties ())) {
567
570
ASSERT (!name->isSymbol ());
568
- propertyNames.add (Identifier::fromString (exec , String (name)));
571
+ propertyNames.add (Identifier::fromString (vm , String (name)));
569
572
}
570
573
}
571
574
}
@@ -578,7 +581,7 @@ void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, Exe
578
581
StaticFunctionEntry* entry = it->value .get ();
579
582
if (!(entry->attributes & kJSPropertyAttributeDontEnum ) || mode.includeDontEnumProperties ()) {
580
583
ASSERT (!name->isSymbol ());
581
- propertyNames.add (Identifier::fromString (exec , String (name)));
584
+ propertyNames.add (Identifier::fromString (vm , String (name)));
582
585
}
583
586
}
584
587
}
0 commit comments