Ignore:
Timestamp:
May 24, 2010, 8:04:43 PM (15 years ago)
Author:
[email protected]
Message:

Relanding r60075.

Reviewed by Sam Weinig.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dump):
(JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset):

  • bytecode/CodeBlock.h:
  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitConstruct):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::emitGetByIdExceptionInfo):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):

  • jit/JIT.h:
  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):

  • jit/JITCall32_64.cpp:

(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):

  • jit/JITOpcodes.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emit_op_convert_this):
(JSC::JIT::emit_op_get_callee):
(JSC::JIT::emit_op_create_this):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::privateCompileCTIMachineTrampolines):
(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emit_op_get_callee):
(JSC::JIT::emit_op_create_this):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):
(JSC::JITThunks::hostFunctionStub):

  • jit/JITStubs.h:

(JSC::JITThunks::ctiNativeConstruct):
(JSC::):

  • runtime/ExceptionHelpers.cpp:

(JSC::createNotAnObjectError):

  • runtime/Executable.h:

(JSC::NativeExecutable::create):
(JSC::NativeExecutable::NativeExecutable):

  • runtime/JSFunction.cpp:

(JSC::callHostFunctionAsConstructor):

  • runtime/JSFunction.h:
  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r60105 r60117  
    365365    ++m_nextParameterIndex;
    366366    ++m_codeBlock->m_numParameters;
    367 
    368     if (!isConstructor() && (functionBody->usesThis() || m_shouldEmitDebugHooks)) {
    369         emitOpcode(op_convert_this);
    370         instructions().append(m_thisRegister.index());
    371     }
    372367   
    373368    for (size_t i = 0; i < parameterCount; ++i)
     
    375370
    376371    preserveLastVar();
     372
     373    if (isConstructor()) {
     374        RefPtr<RegisterID> func = newTemporary();
     375        RefPtr<RegisterID> funcProto = newTemporary();
     376
     377        emitOpcode(op_get_callee);
     378        instructions().append(func->index());
     379        // Load prototype.
     380        emitGetByIdExceptionInfo(op_create_this);
     381        emitGetById(funcProto.get(), func.get(), globalData()->propertyNames->prototype);
     382
     383        emitOpcode(op_create_this);
     384        instructions().append(m_thisRegister.index());
     385        instructions().append(funcProto->index());
     386    } else if (functionBody->usesThis() || m_shouldEmitDebugHooks) {
     387        emitOpcode(op_convert_this);
     388        instructions().append(m_thisRegister.index());
     389    }
    377390}
    378391
     
    15821595    }
    15831596
    1584     RefPtr<RegisterID> funcProto = newTemporary();
    1585 
    15861597    // Generate code for arguments.
    15871598    Vector<RefPtr<RegisterID>, 16> argv;
     
    15991610    }
    16001611
    1601     // Load prototype.
    1602     emitExpressionInfo(divot, startOffset, endOffset);
    1603     emitGetByIdExceptionInfo(op_construct);
    1604     emitGetById(funcProto.get(), func, globalData()->propertyNames->prototype);
    1605 
    16061612    // Reserve space for call frame.
    16071613    Vector<RefPtr<RegisterID>, RegisterFile::CallFrameHeaderSize> callFrame;
     
    16191625    instructions().append(argv.size()); // argCount
    16201626    instructions().append(argv[0]->index() + argv.size() + RegisterFile::CallFrameHeaderSize); // registerOffset
    1621     instructions().append(funcProto->index()); // proto
    1622     instructions().append(argv[0]->index()); // thisRegister
    16231627    if (dst != ignoredResult()) {
    16241628        emitOpcode(op_call_put_result);
Note: See TracChangeset for help on using the changeset viewer.