Commit 1271fa3a authored by fpizlo@apple.com's avatar fpizlo@apple.com

jneq_ptr shouldn't have a pointer

https://bugs.webkit.org/show_bug.cgi?id=97739

Reviewed by Oliver Hunt.

Slamming pointers directly into bytecode is sometimes cool, but in this case it's
unwieldy and confusing. Switched the instruction to use an enum instead. This has
zero effect on code gen behavior in the JITs. In the LLInt, there is now more
indirection, but that doesn't affect benchmarks.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/Instruction.h:
(JSC::Instruction::Instruction):
(Instruction):
* bytecode/SpecialPointer.cpp: Added.
(JSC):
(JSC::actualPointerFor):
* bytecode/SpecialPointer.h: Added.
(JSC):
(JSC::pointerIsFunction):
(JSC::pointerIsCell):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
(JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC):
* runtime/JSGlobalObject.h:
(JSGlobalObject):
(JSC::JSGlobalObject::actualPointerFor):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129713 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1e61b896
......@@ -57,6 +57,7 @@ SET(JavaScriptCore_SOURCES
bytecode/PutByIdStatus.cpp
bytecode/ResolveGlobalStatus.cpp
bytecode/SamplingTool.cpp
bytecode/SpecialPointer.cpp
bytecode/StructureStubClearingWatchpoint.cpp
bytecode/StructureStubInfo.cpp
bytecode/Watchpoint.cpp
......
2012-09-26 Filip Pizlo <fpizlo@apple.com>
jneq_ptr shouldn't have a pointer
https://bugs.webkit.org/show_bug.cgi?id=97739
Reviewed by Oliver Hunt.
Slamming pointers directly into bytecode is sometimes cool, but in this case it's
unwieldy and confusing. Switched the instruction to use an enum instead. This has
zero effect on code gen behavior in the JITs. In the LLInt, there is now more
indirection, but that doesn't affect benchmarks.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* bytecode/Instruction.h:
(JSC::Instruction::Instruction):
(Instruction):
* bytecode/SpecialPointer.cpp: Added.
(JSC):
(JSC::actualPointerFor):
* bytecode/SpecialPointer.h: Added.
(JSC):
(JSC::pointerIsFunction):
(JSC::pointerIsCell):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
(JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseBlock):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::reset):
(JSC):
* runtime/JSGlobalObject.h:
(JSGlobalObject):
(JSC::JSGlobalObject::actualPointerFor):
2012-09-26 Gavin Barraclough <barraclough@apple.com>
REGRESSION (r129456): http/tests/security/xss-eval.html is failing on JSC platforms
......
......@@ -133,6 +133,8 @@ javascriptcore_sources += \
Source/JavaScriptCore/bytecode/ResolveGlobalStatus.h \
Source/JavaScriptCore/bytecode/SamplingTool.cpp \
Source/JavaScriptCore/bytecode/SamplingTool.h \
Source/JavaScriptCore/bytecode/SpecialPointer.cpp \
Source/JavaScriptCore/bytecode/SpecialPointer.h \
Source/JavaScriptCore/bytecode/StructureSet.h \
Source/JavaScriptCore/bytecode/StructureStubInfo.cpp \
Source/JavaScriptCore/bytecode/StructureStubInfo.h \
......
......@@ -1697,6 +1697,14 @@
RelativePath="..\..\bytecode\PolymorphicPutByIdList.cpp"
>
</File>
<File
RelativePath="..\..\bytecode\SpecialPointer.cpp"
>
</File>
<File
RelativePath="..\..\bytecode\SpecialPointer.h"
>
</File>
<File
RelativePath="..\..\bytecode\SpeculatedType.cpp"
>
......
......@@ -127,6 +127,8 @@
0F4680D314BBD16700BFE272 /* LLIntData.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4680CF14BBB3D100BFE272 /* LLIntData.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F4680D414BBD24900BFE272 /* HostCallReturnValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4680D014BBC5F800BFE272 /* HostCallReturnValue.cpp */; };
0F4680D514BBD24B00BFE272 /* HostCallReturnValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F4680D114BBC5F800BFE272 /* HostCallReturnValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F5541B11613C1FB00CE3E25 /* SpecialPointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */; };
0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F55F0F114D1063600AC7649 /* AbstractPC.cpp */; };
0F55F0F514D1063C00AC7649 /* AbstractPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F55F0F214D1063600AC7649 /* AbstractPC.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F56A1D315000F35002992B1 /* ExecutionCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F56A1D115000F31002992B1 /* ExecutionCounter.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -898,6 +900,8 @@
0F4680CF14BBB3D100BFE272 /* LLIntData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntData.h; path = llint/LLIntData.h; sourceTree = "<group>"; };
0F4680D014BBC5F800BFE272 /* HostCallReturnValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HostCallReturnValue.cpp; sourceTree = "<group>"; };
0F4680D114BBC5F800BFE272 /* HostCallReturnValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostCallReturnValue.h; sourceTree = "<group>"; };
0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialPointer.cpp; sourceTree = "<group>"; };
0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialPointer.h; sourceTree = "<group>"; };
0F55F0F114D1063600AC7649 /* AbstractPC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractPC.cpp; sourceTree = "<group>"; };
0F55F0F214D1063600AC7649 /* AbstractPC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractPC.h; sourceTree = "<group>"; };
0F56A1D115000F31002992B1 /* ExecutionCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutionCounter.h; sourceTree = "<group>"; };
......@@ -2472,56 +2476,58 @@
children = (
0F63945115D07051006A597C /* ArrayProfile.cpp */,
0F63945215D07051006A597C /* ArrayProfile.h */,
0F56A1D415001CF2002992B1 /* ExecutionCounter.cpp */,
0F56A1D115000F31002992B1 /* ExecutionCounter.h */,
0FB5467C14F5CFD3002C2989 /* MethodOfGettingAValueProfile.cpp */,
0FB5467A14F5C7D4002C2989 /* MethodOfGettingAValueProfile.h */,
0FB5467814F5C468002C2989 /* LazyOperandValueProfile.cpp */,
0FB5467614F59AD1002C2989 /* LazyOperandValueProfile.h */,
0F21C27E14BEAA8000ADC64B /* BytecodeConventions.h */,
0F0FC45814BD15F100B81154 /* LLIntCallLinkInfo.h */,
0F2BDC2B151FDE8B00CD8910 /* Operands.h */,
0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */,
0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */,
0F9FC8C114E1B5FB00D52AE0 /* PutKind.h */,
0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */,
0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */,
0F93329314CA7DC10085F3C6 /* CallLinkStatus.cpp */,
0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */,
0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */,
0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */,
0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */,
0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */,
0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */,
0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */,
0FF4276E159275D2004CB9FF /* ResolveGlobalStatus.cpp */,
0FF4276F159275D2004CB9FF /* ResolveGlobalStatus.h */,
0F93329B14CA7DC10085F3C6 /* StructureSet.h */,
0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */,
0F0B83B614BCF8DF00885B4F /* GlobalResolveInfo.h */,
0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */,
0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */,
0F0B83AE14BCF71400885B4F /* CallLinkInfo.cpp */,
0F0B83AF14BCF71400885B4F /* CallLinkInfo.h */,
FEB63AA2159B9DA3008932A6 /* Comment.h */,
0F0B83AC14BCF60200885B4F /* LineInfo.h */,
0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */,
0F0B83A814BCF55E00885B4F /* HandlerInfo.h */,
0F0B83A514BCF50400885B4F /* CodeType.h */,
969A07900ED1D3AE00F1F681 /* CodeBlock.cpp */,
969A07910ED1D3AE00F1F681 /* CodeBlock.h */,
0FBD7E671447998F00481315 /* CodeOrigin.h */,
0F0B83A514BCF50400885B4F /* CodeType.h */,
FEB63AA2159B9DA3008932A6 /* Comment.h */,
0F426A4A1460CD6B00131F8F /* DataFormat.h */,
0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */,
0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */,
969A07920ED1D3AE00F1F681 /* EvalCodeCache.h */,
0F56A1D415001CF2002992B1 /* ExecutionCounter.cpp */,
0F56A1D115000F31002992B1 /* ExecutionCounter.h */,
0F0B83AA14BCF5B900885B4F /* ExpressionRangeInfo.h */,
0F93329514CA7DC10085F3C6 /* GetByIdStatus.cpp */,
0F93329614CA7DC10085F3C6 /* GetByIdStatus.h */,
0F0B83B614BCF8DF00885B4F /* GlobalResolveInfo.h */,
0F0B83A814BCF55E00885B4F /* HandlerInfo.h */,
969A07930ED1D3AE00F1F681 /* Instruction.h */,
BCFD8C900EEB2EE700283848 /* JumpTable.cpp */,
BCFD8C910EEB2EE700283848 /* JumpTable.h */,
0FB5467814F5C468002C2989 /* LazyOperandValueProfile.cpp */,
0FB5467614F59AD1002C2989 /* LazyOperandValueProfile.h */,
0F0B83AC14BCF60200885B4F /* LineInfo.h */,
0F0FC45814BD15F100B81154 /* LLIntCallLinkInfo.h */,
0F0B83B214BCF85E00885B4F /* MethodCallLinkInfo.cpp */,
0F0B83B314BCF85E00885B4F /* MethodCallLinkInfo.h */,
0F93329714CA7DC10085F3C6 /* MethodCallLinkStatus.cpp */,
0F93329814CA7DC10085F3C6 /* MethodCallLinkStatus.h */,
0FB5467C14F5CFD3002C2989 /* MethodOfGettingAValueProfile.cpp */,
0FB5467A14F5C7D4002C2989 /* MethodOfGettingAValueProfile.h */,
969A07940ED1D3AE00F1F681 /* Opcode.cpp */,
969A07950ED1D3AE00F1F681 /* Opcode.h */,
0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */,
0FD82E4F141DAEA100179C94 /* SpeculatedType.h */,
0F2BDC2B151FDE8B00CD8910 /* Operands.h */,
0F9FC8BF14E1B5FB00D52AE0 /* PolymorphicPutByIdList.cpp */,
0F9FC8C014E1B5FB00D52AE0 /* PolymorphicPutByIdList.h */,
0F93329914CA7DC10085F3C6 /* PutByIdStatus.cpp */,
0F93329A14CA7DC10085F3C6 /* PutByIdStatus.h */,
0F9FC8C114E1B5FB00D52AE0 /* PutKind.h */,
0FF4276E159275D2004CB9FF /* ResolveGlobalStatus.cpp */,
0FF4276F159275D2004CB9FF /* ResolveGlobalStatus.h */,
1429D8830ED21C3D00B89619 /* SamplingTool.cpp */,
1429D8840ED21C3D00B89619 /* SamplingTool.h */,
0F5541AF1613C1FB00CE3E25 /* SpecialPointer.cpp */,
0F5541B01613C1FB00CE3E25 /* SpecialPointer.h */,
0FD82E84141F3FDA00179C94 /* SpeculatedType.cpp */,
0FD82E4F141DAEA100179C94 /* SpeculatedType.h */,
0F93329B14CA7DC10085F3C6 /* StructureSet.h */,
0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */,
0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */,
BCCF0D0B0EF0B8A500413C8F /* StructureStubInfo.cpp */,
......@@ -2950,6 +2956,7 @@
0FB7F39E15ED8E4600F167B2 /* SparseArrayValueMap.h in Headers */,
0F0CD4C215F1A6070032F1C0 /* PutDirectIndexMode.h in Headers */,
862553D216136E1A009F17D0 /* JSProxy.h in Headers */,
0F5541B21613C1FB00CE3E25 /* SpecialPointer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -3554,6 +3561,7 @@
FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */,
C225494315F7DBAA0065E898 /* SlotVisitor.cpp in Sources */,
862553D116136DA9009F17D0 /* JSProxy.cpp in Sources */,
0F5541B11613C1FB00CE3E25 /* SpecialPointer.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -64,6 +64,7 @@ SOURCES += \
bytecode/PutByIdStatus.cpp \
bytecode/ResolveGlobalStatus.cpp \
bytecode/SamplingTool.cpp \
bytecode/SpecialPointer.cpp \
bytecode/SpeculatedType.cpp \
bytecode/StructureStubClearingWatchpoint.cpp \
bytecode/StructureStubInfo.cpp \
......
......@@ -33,6 +33,7 @@
#include "MacroAssembler.h"
#include "Opcode.h"
#include "PropertySlot.h"
#include "SpecialPointer.h"
#include "Structure.h"
#include "StructureChain.h"
#include <wtf/VectorTraits.h>
......@@ -195,6 +196,8 @@ namespace JSC {
Instruction(WriteBarrier<Unknown>* registerPointer) { u.registerPointer = registerPointer; }
Instruction(Special::Pointer pointer) { u.specialPointer = pointer; }
Instruction(bool* predicatePointer) { u.predicatePointer = predicatePointer; }
union {
......@@ -204,6 +207,7 @@ namespace JSC {
WriteBarrierBase<StructureChain> structureChain;
WriteBarrierBase<JSCell> jsCell;
WriteBarrier<Unknown>* registerPointer;
Special::Pointer specialPointer;
PropertySlot::GetValueFunc getterFunc;
LLIntCallLinkInfo* callLinkInfo;
ValueProfile* profile;
......
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "SpecialPointer.h"
#include "CodeBlock.h"
#include "JSGlobalObject.h"
namespace JSC {
void* actualPointerFor(JSGlobalObject* globalObject, Special::Pointer pointer)
{
return globalObject->actualPointerFor(pointer);
}
void* actualPointerFor(CodeBlock* codeBlock, Special::Pointer pointer)
{
return actualPointerFor(codeBlock->globalObject(), pointer);
}
} // namespace JSC
/*
* Copyright (C) 2012 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SpecialPointer_h
#define SpecialPointer_h
namespace JSC {
class CodeBlock;
class JSGlobalObject;
namespace Special {
enum Pointer {
CallFunction,
ApplyFunction,
TableSize // Not a real special pointer. Use this to determine the number of pointers.
};
} // namespace Special
inline bool pointerIsFunction(Special::Pointer pointer)
{
ASSERT_UNUSED(pointer, pointer < Special::TableSize);
return true;
}
inline bool pointerIsCell(Special::Pointer pointer)
{
ASSERT_UNUSED(pointer, pointer < Special::TableSize);
return true;
}
void* actualPointerFor(JSGlobalObject*, Special::Pointer);
void* actualPointerFor(CodeBlock*, Special::Pointer);
} // namespace JSC
#endif // SpecialPointer_h
......@@ -1129,7 +1129,7 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionCall(RegisterID* cond,
emitOpcode(op_jneq_ptr);
instructions().append(cond->index());
instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scope->globalObject()->callFunction()));
instructions().append(Special::CallFunction);
instructions().append(target->bind(begin, instructions().size()));
return target;
}
......@@ -1140,7 +1140,7 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond
emitOpcode(op_jneq_ptr);
instructions().append(cond->index());
instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scope->globalObject()->applyFunction()));
instructions().append(Special::ApplyFunction);
instructions().append(target->bind(begin, instructions().size()));
return target;
}
......
......@@ -2775,8 +2775,10 @@ bool ByteCodeParser::parseBlock(unsigned limit)
// Statically speculate for now. It makes sense to let speculate-only jneq_ptr
// support simmer for a while before making it more general, since it's
// already gnarly enough as it is.
ASSERT(pointerIsFunction(currentInstruction[2].u.specialPointer));
addToGraph(
CheckFunction, OpInfo(currentInstruction[2].u.jsCell.get()),
CheckFunction,
OpInfo(actualPointerFor(m_inlineStackTop->m_codeBlock, currentInstruction[2].u.specialPointer)),
get(currentInstruction[1].u.operand));
addToGraph(Jump, OpInfo(m_currentIndex + OPCODE_LENGTH(op_jneq_ptr)));
LAST_OPCODE(op_jneq_ptr);
......
......@@ -798,11 +798,11 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction)
void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
{
unsigned src = currentInstruction[1].u.operand;
JSCell* ptr = currentInstruction[2].u.jsCell.get();
Special::Pointer ptr = currentInstruction[2].u.specialPointer;
unsigned target = currentInstruction[3].u.operand;
emitGetVirtualRegister(src, regT0);
addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(JSValue(ptr)))), target);
addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(actualPointerFor(m_codeBlock, ptr))), target);
}
void JIT::emit_op_eq(Instruction* currentInstruction)
......
......@@ -975,12 +975,12 @@ void JIT::emit_op_jneq_null(Instruction* currentInstruction)
void JIT::emit_op_jneq_ptr(Instruction* currentInstruction)
{
unsigned src = currentInstruction[1].u.operand;
JSCell* ptr = currentInstruction[2].u.jsCell.get();
Special::Pointer ptr = currentInstruction[2].u.specialPointer;
unsigned target = currentInstruction[3].u.operand;
emitLoad(src, regT1, regT0);
addJump(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)), target);
addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(ptr)), target);
addJump(branchPtr(NotEqual, regT0, TrustedImmPtr(actualPointerFor(m_codeBlock, ptr))), target);
}
void JIT::emit_op_eq(Instruction* currentInstruction)
......
......@@ -1485,7 +1485,10 @@ _llint_op_jneq_ptr:
traceExecution()
loadi 4[PC], t0
loadi 8[PC], t1
loadp CodeBLock[cfr], t2
loadp CodeBlock::m_globalObject[t2], t2
bineq TagOffset[cfr, t0, 8], CellTag, .opJneqPtrBranch
loadp JSGlobalObject::m_specialPointers[t2, t1, 8], t1
bpeq PayloadOffset[cfr, t0, 8], t1, .opJneqPtrFallThrough
.opJneqPtrBranch:
dispatchBranch(12[PC])
......
......@@ -1328,7 +1328,10 @@ _llint_op_jneq_null:
_llint_op_jneq_ptr:
traceExecution()
loadis 8[PB, PC, 8], t0
loadp 16[PB, PC, 8], t1
loadi 16[PB, PC, 8], t1
loadp CodeBlock[cfr], t2
loadp CodeBlock::m_globalObject[t2], t2
loadp JSGlobalObject::m_specialPointers[t2, t1, 8], t1
bpneq t1, [cfr, t0, 8], .opJneqPtrTarget
dispatch(4)
......
......@@ -318,6 +318,9 @@ void JSGlobalObject::reset(JSValue prototype)
GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete | ReadOnly)
};
addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
m_specialPointers[Special::CallFunction] = m_callFunction.get();
m_specialPointers[Special::ApplyFunction] = m_applyFunction.get();
if (m_experimentsEnabled) {
NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(exec->globalData(), this, m_objectPrototype.get()));
......
......@@ -27,6 +27,7 @@
#include "JSSegmentedVariableObject.h"
#include "JSWeakObjectMapRefInternal.h"
#include "NumberPrototype.h"
#include "SpecialPointer.h"
#include "StringPrototype.h"
#include "StructureChain.h"
#include "Watchpoint.h"
......@@ -145,6 +146,8 @@ namespace JSC {
WriteBarrier<Structure> m_regExpStructure;
WriteBarrier<Structure> m_stringObjectStructure;
WriteBarrier<Structure> m_internalFunctionStructure;
void* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT.
Debugger* m_debugger;
......@@ -281,6 +284,12 @@ namespace JSC {
Structure* regExpStructure() const { return m_regExpStructure.get(); }
Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); }
void* actualPointerFor(Special::Pointer pointer)
{
ASSERT(pointer < Special::TableSize);
return m_specialPointers[pointer];
}
WatchpointSet* masqueradesAsUndefinedWatchpoint() { return m_masqueradesAsUndefinedWatchpoint.get(); }
WatchpointSet* havingABadTimeWatchpoint() { return m_havingABadTimeWatchpoint.get(); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment