Source/JavaScriptCore/bytecode/BytecodeList.json

1212 { "name" : "op_create_this", "length" : 4 },
1313 { "name" : "op_get_callee", "length" : 3 },
1414 { "name" : "op_to_this", "length" : 4 },
 15 { "name" : "op_check_tdz", "length" : 2 },
1516 { "name" : "op_new_object", "length" : 4 },
1617 { "name" : "op_new_array", "length" : 5 },
1718 { "name" : "op_new_array_with_size", "length" : 4 },
180651

Source/JavaScriptCore/bytecode/BytecodeUseDef.h

5757 return;
5858 case op_get_scope:
5959 case op_to_this:
 60 case op_check_tdz:
6061 case op_pop_scope:
6162 case op_profile_will_call:
6263 case op_profile_did_call:

365366 case op_mov:
366367 case op_new_object:
367368 case op_to_this:
 369 case op_check_tdz:
368370 case op_get_callee:
369371 case op_init_lazy_reg:
370372 case op_get_scope:
180651

Source/JavaScriptCore/bytecode/CodeBlock.cpp

782782 out.print(" ", (++it)->u.toThisStatus);
783783 break;
784784 }
 785 case op_check_tdz: {
 786 int r0 = (++it)->u.operand;
 787 printLocationOpAndRegisterOperand(out, exec, location, it, "check_tdz", r0);
 788 out.printf("%s", registerName(r0).data());
 789 break;
 790 }
785791 case op_new_object: {
786792 int r0 = (++it)->u.operand;
787793 unsigned inferredInlineCapacity = (++it)->u.operand;
180651

Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

6161 function->finishParsing(executable->parameters(), executable->name(), executable->functionMode());
6262 executable->recordParse(function->features(), function->hasCapturedVariables());
6363
64  UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode, ExecutableInfo(function->needsActivation(), function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction));
 64 UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode,
 65 ExecutableInfo(function->needsActivation(), function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable->constructorKindMaybeDerived()));
6566 auto generator(std::make_unique<BytecodeGenerator>(vm, function.get(), result, debuggerMode, profilerMode));
6667 error = generator->generate();
6768 if (error.isValid())

8485 , m_isInStrictContext(node->isInStrictContext())
8586 , m_hasCapturedVariables(false)
8687 , m_isBuiltinFunction(kind == UnlinkedBuiltinFunction)
 88 , m_constructorKindMaybeDerived(node->constructorKindMaybeDerived())
8789 , m_name(node->ident())
8890 , m_inferredName(node->inferredName())
8991 , m_parameters(node->parameters())

205207 , m_isConstructor(info.m_isConstructor)
206208 , m_hasCapturedVariables(false)
207209 , m_isBuiltinFunction(info.m_isBuiltinFunction)
 210 , m_constructorKindMaybeDerived(info.m_constructorKindMaybeDerived)
208211 , m_firstLine(0)
209212 , m_lineCount(0)
210213 , m_endColumn(UINT_MAX)
180651

Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

6666typedef unsigned UnlinkedLLIntCallLinkInfo;
6767
6868struct ExecutableInfo {
69  ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction)
 69 ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, bool constructorKindMaybeDerived)
7070 : m_needsActivation(needsActivation)
7171 , m_usesEval(usesEval)
7272 , m_isStrictMode(isStrictMode)
7373 , m_isConstructor(isConstructor)
7474 , m_isBuiltinFunction(isBuiltinFunction)
 75 , m_constructorKindMaybeDerived(constructorKindMaybeDerived)
7576 {
7677 }
7778 bool m_needsActivation : 1;

7980 bool m_isStrictMode : 1;
8081 bool m_isConstructor : 1;
8182 bool m_isBuiltinFunction : 1;
 83 bool m_constructorKindMaybeDerived : 1;
8284};
8385
8486enum UnlinkedFunctionKind {

117119 return JSParseStrict;
118120 return JSParseNormal;
119121 }
 122 bool constructorKindMaybeDerived() const { return m_constructorKindMaybeDerived; }
120123
121124 unsigned firstLineOffset() const { return m_firstLineOffset; }
122125 unsigned lineCount() const { return m_lineCount; }

169172 bool m_isInStrictContext : 1;
170173 bool m_hasCapturedVariables : 1;
171174 bool m_isBuiltinFunction : 1;
 175 bool m_constructorKindMaybeDerived : 1;
172176
173177 Identifier m_name;
174178 Identifier m_inferredName;

341345 bool isNumericCompareFunction() const { return m_isNumericCompareFunction; }
342346
343347 bool isBuiltinFunction() const { return m_isBuiltinFunction; }
 348 bool constructorKindMaybeDerived() const { return m_constructorKindMaybeDerived; }
