Changeset 222901 in webkit for trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
- Timestamp:
- Oct 5, 2017, 12:38:00 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r222827 r222901 30 30 #include "ArrayConstructor.h" 31 31 #include "BuiltinNames.h" 32 #include "BytecodeStructs.h" 32 33 #include "CallFrame.h" 33 34 #include "ClonedArguments.h" … … 94 95 #define OP_C(index) (exec->r(pc[index].u.operand)) 95 96 97 #define GET(operand) (exec->uncheckedR(operand)) 98 96 99 #define RETURN_TWO(first, second) do { \ 97 100 return encodeResult(first, second); \ … … 230 233 { 231 234 BEGIN(); 235 auto& bytecode = *reinterpret_cast<OpCreateThis*>(pc); 232 236 JSObject* result; 233 JSObject* constructorAsObject = asObject( OP(2).jsValue());237 JSObject* constructorAsObject = asObject(GET(bytecode.callee()).jsValue()); 234 238 if (constructorAsObject->type() == JSFunctionType) { 235 239 JSFunction* constructor = jsCast<JSFunction*>(constructorAsObject); 236 auto& cacheWriteBarrier = pc[4].u.jsCell;237 if (!cache WriteBarrier)238 cache WriteBarrier.set(vm, exec->codeBlock(), constructor);239 else if (cache WriteBarrier.unvalidatedGet() != JSCell::seenMultipleCalleeObjects() && cacheWriteBarrier.get() != constructor)240 cache WriteBarrier.setWithoutWriteBarrier(JSCell::seenMultipleCalleeObjects());241 242 size_t inlineCapacity = pc[3].u.operand;240 WriteBarrier<JSCell>& cachedCallee = bytecode.cachedCallee(); 241 if (!cachedCallee) 242 cachedCallee.set(vm, exec->codeBlock(), constructor); 243 else if (cachedCallee.unvalidatedGet() != JSCell::seenMultipleCalleeObjects() && cachedCallee.get() != constructor) 244 cachedCallee.setWithoutWriteBarrier(JSCell::seenMultipleCalleeObjects()); 245 246 size_t inlineCapacity = bytecode.inlineCapacity(); 243 247 Structure* structure = constructor->rareData(exec, inlineCapacity)->objectAllocationProfile()->structure(); 244 248 result = constructEmptyObject(exec, structure); 245 if (structure->hasPolyProto()) 246 result->putDirect(vm, structure->polyProtoOffset(), constructor->prototypeForConstruction(vm, exec)); 249 if (structure->hasPolyProto()) { 250 JSObject* prototype = constructor->prototypeForConstruction(vm, exec); 251 result->putDirect(vm, structure->polyProtoOffset(), prototype); 252 vm.prototypeMap.addPrototype(prototype); 253 } 247 254 } else { 248 255 // http://ecma-international.org/ecma-262/6.0/#sec-ordinarycreatefromconstructor
Note:
See TracChangeset
for help on using the changeset viewer.