diff options
author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /JavaScriptCore/bytecode | |
parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'JavaScriptCore/bytecode')
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.cpp | 10 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/CodeBlock.h | 20 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/Opcode.h | 19 | ||||
-rw-r--r-- | JavaScriptCore/bytecode/StructureStubInfo.h | 24 |
4 files changed, 49 insertions, 24 deletions
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp index 0e55d6a..9a8c332 100644 --- a/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1344,8 +1344,9 @@ void CodeBlock::dumpStatistics() #endif } -CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab, bool isConstructor) - : m_numCalleeRegisters(0) +CodeBlock::CodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject *globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, SymbolTable* symTab, bool isConstructor) + : m_globalObject(globalObject) + , m_numCalleeRegisters(0) , m_numVars(0) , m_numParameters(0) , m_isConstructor(isConstructor) @@ -1457,8 +1458,8 @@ void CodeBlock::derefStructures(Instruction* vPC) const return; } if (vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global) || vPC[0].u.opcode == interpreter->getOpcode(op_resolve_global_dynamic)) { - if(vPC[4].u.structure) - vPC[4].u.structure->deref(); + if (vPC[3].u.structure) + vPC[3].u.structure->deref(); return; } if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) @@ -1518,6 +1519,7 @@ void CodeBlock::markAggregate(MarkStack& markStack) m_functionExprs[i]->markAggregate(markStack); for (size_t i = 0; i < m_functionDecls.size(); ++i) m_functionDecls[i]->markAggregate(markStack); + markStack.append(m_globalObject); } bool CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame) diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h index 2f22dd0..be12254 100644 --- a/JavaScriptCore/bytecode/CodeBlock.h +++ b/JavaScriptCore/bytecode/CodeBlock.h @@ -275,7 +275,10 @@ namespace JSC { class CodeBlock : public FastAllocBase { friend class JIT; protected: - CodeBlock(ScriptExecutable* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor); + CodeBlock(ScriptExecutable* ownerExecutable, CodeType, JSGlobalObject*, PassRefPtr<SourceProvider>, unsigned sourceOffset, SymbolTable* symbolTable, bool isConstructor); + + JSGlobalObject* m_globalObject; + public: virtual ~CodeBlock(); @@ -483,6 +486,7 @@ namespace JSC { unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; } RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } + JSGlobalObject* globalObject() { return m_globalObject; } // Jump Tables @@ -602,9 +606,8 @@ namespace JSC { class GlobalCodeBlock : public CodeBlock { public: - GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject) - : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false) - , m_globalObject(globalObject) + GlobalCodeBlock(ScriptExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) + : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, &m_unsharedSymbolTable, false) { m_globalObject->codeBlocks().add(this); } @@ -618,14 +621,13 @@ namespace JSC { void clearGlobalObject() { m_globalObject = 0; } private: - JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool. SymbolTable m_unsharedSymbolTable; }; class ProgramCodeBlock : public GlobalCodeBlock { public: ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider) - : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject) + : GlobalCodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, 0) { } }; @@ -633,7 +635,7 @@ namespace JSC { class EvalCodeBlock : public GlobalCodeBlock { public: EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth) - : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject) + : GlobalCodeBlock(ownerExecutable, EvalCode, globalObject, sourceProvider, 0) , m_baseScopeDepth(baseScopeDepth) { } @@ -659,8 +661,8 @@ namespace JSC { // as we need to initialise the CodeBlock before we could initialise any RefPtr to hold the shared // symbol table, so we just pass as a raw pointer with a ref count of 1. We then manually deref // in the destructor. - FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor) - : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor) + FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, bool isConstructor) + : CodeBlock(ownerExecutable, codeType, globalObject, sourceProvider, sourceOffset, SharedSymbolTable::create().releaseRef(), isConstructor) { } ~FunctionCodeBlock() diff --git a/JavaScriptCore/bytecode/Opcode.h b/JavaScriptCore/bytecode/Opcode.h index ca5feeb..4563ebe 100644 --- a/JavaScriptCore/bytecode/Opcode.h +++ b/JavaScriptCore/bytecode/Opcode.h @@ -93,12 +93,12 @@ namespace JSC { \ macro(op_resolve, 3) \ macro(op_resolve_skip, 4) \ - macro(op_resolve_global, 6) \ - macro(op_resolve_global_dynamic, 7) \ + macro(op_resolve_global, 5) \ + macro(op_resolve_global_dynamic, 6) \ macro(op_get_scoped_var, 4) \ macro(op_put_scoped_var, 4) \ - macro(op_get_global_var, 4) \ - macro(op_put_global_var, 4) \ + macro(op_get_global_var, 3) \ + macro(op_put_global_var, 3) \ macro(op_resolve_base, 3) \ macro(op_resolve_with_base, 4) \ macro(op_get_by_id, 8) \ @@ -254,6 +254,17 @@ namespace JSC { #endif + inline size_t opcodeLength(OpcodeID opcode) + { + switch (opcode) { +#define OPCODE_ID_LENGTHS(id, length) case id: return OPCODE_LENGTH(id); + FOR_EACH_OPCODE_ID(OPCODE_ID_LENGTHS) +#undef OPCODE_ID_LENGTHS + } + ASSERT_NOT_REACHED(); + return 0; + } + } // namespace JSC #endif // Opcode_h diff --git a/JavaScriptCore/bytecode/StructureStubInfo.h b/JavaScriptCore/bytecode/StructureStubInfo.h index 8e2c489..8578171 100644 --- a/JavaScriptCore/bytecode/StructureStubInfo.h +++ b/JavaScriptCore/bytecode/StructureStubInfo.h @@ -66,7 +66,7 @@ namespace JSC { baseObjectStructure->ref(); } - void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure) + void initGetByIdProto(Structure* baseObjectStructure, Structure* prototypeStructure, CodeLocationLabel routine) { accessType = access_get_by_id_proto; @@ -75,9 +75,11 @@ namespace JSC { u.getByIdProto.prototypeStructure = prototypeStructure; prototypeStructure->ref(); + + stubRoutine = routine; } - void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain) + void initGetByIdChain(Structure* baseObjectStructure, StructureChain* chain, CodeLocationLabel routine) { accessType = access_get_by_id_chain; @@ -86,27 +88,33 @@ namespace JSC { u.getByIdChain.chain = chain; chain->ref(); + + stubRoutine = routine; } - void initGetByIdSelfList(PolymorphicAccessStructureList* structureList, int listSize) + void initGetByIdSelfList(PolymorphicAccessStructureList* structureList) { accessType = access_get_by_id_self_list; u.getByIdProtoList.structureList = structureList; - u.getByIdProtoList.listSize = listSize; + u.getByIdProtoList.listSize = 1; + + stubRoutine = CodeLocationLabel(); } - void initGetByIdProtoList(PolymorphicAccessStructureList* structureList, int listSize) + void initGetByIdProtoList(PolymorphicAccessStructureList* structureList) { accessType = access_get_by_id_proto_list; u.getByIdProtoList.structureList = structureList; - u.getByIdProtoList.listSize = listSize; + u.getByIdProtoList.listSize = 1; + + stubRoutine = CodeLocationLabel(); } // PutById* - void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain) + void initPutByIdTransition(Structure* previousStructure, Structure* structure, StructureChain* chain, CodeLocationLabel routine) { accessType = access_put_by_id_transition; @@ -118,6 +126,8 @@ namespace JSC { u.putByIdTransition.chain = chain; chain->ref(); + + stubRoutine = routine; } void initPutByIdReplace(Structure* baseObjectStructure) |