344349
345350 void shrinkToFit()
346351 {

532537 bool m_isConstructor : 1;
533538 bool m_hasCapturedVariables : 1;
534539 bool m_isBuiltinFunction : 1;
 540 bool m_constructorKindMaybeDerived : 1;
535541 unsigned m_firstLine;
536542 unsigned m_lineCount;
537543 unsigned m_endColumn;
180651

Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

404404 addCallee(functionNode, calleeRegister);
405405
406406 if (isConstructor()) {
 407#if ENABLE(ES6_CLASS_SYNTAX)
 408 bool maybeDerived = constructorKindMaybeDerived();
 409 RefPtr<Label> constructorKindIsDerived;
 410 m_newTargetRegister = addVar();
 411 emitMove(m_newTargetRegister, &m_thisRegister);
 412 if (maybeDerived) {
 413 RegisterID callee(JSStack::Callee);
 414 RefPtr<RegisterID> isDerivedReg = emitGetById(newTemporary(), &callee, propertyNames().constructorKindIsDerivedPrivateName);
 415 constructorKindIsDerived = newLabel();
 416 emitJumpIfTrue(isDerivedReg.get(), constructorKindIsDerived.get());
 417 }
 418#endif
407419 emitCreateThis(&m_thisRegister);
 420#if ENABLE(ES6_CLASS_SYNTAX)
 421 if (maybeDerived) {
 422 RefPtr<Label> constructorKindIsBase;
 423 emitLabel(constructorKindIsDerived.get());
 424 emitMove(&m_thisRegister, addConstantEmptyValue());
 425 }
 426#endif
408427 } else if (functionNode->usesThis() || codeBlock->usesEval()) {
409428 m_codeBlock->addPropertyAccessInstruction(instructions().size());
410429 emitOpcode(op_to_this);

15741593 return dst;
15751594}
15761595
 1596void BytecodeGenerator::emitTDZCheck(RegisterID* target)
 1597{
 1598 emitOpcode(op_check_tdz);
 1599 instructions().append(target->index());
 1600}
 1601
15771602RegisterID* BytecodeGenerator::emitNewObject(RegisterID* dst)
15781603{
15791604 size_t begin = instructions().size();
180651

Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

269269 ParserArena& parserArena() const { return m_scopeNode->parserArena(); }
270270 const CommonIdentifiers& propertyNames() const { return *m_vm->propertyNames; }
271271
272  bool isConstructor() { return m_codeBlock->isConstructor(); }
 272 bool isConstructor() const { return m_codeBlock->isConstructor(); }
 273 bool constructorKindMaybeDerived() const { return m_codeBlock->constructorKindMaybeDerived(); }
273274
274275 ParserError generate();
275276

290291
291292 // Returns the register storing "this"
292293 RegisterID* thisRegister() { return &m_thisRegister; }
293 
 294 RegisterID* newTarget() { return m_newTargetRegister; }
 295
294296 RegisterID* scopeRegister() { return m_scopeRegister; }
295297
296298 // Returns the next available temporary register. Registers returned by

452454 RegisterID* emitUnaryNoDstOp(OpcodeID, RegisterID* src);
453455
454456 RegisterID* emitCreateThis(RegisterID* dst);
 457 void emitTDZCheck(RegisterID*);
455458 RegisterID* emitNewObject(RegisterID* dst);
456459 RegisterID* emitNewArray(RegisterID* dst, ElementNode*, unsigned length); // stops at first elision
457460

770773 RegisterID* m_emptyValueRegister { nullptr };
771774 RegisterID* m_globalObjectRegister { nullptr };
772775 RegisterID* m_localArgumentsRegister { nullptr };
 776 RegisterID* m_newTargetRegister { nullptr };
773777
774778 Vector<Identifier, 16> m_watchableVariables;
775779 SegmentedVector<RegisterID, 32> m_constantPoolRegisters;
180651

Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

138138 if (dst == generator.ignoredResult())
139139 return 0;
140140
 141#if ENABLE(ES6_CLASS_SYNTAX)
 142 generator.emitTDZCheck(generator.thisRegister());
 143#endif
 144
141145 RegisterID* result = generator.moveToDestinationIfNeeded(dst, generator.thisRegister());
142146 if (generator.vm()->typeProfiler()) {
143147 generator.emitProfileType(generator.thisRegister(), ProfileTypeBytecodeDoesNotHaveGlobalID, nullptr);

147151 return result;
148152}
149153
 154#if ENABLE(ES6_CLASS_SYNTAX)
 155
 156// ------------------------------ SuperNode -------------------------------------
 157
 158RegisterID* SuperNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 159{
 160 if (dst == generator.ignoredResult())
 161 return 0;
 162
 163 RegisterID callee;
 164 callee.setIndex(JSStack::Callee);
 165
 166 RefPtr<RegisterID> homeObject = generator.emitGetById(generator.newTemporary(), &callee, generator.propertyNames().homeObjectPrivateName);
 167 RefPtr<RegisterID> protoParent = generator.emitGetById(generator.newTemporary(), homeObject.get(), generator.propertyNames().underscoreProto);
 168 return generator.emitGetById(generator.finalDestination(dst), protoParent.get(), generator.propertyNames().constructor);
 169}
 170
 171static RegisterID* emitSuperBaseForCallee(BytecodeGenerator& generator)
 172{
 173 RegisterID callee;
 174 callee.setIndex(JSStack::Callee);
 175
 176 RefPtr<RegisterID> homeObject = generator.emitGetById(generator.newTemporary(), &callee, generator.propertyNames().homeObjectPrivateName);
 177 return generator.emitGetById(generator.newTemporary(), homeObject.get(), generator.propertyNames().underscoreProto);
 178}
 179
 180// ------------------------------ SuperBracketAccessorNode -------------------------------------
 181
 182RegisterID* SuperBracketAccessorNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 183{
 184 UNUSED_PARAM(m_subscript);
 185 if (dst == generator.ignoredResult())
 186 return 0;
 187
 188 RegisterID callee;
 189 callee.setIndex(JSStack::Callee);
 190
 191
 192
 193 return generator.moveToDestinationIfNeeded(dst, &callee /* generator.scopeRegister() */);
 194}
 195
 196// ------------------------------ SuperDotAccessorNode -------------------------------------
 197
 198RegisterID* SuperDotAccessorNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
 199{
 200 UNUSED_PARAM(m_ident);
 201 if (dst == generator.ignoredResult())
 202 return 0;
 203
 204 RegisterID callee;
 205 callee.setIndex(JSStack::Callee);
 206
 207 RefPtr<RegisterID> homeObject = generator.emitGetById(generator.newTemporary(), &callee, generator.propertyNames().homeObjectPrivateName);
 208 RefPtr<RegisterID> baseValue = generator.emitGetById(generator.newTemporary(), homeObject.get(), generator.propertyNames().underscoreProto);
 209 return generator.emitGetById(generator.tempDestination(dst), baseValue.get(), m_ident);
 210}
 211
 212#endif
 213
150214// ------------------------------ ResolveNode ----------------------------------
151215
152216bool ResolveNode::isPure(BytecodeGenerator& generator) const

285349
286350// ------------------------------ PropertyListNode -----------------------------
287351
 352#if ENABLE(ES6_CLASS_SYNTAX)
 353static inline void emitPutHomeObject(BytecodeGenerator& generator, RegisterID* function, RegisterID* homeObject)
 354{
 355 generator.emitPutById(function, generator.propertyNames().homeObjectPrivateName, homeObject);
 356}
 357#endif
 358
288359RegisterID* PropertyListNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
289360{
290361 // Fast case: this loop just handles regular value properties.

321392 }
322393
323394 RegisterID* value = generator.emitNode(node->m_assign);
 395#if ENABLE(ES6_CLASS_SYNTAX)
 396 if (node->isMethod())
 397 emitPutHomeObject(generator, value, dst);
 398#endif
324399
325400 // This is a get/set property, find its entry in the map.
326401 ASSERT(node->m_type == PropertyNode::Getter || node->m_type == PropertyNode::Setter);

366441
367442void PropertyListNode::emitPutConstantProperty(BytecodeGenerator& generator, RegisterID* newObj, PropertyNode& node)
368443{
 444 RefPtr<RegisterID> value = generator.emitNode(node.m_assign);
 445#if ENABLE(ES6_CLASS_SYNTAX)
 446 if (node.isMethod())
 447 emitPutHomeObject(generator, value.get(), newObj);
 448#endif
369449 if (node.name()) {
370  generator.emitDirectPutById(newObj, *node.name(), generator.emitNode(node.m_assign));
 450 generator.emitDirectPutById(newObj, *node.name(), value.get());
371451 return;
372452 }
373453 RefPtr<RegisterID> propertyName = generator.emitNode(node.m_expression);
374  generator.emitDirectPutByVal(newObj, propertyName.get(), generator.emitNode(node.m_assign));
 454 generator.emitDirectPutByVal(newObj, propertyName.get(), value.get());
375455}
376456
377457// ------------------------------ BracketAccessorNode --------------------------------
378458
379459RegisterID* BracketAccessorNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
380460{
 461#if ENABLE(ES6_CLASS_SYNTAX)
 462 if (m_base->isSuperNode()) {
 463 // FIXME: Should we generate the profiler info?
 464 if (m_subscript->isString()) {
 465 const Identifier& id = static_cast<StringNode*>(m_subscript)->value();
 466 return generator.emitGetById(generator.finalDestination(dst), emitSuperBaseForCallee(generator), id);
 467 }
 468 return generator.emitGetByVal(generator.finalDestination(dst), emitSuperBaseForCallee(generator), generator.emitNode(m_subscript));
 469 }
 470#endif
 471
381472 if (m_base->isResolveNode()
382473 && generator.willResolveToArgumentsRegister(static_cast<ResolveNode*>(m_base)->identifier())
383474 && !generator.symbolTable().slowArguments()) {

422513 }
423514
424515nonArgumentsPath:
 516#if ENABLE(ES6_CLASS_SYNTAX)
 517 RefPtr<RegisterID> base = m_base->isSuperNode() ? emitSuperBaseForCallee(generator) : generator.emitNode(m_base);
 518#else
425519 RefPtr<RegisterID> base = generator.emitNode(m_base);
 520#endif
426521 generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
427522 RegisterID* finalDest = generator.finalDestination(dst);
428523 RegisterID* ret = generator.emitGetById(finalDest, base.get(), m_ident);

510605 RefPtr<RegisterID> func = generator.emitNode(m_expr);
511606 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, func.get());
512607 CallArguments callArguments(generator, m_args);
 608#if ENABLE(ES6_CLASS_SYNTAX)
 609 if (m_expr->isSuperNode()) {
 610 generator.emitMove(callArguments.thisRegister(), generator.newTarget());
 611 RegisterID* ret = generator.emitConstruct(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
 612 generator.emitMove(generator.thisRegister(), ret);
 613 return ret;
 614 }
 615#endif
513616 generator.emitLoad(callArguments.thisRegister(), jsUndefined());
514617 RegisterID* ret = generator.emitCall(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
515618 if (generator.vm()->typeProfiler()) {

561664
562665RegisterID* FunctionCallBracketNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
563666{
 667#if ENABLE(ES6_CLASS_SYNTAX)
 668 bool baseIsSuper = m_base->isSuperNode();
 669 RefPtr<RegisterID> base = baseIsSuper ? emitSuperBaseForCallee(generator) : generator.emitNode(m_base);
 670#else
564671 RefPtr<RegisterID> base = generator.emitNode(m_base);
 672#endif
565673 RefPtr<RegisterID> property = generator.emitNode(m_subscript);
566674 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStart(), subexpressionEnd());
567675 RefPtr<RegisterID> function = generator.emitGetByVal(generator.tempDestination(dst), base.get(), property.get());
568676 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get());
569677 CallArguments callArguments(generator, m_args);
 678#if ENABLE(ES6_CLASS_SYNTAX)
 679 if (baseIsSuper)
 680 generator.emitMove(callArguments.thisRegister(), generator.thisRegister());
 681 else
 682 generator.emitMove(callArguments.thisRegister(), base.get());
 683#else
570684 generator.emitMove(callArguments.thisRegister(), base.get());
 685#endif
571686 RegisterID* ret = generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
572687 if (generator.vm()->typeProfiler()) {
573688 generator.emitProfileType(returnValue.get(), ProfileTypeBytecodeDoesNotHaveGlobalID, nullptr);

583698 RefPtr<RegisterID> function = generator.tempDestination(dst);
584699 RefPtr<RegisterID> returnValue = generator.finalDestination(dst, function.get());
585700 CallArguments callArguments(generator, m_args);
 701#if ENABLE(ES6_CLASS_SYNTAX)
 702 bool baseIsSuper = m_base->isSuperNode();
 703 if (baseIsSuper)
 704 generator.emitMove(callArguments.thisRegister(), generator.thisRegister());
 705 else
 706 generator.emitNode(callArguments.thisRegister(), m_base);
 707#else
586708 generator.emitNode(callArguments.thisRegister(), m_base);
 709#endif
587710 generator.emitExpressionInfo(subexpressionDivot(), subexpressionStart(), subexpressionEnd());
 711#if ENABLE(ES6_CLASS_SYNTAX)
 712 generator.emitGetById(function.get(), baseIsSuper ? emitSuperBaseForCallee(generator) : callArguments.thisRegister(), m_ident);
 713#else
588714 generator.emitGetById(function.get(), callArguments.thisRegister(), m_ident);
 715#endif
589716 RegisterID* ret = generator.emitCall(returnValue.get(), function.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
590717 if (generator.vm()->typeProfiler()) {
591718 generator.emitProfileType(returnValue.get(), ProfileTypeBytecodeDoesNotHaveGlobalID, nullptr);

9271054 RefPtr<RegisterID> r1 = generator.emitNode(m_subscript);
9281055
9291056 generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
 1057#if ENABLE(ES6_CLASS_SYNTAX)
 1058 if (m_base->isSuperNode())
 1059 return emitThrowReferenceError(generator, "Cannot delete a super property");
 1060#endif
9301061 return generator.emitDeleteByVal(generator.finalDestination(dst), r0.get(), r1.get());
9311062}
9321063

9371068 RefPtr<RegisterID> r0 = generator.emitNode(m_base);
9381069
9391070 generator.emitExpressionInfo(divot(), divotStart(), divotEnd());
 1071#if ENABLE(ES6_CLASS_SYNTAX)
 1072 if (m_base->isSuperNode())
 1073 return emitThrowReferenceError(generator, "Cannot delete a super property");
 1074#endif
9401075 return generator.emitDeleteById(generator.finalDestination(dst), r0.get(), m_ident);
9411076}
9421077

27942929
27952930RegisterID* ClassExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst)
27962931{
2797  ASSERT(!m_parentClassExpression);
 2932 RefPtr<RegisterID> classHeritage;
 2933 if (m_parentClassExpression) {
 2934 classHeritage = generator.newTemporary();
 2935 generator.emitNode(classHeritage.get(), m_parentClassExpression);
 2936 }
27982937
27992938 RefPtr<RegisterID> constructor = generator.emitNode(dst, m_constructorExpression);
 2939 // FIXME: Make the prototype non-configurable & non-writable.
28002940 RefPtr<RegisterID> prototype = generator.emitGetById(generator.newTemporary(), constructor.get(), generator.propertyNames().prototype);
28012941
 2942 if (classHeritage) {
 2943 RefPtr<RegisterID> protoParent = generator.newTemporary();
 2944 RefPtr<Label> classHeritageIsNull = generator.newLabel();
 2945 RefPtr<Label> protoParentIsSet = generator.newLabel();
 2946
 2947 generator.emitJumpIfTrue(generator.emitUnaryOp(op_eq_null, protoParent.get(), classHeritage.get()), classHeritageIsNull.get());
 2948
 2949 // FIXME: Throw TypeError if isConstructor(parentClass) is false or it's a generator function.
 2950 generator.emitGetById(protoParent.get(), classHeritage.get(), generator.propertyNames().prototype);
 2951 // FIXME: Throw TypeError if Type(protoParent) is not Object or null.
 2952
 2953 // ES6 draft doesn't store homeObject on the constructor but this would make supporting "new super" in constructor cumbersome.
 2954 emitPutHomeObject(generator, constructor.get(), prototype.get());
 2955 generator.emitDirectPutById(constructor.get(), generator.propertyNames().constructorKindIsDerivedPrivateName,
 2956 generator.emitLoad(generator.newTemporary(), jsBoolean(true)));
 2957
 2958 generator.emitDirectPutById(prototype.get(), generator.propertyNames().underscoreProto, protoParent.get());
 2959 generator.emitJump(protoParentIsSet.get());
 2960
 2961 generator.emitLabel(classHeritageIsNull.get());
 2962 generator.emitDirectPutById(prototype.get(), generator.propertyNames().underscoreProto, classHeritage.get());
 2963
 2964 generator.emitLabel(protoParentIsSet.get());
 2965 }
 2966
28022967 if (m_staticMethods)
28032968 generator.emitNode(constructor.get(), m_staticMethods);
28042969
180651

Source/JavaScriptCore/jit/JIT.cpp

202202 DEFINE_OP(op_get_callee)
203203 DEFINE_OP(op_create_this)
204204 DEFINE_OP(op_to_this)
 205 DEFINE_OP(op_check_tdz)
205206 DEFINE_OP(op_init_lazy_reg)
206207 DEFINE_OP(op_create_arguments)
207208 DEFINE_OP(op_debug)

376377 DEFINE_SLOWCASE_OP(op_construct_varargs)
377378 DEFINE_SLOWCASE_OP(op_construct)
378379 DEFINE_SLOWCASE_OP(op_to_this)
 380 DEFINE_SLOWCASE_OP(op_check_tdz)
379381 DEFINE_SLOWCASE_OP(op_create_this)
380382 DEFINE_SLOWCASE_OP(op_div)
381383 DEFINE_SLOWCASE_OP(op_eq)
180651

Source/JavaScriptCore/jit/JIT.h

469469 void emit_op_get_callee(Instruction*);
470470 void emit_op_create_this(Instruction*);
471471 void emit_op_to_this(Instruction*);
 472 void emit_op_check_tdz(Instruction*);
472473 void emit_op_create_arguments(Instruction*);
473474 void emit_op_debug(Instruction*);
474475 void emit_op_del_by_id(Instruction*);

572573 void emitSlow_op_construct_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
573574 void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
574575 void emitSlow_op_to_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
 576 void emitSlow_op_check_tdz(Instruction*, Vector<SlowCaseEntry>::iterator&);
575577 void emitSlow_op_create_this(Instruction*, Vector<SlowCaseEntry>::iterator&);
576578 void emitSlow_op_div(Instruction*, Vector<SlowCaseEntry>::iterator&);
577579 void emitSlow_op_eq(Instruction*, Vector<SlowCaseEntry>::iterator&);
180651

Source/JavaScriptCore/jit/JITOpcodes.cpp

729729 addSlowCase(branch32(NotEqual, Address(regT1, JSCell::structureIDOffset()), regT2));
730730}
731731
 732void JIT::emit_op_check_tdz(Instruction* currentInstruction)
 733{
 734 emitGetVirtualRegister(currentInstruction[1].u.operand, regT1);
 735 move(TrustedImmPtr(m_codeBlock->globalObject()->tdzValue()), regT1);
 736 comparePtr(Equal, regT0, regT1, regT0);
 737 addSlowCase(emitJumpIfNotImmediateInteger(regT0));
 738}
 739
732740void JIT::emit_op_get_callee(Instruction* currentInstruction)
733741{
734742 int result = currentInstruction[1].u.operand;

806814 slowPathCall.call();
807815}
808816
 817void JIT::emitSlow_op_check_tdz(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
 818{
 819 linkSlowCase(iter);
 820
 821 JITSlowPathCall slowPathCall(this, currentInstruction, slow_path_throw_tdz_error);
 822 slowPathCall.call();
 823}
 824
809825void JIT::emitSlow_op_to_primitive(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
810826{
811827 linkSlowCase(iter);
180651

Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

685685 dispatch(4)
686686
687687
 688_llint_op_check_tdz:
 689 traceExecution()
 690 loadpFromInstruction(1, t0)
 691 bqneq [cfr, t0, 8], ValueEmpty, .opNotTDZ
 692# bqneq t0, ValueEmpty, .opNotTDZ
 693# loadp CodeBlock[cfr], t1
 694# loadp CodeBlock::m_globalObject[t1], t1
 695# loadp JSGlobalObject::m_tdzValue[t1], t1
 696# bpneq t0, t1, .opNotTDZ
 697 callSlowPath(_slow_path_throw_tdz_error)
 698
 699.opNotTDZ:
 700 dispatch(2)
 701
 702
688703_llint_op_new_object:
689704 traceExecution()
690705 loadpFromInstruction(3, t0)
180651

Source/JavaScriptCore/parser/ASTBuilder.h

169169 usesThis();
170170 return new (m_parserArena) ThisNode(location);
171171 }
 172#if ENABLE(ES6_CLASS_SYNTAX)
 173 ExpressionNode* superExpr(const JSTokenLocation& location)
 174 {
 175 // FIXME: Add and call usesSuper();
 176 return new (m_parserArena) SuperNode(location);
 177 }
 178 ExpressionNode* createSuperCall(const JSTokenLocation& location, ArgumentsNode* arguments, const JSTextPosition& start, const JSTextPosition& divot, const JSTextPosition& end)
 179 {
 180 UNUSED_PARAM(arguments);
 181 UNUSED_PARAM(start);
 182 UNUSED_PARAM(divot);
 183 UNUSED_PARAM(end);
 184 return new (m_parserArena) SuperNode(location);
 185 }
 186 ExpressionNode* createSuperBracketAccess(const JSTokenLocation& location, ExpressionNode* property, const JSTextPosition& start, const JSTextPosition& divot, const JSTextPosition& end)
 187 {
 188 UNUSED_PARAM(property);
 189 UNUSED_PARAM(start);
 190 UNUSED_PARAM(divot);
 191 UNUSED_PARAM(end);
 192 return new (m_parserArena) SuperBracketAccessorNode(location, property);
 193 }
 194 ExpressionNode* createSuperDotAccess(const JSTokenLocation& location, const Identifier* property, const JSTextPosition& start, const JSTextPosition& divot, const JSTextPosition& end)
 195 {
 196 UNUSED_PARAM(start);
 197 UNUSED_PARAM(divot);
 198 UNUSED_PARAM(end);
 199 return new (m_parserArena) SuperDotAccessorNode(location, *property);
 200 }
 201#endif
172202 ExpressionNode* createResolve(const JSTokenLocation& location, const Identifier* ident, const JSTextPosition& start)
173203 {
174204 if (m_vm->propertyNames->arguments == *ident)

293323 return result;
294324 }
295325
296  FunctionBodyNode* createFunctionBody(const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, bool inStrictContext)
 326 FunctionBodyNode* createFunctionBody(const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, bool inStrictContext, JSParserConstructorKind constructorKind)
297327 {
298  return new (m_parserArena) FunctionBodyNode(m_parserArena, startLocation, endLocation, startColumn, endColumn, inStrictContext);
 328 return new (m_parserArena) FunctionBodyNode(m_parserArena, startLocation, endLocation, startColumn, endColumn, inStrictContext, constructorKind);
299329 }
300330
301331 void setFunctionNameStart(FunctionBodyNode* body, int functionNameStart)

328358 ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ExpressionNode* arg) { return new (m_parserArena) ArgumentListNode(location, arg); }
329359 ArgumentListNode* createArgumentsList(const JSTokenLocation& location, ArgumentListNode* args, ExpressionNode* arg) { return new (m_parserArena) ArgumentListNode(location, args, arg); }
330360
331  PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, bool)
 361 PropertyNode* createProperty(const Identifier* propertyName, ExpressionNode* node, PropertyNode::Type type, bool, bool isMethod = false)
332362 {
333363 if (node->isFuncExprNode())
334364 static_cast<FuncExprNode*>(node)->body()->setInferredName(*propertyName);
335  return new (m_parserArena) PropertyNode(*propertyName, node, type);
 365 return new (m_parserArena) PropertyNode(*propertyName, node, type, isMethod);
336366 }
337367 PropertyNode* createProperty(VM* vm, ParserArena& parserArena, double propertyName, ExpressionNode* node, PropertyNode::Type type, bool)
338368 {
180651

Source/JavaScriptCore/parser/NodeConstructors.h

102102 {
103103 }
104104
 105#if ENABLE(ES6_CLASS_SYNTAX)
 106 inline SuperNode::SuperNode(const JSTokenLocation& location)
 107 : ExpressionNode(location)
 108 {
 109 }
 110
 111 inline SuperBracketAccessorNode::SuperBracketAccessorNode(const JSTokenLocation& location, ExpressionNode* subscript)
 112 : ExpressionNode(location)
 113 , m_subscript(subscript)
 114 {
 115 }
 116
 117 inline SuperDotAccessorNode::SuperDotAccessorNode(const JSTokenLocation& location, const Identifier& ident)
 118 : ExpressionNode(location)
 119 , m_ident(ident)
 120 {
 121 }
 122#endif
 123
105124inline ResolveNode::ResolveNode(const JSTokenLocation& location, const Identifier& ident, const JSTextPosition& start)
106125 : ExpressionNode(location)
107126 , m_ident(ident)

149168 {
150169 }
151170
152  inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type)
 171 inline PropertyNode::PropertyNode(const Identifier& name, ExpressionNode* assign, Type type, bool isMethod = false)
153172 : m_name(&name)
154173 , m_assign(assign)
155174 , m_type(type)
 175 , m_isMethod(isMethod)
156176 {
157177 }
158178

161181 , m_expression(name)
162182 , m_assign(assign)
163183 , m_type(type)
 184 , m_isMethod(false)
164185 {
165186 }
166187
180651

Source/JavaScriptCore/parser/Nodes.cpp

167167 patterns()[i]->deref();
168168}
169169
170 FunctionBodyNode::FunctionBodyNode(ParserArena&, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, bool isInStrictContext)
 170FunctionBodyNode::FunctionBodyNode(ParserArena&, const JSTokenLocation& startLocation, const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn, bool isInStrictContext, JSParserConstructorKind constructorKind)
171171 : StatementNode(endLocation)
172172 , m_startColumn(startColumn)
173173 , m_endColumn(endColumn)
174174 , m_startStartOffset(startLocation.startOffset)
175175 , m_isInStrictContext(isInStrictContext)
 176 , m_constructorKindMaybeDerived(constructorKind == JSParserConstructorKind::MaybeDerived)
176177{
177178}
178179
180651

Source/JavaScriptCore/parser/Nodes.h

164164 virtual bool isSubtract() const { return false; }
165165 virtual bool isBoolean() const { return false; }
166166 virtual bool isSpreadExpression() const { return false; }
 167 virtual bool isSuperNode() const { return false; }
167168
168169 virtual void emitBytecodeInConditionContext(BytecodeGenerator&, Label*, Label*, FallThroughMode);
169170

429430 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
430431 };
431432
 433#if ENABLE(ES6_CLASS_SYNTAX)
 434 class SuperNode final : public ExpressionNode {
 435 public:
 436 SuperNode(const JSTokenLocation&);
 437
 438 private:
 439 virtual bool isSuperNode() const override { return true; }
 440 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
 441 };
 442
 443 class SuperBracketAccessorNode final : public ExpressionNode {
 444 public:
 445 SuperBracketAccessorNode(const JSTokenLocation&, ExpressionNode* subscript);
 446
 447 private:
 448 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
 449
 450 ExpressionNode* m_subscript;
 451 };
 452
 453 class SuperDotAccessorNode final : public ExpressionNode {
 454 public:
 455 SuperDotAccessorNode(const JSTokenLocation&, const Identifier&);
 456
 457 private:
 458 virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
 459
 460 const Identifier& m_ident;
 461 };
 462#endif
 463
432464 class ResolveNode : public ExpressionNode {
433465 public:
434466 ResolveNode(const JSTokenLocation&, const Identifier&, const JSTextPosition& start);

484516 public:
485517 enum Type { Constant = 1, Getter = 2, Setter = 4 };
486518
487  PropertyNode(const Identifier&, ExpressionNode*, Type);
 519 PropertyNode(const Identifier&, ExpressionNode*, Type, bool isMethod);
488520 PropertyNode(ExpressionNode* propertyName, ExpressionNode*, Type);
489521
490522 ExpressionNode* expressionName() const { return m_expression; }
491523 const Identifier* name() const { return m_name; }
492524
493  Type type() const { return m_type; }
 525 Type type() const { return static_cast<Type>(m_type); }
 526 bool isMethod() const { return m_isMethod; }
494527
495528 private:
496529 friend class PropertyListNode;
497530 const Identifier* m_name;
498531 ExpressionNode* m_expression;
499532 ExpressionNode* m_assign;
500  Type m_type;
 533 unsigned m_type : 3;
 534 unsigned m_isMethod : 1;
501535 };
502536
503537 class PropertyListNode : public ExpressionNode {

15281562 public:
15291563 using ParserArenaDeletable::operator new;
15301564
1531  FunctionBodyNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, bool isInStrictContext);
 1565 FunctionBodyNode(ParserArena&, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, bool isInStrictContext, JSParserConstructorKind);
15321566
15331567 FunctionParameters* parameters() const { return m_parameters.get(); }
15341568

15561590
15571591 int startStartOffset() const { return m_startStartOffset; }
15581592 bool isInStrictContext() const { return m_isInStrictContext; }
 1593 bool constructorKindMaybeDerived() { return m_constructorKindMaybeDerived; }
15591594
15601595 protected:
15611596 Identifier m_ident;

15681603 unsigned m_endColumn;
15691604 SourceCode m_source;
15701605 int m_startStartOffset;
1571  bool m_isInStrictContext;
 1606 bool m_isInStrictContext : 1;
 1607 bool m_constructorKindMaybeDerived : 1;
15721608 };
15731609
15741610 class FunctionNode final : public ScopeNode {
180651

Source/JavaScriptCore/parser/Parser.cpp

12541254}
12551255
12561256template <typename LexerType>
1257 template <class TreeBuilder> TreeFunctionBody Parser<LexerType>::parseFunctionBody(TreeBuilder& context)
 1257template <class TreeBuilder> TreeFunctionBody Parser<LexerType>::parseFunctionBody(TreeBuilder& context, JSParserConstructorKind constructorKind)
12581258{
12591259 JSTokenLocation startLocation(tokenLocation());
12601260 unsigned startColumn = tokenColumn();

12621262
12631263 if (match(CLOSEBRACE)) {
12641264 unsigned endColumn = tokenColumn();
1265  return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, strictMode());
 1265 return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, strictMode(), constructorKind);
12661266 }
12671267 DepthManager statementDepth(&m_statementDepth);
12681268 m_statementDepth = 0;
12691269 typename TreeBuilder::FunctionBodyBuilder bodyBuilder(const_cast<VM*>(m_vm), m_lexer.get());
12701270 failIfFalse(parseSourceElements(bodyBuilder, CheckForStrictMode), "Cannot parse body of this function");
12711271 unsigned endColumn = tokenColumn();
1272  return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, strictMode());
 1272 return context.createFunctionBody(startLocation, tokenLocation(), startColumn, endColumn, strictMode(), constructorKind);
