+ ValueProfile* profile = emitProfiledOpcode(op_resolve);
+ instructions().append(propDst->index());
+ instructions().append(addConstant(property));
+ instructions().append(profile);
+ return baseDst;
+ }
+#if ENABLE(JIT)
+ m_codeBlock->addGlobalResolveInfo(instructions().size());
+#endif
+#if ENABLE(CLASSIC_INTERPRETER)
+ m_codeBlock->addGlobalResolveInstruction(instructions().size());
+#endif
+ ValueProfile* profile = emitProfiledOpcode(requiresDynamicChecks ? op_resolve_global_dynamic : op_resolve_global);
+ instructions().append(propDst->index());
+ instructions().append(addConstant(property));
+ instructions().append(0);
+ instructions().append(0);
+ if (requiresDynamicChecks)
+ instructions().append(depth);
+ instructions().append(profile);
+ return baseDst;
+}
+
+RegisterID* BytecodeGenerator::emitResolveWithThis(RegisterID* baseDst, RegisterID* propDst, const Identifier& property)
+{
+ size_t depth = 0;
+ int index = 0;
+ JSObject* globalObject = 0;
+ bool requiresDynamicChecks = false;
+ if (!findScopedProperty(property, index, depth, false, requiresDynamicChecks, globalObject) || !globalObject || requiresDynamicChecks) {
+ // We can't optimise at all :-(
+ ValueProfile* profile = emitProfiledOpcode(op_resolve_with_this);
+ instructions().append(baseDst->index());
+ instructions().append(propDst->index());
+ instructions().append(addConstant(property));
+ instructions().append(profile);
+ return baseDst;
+ }
+
+ bool forceGlobalResolve = false;
+
+ // Global object is the base
+ emitLoad(baseDst, jsUndefined());
+
+ if (index != missingSymbolMarker() && !forceGlobalResolve) {
+ // Directly index the property lookup across multiple scopes.
+ emitGetScopedVar(propDst, depth, index, globalObject);
+ return baseDst;
+ }
+ if (shouldAvoidResolveGlobal()) {
+ ValueProfile* profile = emitProfiledOpcode(op_resolve);