Skip to content

Commit

Permalink
Rollout r82500
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@82519 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
oliver@apple.com committed Mar 30, 2011
1 parent c4695b2 commit 9d5d1b0
Show file tree
Hide file tree
Showing 24 changed files with 110 additions and 123 deletions.
59 changes: 59 additions & 0 deletions Source/JavaScriptCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
2011-03-30 Oliver Hunt <oliver@apple.com>

Rollout r82500

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dump):
(JSC::CodeBlock::derefStructures):
(JSC::CodeBlock::refStructures):
(JSC::CodeBlock::markAggregate):
* bytecode/Instruction.h:
(JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set):
(JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList):
(JSC::PolymorphicAccessStructureList::derefStructures):
(JSC::Instruction::Instruction):
* bytecode/StructureStubInfo.cpp:
(JSC::StructureStubInfo::deref):
* bytecode/StructureStubInfo.h:
(JSC::StructureStubInfo::initGetByIdChain):
(JSC::StructureStubInfo::initPutByIdTransition):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitJumpIfNotFunctionCall):
(JSC::BytecodeGenerator::emitJumpIfNotFunctionApply):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::privateExecute):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_jneq_ptr):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::privateCompileGetByIdChainList):
* jit/JITPropertyAccess32_64.cpp:
(JSC::JIT::privateCompileGetByIdChainList):
* jit/JITStubs.cpp:
(JSC::getPolymorphicAccessStructureListSlot):
(JSC::DEFINE_STUB_FUNCTION):
* runtime/JSCell.h:
* runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
* runtime/JSGlobalData.h:
* runtime/JSGlobalObject.cpp:
(JSC::markIfNeeded):
* runtime/JSGlobalObject.h:
(JSC::Structure::prototypeChain):
* runtime/JSObject.h:
(JSC::JSObject::markChildrenDirect):
* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::create):
(JSC::JSPropertyNameIterator::get):
(JSC::JSPropertyNameIterator::markChildren):
* runtime/JSPropertyNameIterator.h:
(JSC::JSPropertyNameIterator::setCachedPrototypeChain):
* runtime/MarkStack.h:
(JSC::MarkStack::append):
* runtime/Structure.h:
* runtime/StructureChain.cpp:
(JSC::StructureChain::StructureChain):
* runtime/StructureChain.h:
(JSC::StructureChain::create):

2011-03-29 Matthew Delaney <mdelaney@apple.com>

Reviewed by Simon Fraser.
Expand Down
20 changes: 5 additions & 15 deletions Source/JavaScriptCore/bytecode/CodeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
case op_resolve_global_dynamic: {
int r0 = (++it)->u.operand;
int id0 = (++it)->u.operand;
JSValue scope = JSValue((++it)->u.jsCell.get());
JSValue scope = JSValue((++it)->u.jsCell);
++it;
int depth = (++it)->u.operand;
printf("[%4d] resolve_global_dynamic\t %s, %s, %s, %d\n", location, registerName(exec, r0).data(), valueToSourceString(exec, scope).utf8().data(), idName(id0, m_identifiers[id0]).data(), depth);
Expand Down Expand Up @@ -1437,11 +1437,13 @@ void CodeBlock::derefStructures(Instruction* vPC) const
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) {
vPC[4].u.structure->deref();
vPC[5].u.structureChain->deref();
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
vPC[4].u.structure->deref();
vPC[5].u.structure->deref();
vPC[6].u.structureChain->deref();
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
Expand Down Expand Up @@ -1484,11 +1486,13 @@ void CodeBlock::refStructures(Instruction* vPC) const
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain)) {
vPC[4].u.structure->ref();
vPC[5].u.structureChain->ref();
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
vPC[4].u.structure->ref();
vPC[5].u.structure->ref();
vPC[6].u.structureChain->ref();
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_replace)) {
Expand Down Expand Up @@ -1523,20 +1527,6 @@ void CodeBlock::markAggregate(MarkStack& markStack)
if (callLinkInfo(i).isLinked())
markStack.append(&callLinkInfo(i).callee);
#endif
#if ENABLE(INTERPRETER)
Interpreter* interpreter = m_globalData->interpreter;
for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) {
Instruction* vPC = &m_instructions[m_propertyAccessInstructions[i]];
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_getter_chain) || vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_custom_chain))
markStack.append(&vPC[5].u.structureChain);
else if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition))
markStack.append(&vPC[6].u.structureChain);
}
#endif
#if ENABLE(JIT)
for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i)
m_structureStubInfos[i].markAggregate(markStack);
#endif
}

HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset)
Expand Down
45 changes: 14 additions & 31 deletions Source/JavaScriptCore/bytecode/Instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace JSC {
Structure* base;
union {
Structure* proto;
WriteBarrierBase<StructureChain> chain;
StructureChain* chain;
} u;

void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base)
Expand All @@ -82,11 +82,11 @@ namespace JSC {
isChain = false;
}

void set(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
void set(PolymorphicAccessStructureListStubRoutineType _stubRoutine, Structure* _base, StructureChain* _chain)
{
stubRoutine = _stubRoutine;
base = _base;
u.chain.set(globalData, owner, _chain);
u.chain = _chain;
isChain = true;
}
} list[POLYMORPHIC_LIST_CACHE_SIZE];
Expand All @@ -101,9 +101,9 @@ namespace JSC {
list[0].set(stubRoutine, firstBase, firstProto);
}

PolymorphicAccessStructureList(JSGlobalData& globalData, JSCell* owner, PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
PolymorphicAccessStructureList(PolymorphicAccessStructureListStubRoutineType stubRoutine, Structure* firstBase, StructureChain* firstChain)
{
list[0].set(globalData, owner, stubRoutine, firstBase, firstChain);
list[0].set(stubRoutine, firstBase, firstChain);
}

void derefStructures(int count)
Expand All @@ -115,22 +115,13 @@ namespace JSC {
info.base->deref();

if (info.u.proto) {
if (!info.isChain)
if (info.isChain)
info.u.chain->deref();
else
info.u.proto->deref();
}
}
}

void markAggregate(MarkStack& markStack, int count)
{
for (int i = 0; i < count; ++i) {
PolymorphicStubInfo& info = list[i];
ASSERT(info.base);

if (info.u.proto && info.isChain)
markStack.append(&info.u.chain);
}
}
};

struct Instruction {
Expand All @@ -139,7 +130,7 @@ namespace JSC {
#if !ENABLE(COMPUTED_GOTO_INTERPRETER)
// We have to initialize one of the pointer members to ensure that
// the entire struct is initialized, when opcode is not a pointer.
u.jsCell.clear();
u.jsCell = 0;
#endif
u.opcode = opcode;
}
Expand All @@ -148,30 +139,22 @@ namespace JSC {
{
// We have to initialize one of the pointer members to ensure that
// the entire struct is initialized in 64-bit.
u.jsCell.clear();
u.jsCell = 0;
u.operand = operand;
}

Instruction(Structure* structure) { u.structure = structure; }
Instruction(JSGlobalData& globalData, JSCell* owner, StructureChain* structureChain)
{
u.structureChain.clear();
u.structureChain.set(globalData, owner, structureChain);
}
Instruction(JSGlobalData& globalData, JSCell* owner, JSCell* jsCell)
{
u.jsCell.clear();
u.jsCell.set(globalData, owner, jsCell);
}
Instruction(StructureChain* structureChain) { u.structureChain = structureChain; }
Instruction(JSCell* jsCell) { u.jsCell = jsCell; }
Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; }
Instruction(PropertySlot::GetValueFunc getterFunc) { u.getterFunc = getterFunc; }

union {
Opcode opcode;
int operand;
Structure* structure;
WriteBarrierBase<StructureChain> structureChain;
WriteBarrierBase<JSCell> jsCell;
StructureChain* structureChain;
JSCell* jsCell;
PolymorphicAccessStructureList* polymorphicStructures;
PropertySlot::GetValueFunc getterFunc;
} u;
Expand Down
38 changes: 2 additions & 36 deletions Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void StructureStubInfo::deref()
return;
case access_get_by_id_chain:
u.getByIdChain.baseObjectStructure->deref();
u.getByIdChain.chain->deref();
return;
case access_get_by_id_self_list: {
PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
Expand All @@ -60,6 +61,7 @@ void StructureStubInfo::deref()
case access_put_by_id_transition:
u.putByIdTransition.previousStructure->deref();
u.putByIdTransition.structure->deref();
u.putByIdTransition.chain->deref();
return;
case access_put_by_id_replace:
u.putByIdReplace.baseObjectStructure->deref();
Expand All @@ -76,42 +78,6 @@ void StructureStubInfo::deref()
ASSERT_NOT_REACHED();
}
}