12731273}
12741274
12751275static const char* stringForFunctionMode(FunctionParseMode mode)

12911291}
12921292
12931293template <typename LexerType>
1294 template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ParserFunctionInfo<TreeBuilder>& info)
 1294template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode,
 1295 bool nameIsInContainingScope, JSParserConstructorKind constructorKind, ParserFunctionInfo<TreeBuilder>& info)
12951296{
12961297 AutoPopScopeRef functionScope(this, pushScope());
12971298 functionScope->setIsFunction();

13441345 endLocation.startOffset - endLocation.lineStartOffset;
13451346 unsigned currentLineStartOffset = m_token.m_location.lineStartOffset;
13461347
1347  info.body = context.createFunctionBody(startLocation, endLocation, info.bodyStartColumn, bodyEndColumn, cachedInfo->strictMode);
 1348 info.body = context.createFunctionBody(startLocation, endLocation, info.bodyStartColumn, bodyEndColumn, cachedInfo->strictMode, constructorKind);
13481349
13491350 functionScope->restoreFromSourceProviderCache(cachedInfo);
13501351 failIfFalse(popScope(functionScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error");

13671368 }
13681369 m_lastFunctionName = lastFunctionName;
13691370 ParserState oldState = saveState();
1370  info.body = parseFunctionBody(context);
 1371 info.body = parseFunctionBody(context, constructorKind);
13711372 restoreState(oldState);
13721373 failIfFalse(info.body, "Cannot parse the body of this ", stringForFunctionMode(mode));
13731374 context.setEndOffset(info.body, m_lexer->currentOffset());

14161417 unsigned functionKeywordStart = tokenStart();
14171418 next();
14181419 ParserFunctionInfo<TreeBuilder> info;
1419  failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, info)), "Cannot parse this function");
 1420 failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, true, JSParserConstructorKind::Base, info)), "Cannot parse this function");
