diff options
| author | Russell Brenner <russellbrenner@google.com> | 2010-11-18 17:33:13 -0800 |
|---|---|---|
| committer | Russell Brenner <russellbrenner@google.com> | 2010-12-02 13:47:21 -0800 |
| commit | 6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch) | |
| tree | 103a13998c33944d6ab3b8318c509a037e639460 /JavaScriptCore/jit/JITOpcodes32_64.cpp | |
| parent | bdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff) | |
| download | external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2 | |
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'JavaScriptCore/jit/JITOpcodes32_64.cpp')
| -rw-r--r-- | JavaScriptCore/jit/JITOpcodes32_64.cpp | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/JavaScriptCore/jit/JITOpcodes32_64.cpp b/JavaScriptCore/jit/JITOpcodes32_64.cpp index 8e0226d..076649d 100644 --- a/JavaScriptCore/jit/JITOpcodes32_64.cpp +++ b/JavaScriptCore/jit/JITOpcodes32_64.cpp @@ -512,6 +512,20 @@ void JIT::emit_op_new_object(Instruction* currentInstruction) JITStubCall(this, cti_op_new_object).call(currentInstruction[1].u.operand); } +void JIT::emit_op_check_has_instance(Instruction* currentInstruction) +{ + unsigned baseVal = currentInstruction[1].u.operand; + + emitLoadPayload(baseVal, regT0); + + // Check that baseVal is a cell. + emitJumpSlowCaseIfNotJSCell(baseVal); + + // Check that baseVal 'ImplementsHasInstance'. + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); + addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsHasInstance))); +} + void JIT::emit_op_instanceof(Instruction* currentInstruction) { unsigned dst = currentInstruction[1].u.operand; @@ -525,15 +539,15 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction) emitLoadPayload(baseVal, regT0); emitLoadPayload(proto, regT1); - // Check that value, baseVal, and proto are cells. + // Check that proto are cells. baseVal must be a cell - this is checked by op_check_has_instance. emitJumpSlowCaseIfNotJSCell(value); - emitJumpSlowCaseIfNotJSCell(baseVal); emitJumpSlowCaseIfNotJSCell(proto); // Check that prototype is an object loadPtr(Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), regT3); addSlowCase(branch8(NotEqual, Address(regT3, OBJECT_OFFSETOF(Structure, m_typeInfo.m_type)), Imm32(ObjectType))); - + + // Fixme: this check is only needed because the JSC API allows HasInstance to be overridden; we should deprecate this. // Check that baseVal 'ImplementsDefaultHasInstance'. loadPtr(Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), regT0); addSlowCase(branchTest8(Zero, Address(regT0, OBJECT_OFFSETOF(Structure, m_typeInfo.m_flags)), Imm32(ImplementsDefaultHasInstance))); @@ -559,6 +573,18 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction) emitStoreBool(dst, regT0); } +void JIT::emitSlow_op_check_has_instance(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) +{ + unsigned baseVal = currentInstruction[1].u.operand; + + linkSlowCaseIfNotJSCell(iter, baseVal); + linkSlowCase(iter); + + JITStubCall stubCall(this, cti_op_check_has_instance); + stubCall.addArgument(baseVal); + stubCall.call(); +} + void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) { unsigned dst = currentInstruction[1].u.operand; @@ -567,7 +593,6 @@ void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCas unsigned proto = currentInstruction[4].u.operand; linkSlowCaseIfNotJSCell(iter, value); - linkSlowCaseIfNotJSCell(iter, baseVal); linkSlowCaseIfNotJSCell(iter, proto); linkSlowCase(iter); linkSlowCase(iter); @@ -1462,17 +1487,22 @@ void JIT::emit_op_switch_string(Instruction* currentInstruction) jump(regT0); } -void JIT::emit_op_new_error(Instruction* currentInstruction) +void JIT::emit_op_throw_reference_error(Instruction* currentInstruction) { - unsigned dst = currentInstruction[1].u.operand; - unsigned type = currentInstruction[2].u.operand; - unsigned message = currentInstruction[3].u.operand; + unsigned message = currentInstruction[1].u.operand; - JITStubCall stubCall(this, cti_op_new_error); - stubCall.addArgument(Imm32(type)); + JITStubCall stubCall(this, cti_op_throw_reference_error); stubCall.addArgument(m_codeBlock->getConstant(message)); - stubCall.addArgument(Imm32(m_bytecodeOffset)); - stubCall.call(dst); + stubCall.call(); +} + +void JIT::emit_op_throw_syntax_error(Instruction* currentInstruction) +{ + unsigned message = currentInstruction[1].u.operand; + + JITStubCall stubCall(this, cti_op_throw_syntax_error); + stubCall.addArgument(m_codeBlock->getConstant(message)); + stubCall.call(); } void JIT::emit_op_debug(Instruction* currentInstruction) |