void StructureStubInfo::markAggregate(MarkStack& markStack)
{
switch (accessType) {
case access_get_by_id_self:
return;
case access_get_by_id_proto:
return;
case access_get_by_id_chain:
return;
case access_get_by_id_self_list: {
PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
polymorphicStructures->markAggregate(markStack, u.getByIdSelfList.listSize);
return;
}
case access_get_by_id_proto_list: {
PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
polymorphicStructures->markAggregate(markStack, u.getByIdProtoList.listSize);
return;
}
case access_put_by_id_transition:
return;
case access_put_by_id_replace:
return;
case access_get_by_id:
case access_put_by_id:
case access_get_by_id_generic:
case access_put_by_id_generic:
case access_get_array_length:
case access_get_string_length:
// These instructions don't ref their Structures.
return;
default:
ASSERT_NOT_REACHED();
}
}
#endif

} // namespace JSC
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/bytecode/StructureStubInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ namespace JSC {
baseObjectStructure->ref();

u.getByIdChain.chain = chain;
chain->ref();
}

void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize)
Expand Down Expand Up @@ -116,6 +117,7 @@ namespace JSC {
structure->ref();

u.putByIdTransition.chain = chain;
chain->ref();
}

void initPutByIdReplace(Structure* baseObjectStructure)
Expand All @@ -127,7 +129,6 @@ namespace JSC {
}

void deref();
void markAggregate(MarkStack&);

bool seenOnce()
{
Expand Down
4 changes: 2 additions & 2 deletions Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionCall(RegisterID* cond,

emitOpcode(op_jneq_ptr);
instructions().append(cond->index());
instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->callFunction()));
instructions().append(m_scopeChain->globalObject->callFunction());
instructions().append(target->bind(begin, instructions().size()));
return target;
}
Expand All @@ -936,7 +936,7 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond

emitOpcode(op_jneq_ptr);
instructions().append(cond->index());
instructions().append(Instruction(*m_globalData, m_codeBlock->ownerExecutable(), m_scopeChain->globalObject->applyFunction()));
instructions().append(m_scopeChain->globalObject->applyFunction());
instructions().append(target->bind(begin, instructions().size()));
return target;
}
Expand Down
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3537,9 +3537,10 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi
to ptr, using pointer equality.
*/
int src = vPC[1].u.operand;
JSValue ptr = JSValue(vPC[2].u.jsCell);
int target = vPC[3].u.operand;
JSValue srcValue = callFrame->r(src).jsValue();
if (srcValue != vPC[2].u.jsCell.get()) {
if (srcValue != ptr) {
vPC += target;
NEXT_INSTRUCTION();
}
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/jit/JITOpcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ 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();
JSCell* ptr = currentInstruction[2].u.jsCell;
unsigned target = currentInstruction[3].u.operand;

emitGetVirtualRegister(src, regT0);
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ 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();
JSCell* ptr = currentInstruction[2].u.jsCell;
unsigned target = currentInstruction[3].u.operand;

emitLoad(src, regT1, regT0);
Expand Down
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi

// Track the stub we have created so that it will be deleted later.
structure->ref();
prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain);
chain->ref();
prototypeStructures->list[currentIndex].set(entryLabel, structure, chain);

// Finally patch the jump to slow case back in the hot path to jump here instead.
CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
Expand Down
3 changes: 2 additions & 1 deletion Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,8 @@ void JIT::privateCompileGetByIdChainList(StructureStubInfo* stubInfo, Polymorphi

// Track the stub we have created so that it will be deleted later.
structure->ref();
prototypeStructures->list[currentIndex].set(callFrame->globalData(), m_codeBlock->ownerExecutable(), entryLabel, structure, chain);
chain->ref();
prototypeStructures->list[currentIndex].set(entryLabel, structure, chain);

// Finally patch the jump to slow case back in the hot path to jump here instead.
CodeLocationJump jumpLocation = stubInfo->hotPathBegin.jumpAtOffset(patchOffsetGetByIdBranchToSlowCase);
Expand Down
Loading

0 comments on commit 9d5d1b0

Please sign in to comment.