14201421 failIfFalse(info.name, "Function statements must have a name");
14211422 failIfFalseIfStrict(declareVariable(info.name), "Cannot declare a function named '", info.name->impl(), "' in strict mode");
14221423 return context.createFuncDeclStatement(location, info, functionKeywordStart);

14661467 if (consume(EXTENDS)) {
14671468 parentClass = parsePrimaryExpression(context);
14681469 failIfFalse(parentClass, "Cannot parse the parent class name");
1469  failWithMessage("Inheritance is not supported yet");
14701470 }
 1471 const JSParserConstructorKind constructorKind = parentClass ? JSParserConstructorKind::MaybeDerived : JSParserConstructorKind::Base;
14711472
14721473 consumeOrFailWithFlags(OPENBRACE, TreeBuilder::DontBuildStrings, "Expected opening '{' at the start of a class body");
14731474

15031504 failIfFalse(property, "Cannot parse this method");
15041505 } else {
15051506 ParserFunctionInfo<TreeBuilder> methodInfo;
1506  failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, false, methodInfo)), "Cannot parse this method");
 1507 failIfFalse((parseFunctionInfo(context, FunctionNeedsName, FunctionMode, false, constructorKind, methodInfo)), "Cannot parse this method");
15071508 failIfFalse(methodInfo.name, "method must have a name");
15081509 failIfFalse(declareVariable(methodInfo.name), "Cannot declare a method named '", methodInfo.name->impl(), "'");
15091510

