diff options
Diffstat (limited to 'Source/JavaScriptCore/bytecompiler')
-rw-r--r-- | Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 17 | ||||
-rw-r--r-- | Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h | 1 |
2 files changed, 16 insertions, 2 deletions
diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 14a69b530..c8cfa74b6 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -708,6 +708,15 @@ void BytecodeGenerator::prependComment(const char* string) } #endif +ArrayProfile* BytecodeGenerator::newArrayProfile() +{ +#if ENABLE(VALUE_PROFILER) + return m_codeBlock->addArrayProfile(instructions().size()); +#else + return 0; +#endif +} + ValueProfile* BytecodeGenerator::emitProfiledOpcode(OpcodeID opcodeID) { #if ENABLE(VALUE_PROFILER) @@ -1455,9 +1464,7 @@ RegisterID* BytecodeGenerator::emitResolveWithBase(RegisterID* baseDst, Register #if ENABLE(JIT) m_codeBlock->addGlobalResolveInfo(instructions().size()); #endif -#if ENABLE(CLASSIC_INTERPRETER) m_codeBlock->addGlobalResolveInstruction(instructions().size()); -#endif ValueProfile* profile = emitProfiledOpcode(op_resolve_global); instructions().append(propDst->index()); instructions().append(addConstant(property)); @@ -1669,11 +1676,13 @@ RegisterID* BytecodeGenerator::emitDeleteById(RegisterID* dst, RegisterID* base, RegisterID* BytecodeGenerator::emitGetArgumentByVal(RegisterID* dst, RegisterID* base, RegisterID* property) { + ArrayProfile* arrayProfile = newArrayProfile(); ValueProfile* profile = emitProfiledOpcode(op_get_argument_by_val); instructions().append(dst->index()); ASSERT(base->index() == m_codeBlock->argumentsRegister()); instructions().append(base->index()); instructions().append(property->index()); + instructions().append(arrayProfile); instructions().append(profile); return dst; } @@ -1693,20 +1702,24 @@ RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, R return dst; } } + ArrayProfile* arrayProfile = newArrayProfile(); ValueProfile* profile = emitProfiledOpcode(op_get_by_val); instructions().append(dst->index()); instructions().append(base->index()); instructions().append(property->index()); + instructions().append(arrayProfile); instructions().append(profile); return dst; } RegisterID* BytecodeGenerator::emitPutByVal(RegisterID* base, RegisterID* property, RegisterID* value) { + ArrayProfile* arrayProfile = newArrayProfile(); emitOpcode(op_put_by_val); instructions().append(base->index()); instructions().append(property->index()); instructions().append(value->index()); + instructions().append(arrayProfile); return value; } diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 490991fa7..9c094414d 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -555,6 +555,7 @@ namespace JSC { #endif void emitOpcode(OpcodeID); + ArrayProfile* newArrayProfile(); ValueProfile* emitProfiledOpcode(OpcodeID); void retrieveLastBinaryOp(int& dstIndex, int& src1Index, int& src2Index); void retrieveLastUnaryOp(int& dstIndex, int& srcIndex); |