Changeset 59064 in webkit for trunk/JavaScriptCore
- Timestamp:
- May 9, 2010, 6:41:07 PM (15 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r59061 r59064 34 34 35 35 * JavaScriptCore.pri: 36 37 2010-05-09 Oliver Hunt <[email protected]> 38 39 Reviewed by Gavin Barraclough. 40 41 REGRESSION(r57955): RegExp literals should not actually be cached, so r57955 should be rolled out. 42 https://bugs.webkit.org/show_bug.cgi?id=38828 43 <rdar://problem/7961634> 44 45 Rollout r57955 46 47 * bytecode/CodeBlock.cpp: 48 (JSC::regexpToSourceString): 49 (JSC::regexpName): 50 (JSC::CodeBlock::dump): 51 (JSC::CodeBlock::shrinkToFit): 52 * bytecode/CodeBlock.h: 53 (JSC::CodeBlock::addRegExp): 54 (JSC::CodeBlock::regexp): 55 * bytecode/Opcode.h: 56 * bytecompiler/BytecodeGenerator.cpp: 57 (JSC::BytecodeGenerator::addRegExp): 58 (JSC::BytecodeGenerator::emitNewRegExp): 59 * bytecompiler/BytecodeGenerator.h: 60 * bytecompiler/NodesCodegen.cpp: 61 (JSC::RegExpNode::emitBytecode): 62 * interpreter/Interpreter.cpp: 63 (JSC::Interpreter::privateExecute): 64 * jit/JIT.cpp: 65 (JSC::JIT::privateCompileMainPass): 66 * jit/JIT.h: 67 * jit/JITOpcodes.cpp: 68 (JSC::JIT::emit_op_new_regexp): 69 * jit/JITStubs.cpp: 70 (JSC::DEFINE_STUB_FUNCTION): 71 * jit/JITStubs.h: 72 (JSC::): 36 73 37 74 2010-05-09 Oliver Hunt <[email protected]> -
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r58986 r59064 90 90 } 91 91 92 static UString regexpToSourceString(RegExp* regExp) 93 { 94 char postfix[5] = { '/', 0, 0, 0, 0 }; 95 int index = 1; 96 if (regExp->global()) 97 postfix[index++] = 'g'; 98 if (regExp->ignoreCase()) 99 postfix[index++] = 'i'; 100 if (regExp->multiline()) 101 postfix[index] = 'm'; 102 103 return makeString("/", regExp->pattern(), postfix); 104 } 105 106 static CString regexpName(int re, RegExp* regexp) 107 { 108 return makeString(regexpToSourceString(regexp), "(@re", UString::from(re), ")").UTF8String(); 109 } 110 92 111 static UString pointerToSourceString(void* p) 93 112 { … … 350 369 } 351 370 371 if (m_rareData && !m_rareData->m_regexps.isEmpty()) { 372 printf("\nm_regexps:\n"); 373 size_t i = 0; 374 do { 375 printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).ascii()); 376 ++i; 377 } while (i < m_rareData->m_regexps.size()); 378 } 379 352 380 #if ENABLE(JIT) 353 381 if (!m_globalResolveInfos.isEmpty() || !m_structureStubInfos.isEmpty()) … … 485 513 int argc = (++it)->u.operand; 486 514 printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(exec, dst).data(), registerName(exec, argv).data(), argc); 515 break; 516 } 517 case op_new_regexp: { 518 int r0 = (++it)->u.operand; 519 int re0 = (++it)->u.operand; 520 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(exec, r0).data(), regexpName(re0, regexp(re0)).data()); 487 521 break; 488 522 } … … 1696 1730 if (m_rareData) { 1697 1731 m_rareData->m_exceptionHandlers.shrinkToFit(); 1732 m_rareData->m_regexps.shrinkToFit(); 1698 1733 m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); 1699 1734 m_rareData->m_characterSwitchJumpTables.shrinkToFit(); -
trunk/JavaScriptCore/bytecode/CodeBlock.h
r57955 r59064 459 459 FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } 460 460 461 unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; } 462 RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } 463 464 461 465 // Jump Tables 462 466 … … 553 557 Vector<HandlerInfo> m_exceptionHandlers; 554 558 559 // Rare Constants 560 Vector<RefPtr<RegExp> > m_regexps; 561 555 562 // Jump Tables 556 563 Vector<SimpleJumpTable> m_immediateSwitchJumpTables; -
trunk/JavaScriptCore/bytecode/Opcode.h
r58986 r59064 47 47 macro(op_new_object, 2) \ 48 48 macro(op_new_array, 4) \ 49 macro(op_new_regexp, 3) \ 49 50 macro(op_mov, 3) \ 50 51 \ -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r59005 r59064 35 35 #include "JSFunction.h" 36 36 #include "Interpreter.h" 37 #include "RegExp.h"38 #include "RegExpObject.h"39 37 #include "UString.h" 40 38 … … 828 826 829 827 return &m_constantPoolRegisters[index]; 828 } 829 830 unsigned BytecodeGenerator::addRegExp(RegExp* r) 831 { 832 return m_codeBlock->addRegExp(r); 830 833 } 831 834 … … 980 983 } 981 984 982 RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, RegExp* regExp)983 {984 JSValue jsRegExp = new (globalData()) RegExpObject(m_scopeChain->globalObject()->regExpStructure(), regExp);985 return emitLoad(dst, jsRegExp);986 }987 988 985 RegisterID* BytecodeGenerator::emitLoad(RegisterID* dst, JSValue v) 989 986 { … … 1381 1378 } 1382 1379 1380 RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) 1381 { 1382 emitOpcode(op_new_regexp); 1383 instructions().append(dst->index()); 1384 instructions().append(addRegExp(regExp)); 1385 return dst; 1386 } 1387 1388 1383 1389 RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) 1384 1390 { -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r58986 r59064 265 265 RegisterID* emitLoad(RegisterID* dst, double); 266 266 RegisterID* emitLoad(RegisterID* dst, const Identifier&); 267 RegisterID* emitLoad(RegisterID* dst, RegExp* regExp);268 267 RegisterID* emitLoad(RegisterID* dst, JSValue); 269 268 … … 278 277 RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body); 279 278 RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); 279 RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp); 280 280 281 281 RegisterID* emitMove(RegisterID* dst, RegisterID* src); … … 447 447 unsigned addConstant(const Identifier&); 448 448 RegisterID* addConstantValue(JSValue); 449 unsigned addRegExp(RegExp*); 449 450 450 451 PassRefPtr<FunctionExecutable> makeFunction(ExecState* exec, FunctionBodyNode* body) -
trunk/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r58986 r59064 150 150 if (dst == generator.ignoredResult()) 151 151 return 0; 152 return generator.emit Load(generator.finalDestination(dst), regExp.get());152 return generator.emitNewRegExp(generator.finalDestination(dst), regExp.get()); 153 153 } 154 154 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r58986 r59064 1305 1305 1306 1306 vPC += OPCODE_LENGTH(op_new_array); 1307 NEXT_INSTRUCTION(); 1308 } 1309 DEFINE_OPCODE(op_new_regexp) { 1310 /* new_regexp dst(r) regExp(re) 1311 1312 Constructs a new RegExp instance using the original 1313 constructor from regexp regExp, and puts the result in 1314 register dst. 1315 */ 1316 int dst = vPC[1].u.operand; 1317 int regExp = vPC[2].u.operand; 1318 callFrame->r(dst) = JSValue(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject->regExpStructure(), callFrame->codeBlock()->regexp(regExp))); 1319 1320 vPC += OPCODE_LENGTH(op_new_regexp); 1307 1321 NEXT_INSTRUCTION(); 1308 1322 } -
trunk/JavaScriptCore/jit/JIT.cpp
r58986 r59064 276 276 DEFINE_OP(op_new_func_exp) 277 277 DEFINE_OP(op_new_object) 278 DEFINE_OP(op_new_regexp) 278 279 DEFINE_OP(op_next_pname) 279 280 DEFINE_OP(op_not) -
trunk/JavaScriptCore/jit/JIT.h
r59056 r59064 695 695 void emit_op_new_func_exp(Instruction*); 696 696 void emit_op_new_object(Instruction*); 697 void emit_op_new_regexp(Instruction*); 697 698 void emit_op_get_pnames(Instruction*); 698 699 void emit_op_next_pname(Instruction*); -
trunk/JavaScriptCore/jit/JITOpcodes.cpp
r59056 r59064 964 964 } 965 965 966 void JIT::emit_op_new_regexp(Instruction* currentInstruction) 967 { 968 JITStubCall stubCall(this, cti_op_new_regexp); 969 stubCall.addArgument(ImmPtr(m_codeBlock->regexp(currentInstruction[2].u.operand))); 970 stubCall.call(currentInstruction[1].u.operand); 971 } 972 966 973 void JIT::emit_op_bitor(Instruction* currentInstruction) 967 974 { … … 1630 1637 } 1631 1638 1639 void JIT::emit_op_new_regexp(Instruction* currentInstruction) 1640 { 1641 JITStubCall stubCall(this, cti_op_new_regexp); 1642 stubCall.addArgument(ImmPtr(m_codeBlock->regexp(currentInstruction[2].u.operand))); 1643 stubCall.call(currentInstruction[1].u.operand); 1644 } 1645 1632 1646 // For both JSValue32_64 and JSValue32 1633 1647 #if ENABLE(JIT_OPTIMIZE_MOD) -
trunk/JavaScriptCore/jit/JITStubs.cpp
r59055 r59064 2871 2871 } 2872 2872 2873 DEFINE_STUB_FUNCTION(JSObject*, op_new_regexp) 2874 { 2875 STUB_INIT_STACK_FRAME(stackFrame); 2876 2877 return new (stackFrame.globalData) RegExpObject(stackFrame.callFrame->lexicalGlobalObject()->regExpStructure(), stackFrame.args[0].regExp()); 2878 } 2879 2873 2880 DEFINE_STUB_FUNCTION(EncodedJSValue, op_bitor) 2874 2881 { -
trunk/JavaScriptCore/jit/JITStubs.h
r58986 r59064 358 358 JSObject* JIT_STUB cti_op_new_func_exp(STUB_ARGS_DECLARATION); 359 359 JSObject* JIT_STUB cti_op_new_object(STUB_ARGS_DECLARATION); 360 JSObject* JIT_STUB cti_op_new_regexp(STUB_ARGS_DECLARATION); 360 361 JSObject* JIT_STUB cti_op_push_activation(STUB_ARGS_DECLARATION); 361 362 JSObject* JIT_STUB cti_op_push_new_scope(STUB_ARGS_DECLARATION);
Note:
See TracChangeset
for help on using the changeset viewer.