15211522 // FIXME: Syntax error when super() is called
15221523 semanticFailIfTrue(isStaticMethod && *methodInfo.name == propertyNames.prototype,
15231524 "Cannot declare a static method named 'prototype'");
1524  property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, alwaysStrictInsideClass);
 1525 bool isMethod = true;
 1526 property = context.createProperty(methodInfo.name, method, PropertyNode::Constant, alwaysStrictInsideClass, isMethod);
15251527 }
15261528
15271529 TreePropertyList& tail = isStaticMethod ? staticMethodsTail : instanceMethodsTail;

19881990 ParserFunctionInfo<TreeBuilder> info;
19891991 if (type == PropertyNode::Getter) {
19901992 failIfFalse(match(OPENPAREN), "Expected a parameter list for getter definition");
1991  failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, info)), "Cannot parse getter definition");
 1993 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, GetterMode, false, JSParserConstructorKind::Base, info)), "Cannot parse getter definition");
19921994 } else {
19931995 failIfFalse(match(OPENPAREN), "Expected a parameter list for setter definition");
1994  failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, info)), "Cannot parse setter definition");
 1996 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, SetterMode, false, JSParserConstructorKind::Base, info)), "Cannot parse setter definition");
19951997 }
19961998 if (stringPropertyName)
19971999 return context.createGetterOrSetterProperty(location, type, strict, stringPropertyName, info, getterOrSetterStartOffset);

21802182 next();
21812183 ParserFunctionInfo<TreeBuilder> info;
21822184 info.name = &m_vm->propertyNames->nullIdentifier;
2183  failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function expression");
 2185 failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, JSParserConstructorKind::Base, info)), "Cannot parse function expression");
21842186 return context.createFunctionExpr(location, info, functionKeywordStart);
21852187 }
21862188#if ENABLE(ES6_CLASS_SYNTAX)

23242326 newCount++;
23252327 }
23262328
 2329#if ENABLE(ES6_CLASS_SYNTAX)
 2330 bool baseIsSuper = match(SUPER);
 2331 if (baseIsSuper) {
 2332 base = context.superExpr(location);
 2333 next();
 2334 } else
 2335 base = parsePrimaryExpression(context);
 2336#else
23272337 base = parsePrimaryExpression(context);
 2338#endif
23282339
23292340 failIfFalse(base, "Cannot parse base expression");
23302341 while (true) {

23382349 int initialAssignments = m_assignmentCount;
23392350 TreeExpression property = parseExpression(context);
23402351 failIfFalse(property, "Cannot parse subscript expression");
 2352#if ENABLE(ES6_CLASS_SYNTAX)
 2353 if (baseIsSuper)
 2354 failIfTrue(initialAssignments || m_assignmentCount, "Cannot assign a value to super");
 2355#endif
23412356 base = context.createBracketAccess(location, base, property, initialAssignments != m_assignmentCount, expressionStart, expressionEnd, tokenEndPosition());
23422357 handleProductionOrFail(CLOSEBRACKET, "]", "end", "subscript expression");
23432358 m_nonLHSCount = nonLHSCount;

23562371 JSTextPosition expressionEnd = lastTokenEndPosition();
23572372 TreeArguments arguments = parseArguments(context, AllowSpread);
23582373 failIfFalse(arguments, "Cannot parse call arguments");
 2374 // FIXME: if baseIsSuper: failIfFalse(isConstructor, "Cannot call super() in this function").
23592375 base = context.makeFunctionCallNode(startLocation, base, arguments, expressionStart, expressionEnd, lastTokenEndPosition());
23602376 }
23612377 m_nonLHSCount = nonLHSCount;

23732389 default:
23742390 goto endMemberExpression;
23752391 }
 2392#if ENABLE(ES6_CLASS_SYNTAX)
 2393 baseIsSuper = false;
 2394#endif
23762395 }
23772396endMemberExpression:
 2397#if ENABLE(ES6_CLASS_SYNTAX)
 2398 failIfTrue(baseIsSuper && !newCount, "Cannot reference super");
 2399#endif
23782400 while (newCount--)
23792401 base = context.createNewExpr(location, base, expressionStart, lastTokenEndPosition());
23802402 return base;
180651

Source/JavaScriptCore/parser/Parser.h

740740 template <class TreeBuilder> ALWAYS_INLINE TreeArguments parseArguments(TreeBuilder&, SpreadMode);
741741 template <class TreeBuilder> TreeProperty parseProperty(TreeBuilder&, bool strict);
742742 template <class TreeBuilder> TreeProperty parseGetterSetter(TreeBuilder&, bool strict, PropertyNode::Type, unsigned getterOrSetterStartOffset);
743  template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&);
 743 template <class TreeBuilder> ALWAYS_INLINE TreeFunctionBody parseFunctionBody(TreeBuilder&, JSParserConstructorKind);
744744 template <class TreeBuilder> ALWAYS_INLINE TreeFormalParameterList parseFormalParameters(TreeBuilder&);
745745 enum VarDeclarationListContext { ForLoopContext, VarDeclarationContext };
746746 template <class TreeBuilder> TreeExpression parseVarDeclarationList(TreeBuilder&, int& declarations, TreeDeconstructionPattern& lastPattern, TreeExpression& lastInitializer, JSTextPosition& identStart, JSTextPosition& initStart, JSTextPosition& initEnd, VarDeclarationListContext);

750750 template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern parseDeconstructionPattern(TreeBuilder&, DeconstructionKind, int depth = 0);
751751 template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern tryParseDeconstructionPatternExpression(TreeBuilder&);
752752
753  template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ParserFunctionInfo<TreeBuilder>&);
 753 template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, JSParserConstructorKind, ParserFunctionInfo<TreeBuilder>&);
754754#if ENABLE(ES6_CLASS_SYNTAX)
755755 template <class TreeBuilder> NEVER_INLINE TreeClassExpression parseClass(TreeBuilder&, FunctionRequirements);
756756#endif
180651

Source/JavaScriptCore/parser/ParserModes.h

3333
3434enum JSParserStrictness { JSParseNormal, JSParseBuiltin, JSParseStrict };
3535enum JSParserMode { JSParseProgramCode, JSParseFunctionCode };
 36enum class JSParserConstructorKind { Base, MaybeDerived };
3637
3738enum ProfilerMode { ProfilerOff, ProfilerOn };
3839enum DebuggerMode { DebuggerOff, DebuggerOn };
180651

Source/JavaScriptCore/parser/SyntaxChecker.h

7373 enum { NoneExpr = 0,
7474 ResolveEvalExpr, ResolveExpr, NumberExpr, StringExpr,
7575 ThisExpr, NullExpr, BoolExpr, RegExpExpr, ObjectLiteralExpr,
76  FunctionExpr, ClassExpr, BracketExpr, DotExpr, CallExpr,
 76#if ENABLE(ES6_CLASS_SYNTAX)
 77 ClassExpr, SuperExpr, SuperBracketExpr, SuperDotExpr,
 78#endif
 79 FunctionExpr, BracketExpr, DotExpr, CallExpr,
7780 NewExpr, PreExpr, PostExpr, UnaryExpr, BinaryExpr,
7881 ConditionalExpr, AssignmentExpr, TypeofExpr,
7982 DeleteExpr, ArrayLiteralExpr, BindingDeconstruction,

146149 ExpressionType createUnaryPlus(const JSTokenLocation&, ExpressionType) { return UnaryExpr; }
147150 ExpressionType createVoid(const JSTokenLocation&, ExpressionType) { return UnaryExpr; }
148151 ExpressionType thisExpr(const JSTokenLocation&) { return ThisExpr; }
 152 ExpressionType superExpr(const JSTokenLocation&) { return ThisExpr; }
 153#if ENABLE(ES6_CLASS_SYNTAX)
 154 ExpressionType createSuperCall(const JSTokenLocation&, ExpressionType, const JSTextPosition&, const JSTextPosition&, const JSTextPosition&) { return SuperExpr; }
 155 ExpressionType createSuperBracketAccess(const JSTokenLocation&, ExpressionType, const JSTextPosition&, const JSTextPosition&, const JSTextPosition&) { return SuperBracketExpr; }
 156 ExpressionType createSuperDotAccess(const JSTokenLocation&, const Identifier*, const JSTextPosition&, const JSTextPosition&, const JSTextPosition&) { return SuperDotExpr; }
 157#endif
149158 ExpressionType createResolve(const JSTokenLocation&, const Identifier*, int) { return ResolveExpr; }
150159 ExpressionType createObjectLiteral(const JSTokenLocation&) { return ObjectLiteralExpr; }
151160 ExpressionType createObjectLiteral(const JSTokenLocation&, int) { return ObjectLiteralExpr; }

167176 ClassExpression createClassExpr(const JSTokenLocation&, const Identifier&, ExpressionType, ExpressionType, PropertyList, PropertyList) { return ClassExpr; }
168177#endif
169178 ExpressionType createFunctionExpr(const JSTokenLocation&, const ParserFunctionInfo<SyntaxChecker>&, int) { return FunctionExpr; }
170  int createFunctionBody(const JSTokenLocation&, const JSTokenLocation&, int, int, bool) { return FunctionBodyResult; }
 179 int createFunctionBody(const JSTokenLocation&, const JSTokenLocation&, int, int, bool, JSParserConstructorKind) { return FunctionBodyResult; }
171180 void setFunctionNameStart(int, int) { }
172181 int createArguments() { return ArgumentsResult; }
173182 int createArguments(int) { return ArgumentsResult; }
174183 ExpressionType createSpreadExpression(const JSTokenLocation&, ExpressionType, int, int, int) { return SpreadExpr; }
175184 int createArgumentsList(const JSTokenLocation&, int) { return ArgumentsListResult; }
176185 int createArgumentsList(const JSTokenLocation&, int, int) { return ArgumentsListResult; }
177  Property createProperty(const Identifier* name, int, PropertyNode::Type type, bool complete)
 186 Property createProperty(const Identifier* name, int, PropertyNode::Type type, bool complete, bool = false)
178187 {
179188 if (!complete)
180189 return Property(type);
180651

Source/JavaScriptCore/runtime/CommonIdentifiers.h

253253 macro(isFinite) \
254254 macro(TypeError) \
255255 macro(undefined) \
256  macro(BuiltinLog)
 256 macro(BuiltinLog) \
 257 macro(homeObject) \
 258 macro(constructorKindIsDerived) \
 259 macro(isInTemporalDeadZone) \
257260
258261namespace JSC {
259262
180651

Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

265265 RETURN(v1.toThis(exec, exec->codeBlock()->isStrictMode() ? StrictMode : NotStrictMode));
266266}
267267
 268SLOW_PATH_DECL(slow_path_throw_tdz_error)
 269{
 270 BEGIN();
 271 THROW(createReferenceError(exec, "Cannot access uninitialized variable."));
 272}
 273
268274SLOW_PATH_DECL(slow_path_not)
269275{
270276 BEGIN();
180651

Source/JavaScriptCore/runtime/CommonSlowPaths.h

187187SLOW_PATH_HIDDEN_DECL(slow_path_enter);
188188SLOW_PATH_HIDDEN_DECL(slow_path_get_callee);
189189SLOW_PATH_HIDDEN_DECL(slow_path_to_this);
 190SLOW_PATH_HIDDEN_DECL(slow_path_throw_tdz_error);
190191SLOW_PATH_HIDDEN_DECL(slow_path_not);
191192SLOW_PATH_HIDDEN_DECL(slow_path_eq);
192193SLOW_PATH_HIDDEN_DECL(slow_path_neq);
180651

Source/JavaScriptCore/runtime/Executable.h

467467
468468 void clearCode();
469469
470  ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false); }
 470 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, false); }
471471
472472 unsigned numVariables() { return m_unlinkedEvalCodeBlock->numVariables(); }
473473 unsigned numberOfFunctionDecls() { return m_unlinkedEvalCodeBlock->numberOfFunctionDecls(); }

522522
523523 void clearCode();
524524
525  ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false); }
 525 ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, false); }
526526
527527private:
528528 friend class ScriptExecutable;
180651

Source/JavaScriptCore/runtime/JSGlobalObject.cpp

272272 m_strictEvalActivationStructure.set(vm, this, StrictEvalActivation::createStructure(vm, this, jsNull()));
273273 m_debuggerScopeStructure.set(m_vm, this, DebuggerScope::createStructure(m_vm, this));
274274 m_withScopeStructure.set(vm, this, JSWithScope::createStructure(vm, this, jsNull()));
275 
 275
 276 m_tdzValue.set(vm, this, JSFinalObject::create(vm, JSFinalObject::createStructure(vm, this, jsNull(), JSFinalObject::defaultInlineCapacity())));
276277 m_nullPrototypeObjectStructure.set(vm, this, JSFinalObject::createStructure(vm, this, jsNull(), JSFinalObject::defaultInlineCapacity()));
277278
278279 m_callbackFunctionStructure.set(vm, this, JSCallbackFunction::createStructure(vm, this, m_functionPrototype.get()));

696697 visitor.append(&thisObject->m_objcCallbackFunctionStructure);
697698 visitor.append(&thisObject->m_objcWrapperObjectStructure);
698699#endif
 700 visitor.append(&thisObject->m_tdzValue);
699701 visitor.append(&thisObject->m_nullPrototypeObjectStructure);
700702 visitor.append(&thisObject->m_errorStructure);
701703 visitor.append(&thisObject->m_calleeStructure);
180651

Source/JavaScriptCore/runtime/JSGlobalObject.h

189189 WriteBarrier<JSFunction> m_applyFunction;
190190 WriteBarrier<GetterSetter> m_throwTypeErrorGetterSetter;
191191
 192 WriteBarrier<JSObject> m_tdzValue;
 193
192194 WriteBarrier<ObjectPrototype> m_objectPrototype;
193195 WriteBarrier<FunctionPrototype> m_functionPrototype;
194196 WriteBarrier<ArrayPrototype> m_arrayPrototype;

395397 return m_throwTypeErrorGetterSetter.get();
396398 }
397399
 400 JSObject* tdzValue() const { return m_tdzValue.get(); }
 401
398402 ObjectPrototype* objectPrototype() const { return m_objectPrototype.get(); }
399403 FunctionPrototype* functionPrototype() const { return m_functionPrototype.get(); }
400404 ArrayPrototype* arrayPrototype() const { return m_arrayPrototype.get(); }
180651