Changeset 120175 in webkit for trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
- Timestamp:
- Jun 13, 2012, 2:38:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r120172 r120175 1235 1235 // an inline candidate? 1236 1236 CodeBlock* profiledBlock = executable->profiledCodeBlockFor(kind); 1237 if (!profiledBlock)1238 return false;1239 1240 1237 if (!mightInlineFunctionFor(profiledBlock, kind)) 1241 1238 return false; … … 2255 2252 SpeculatedType prediction = getPrediction(); 2256 2253 2257 JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();2258 2259 2254 NodeIndex getGlobalVar = addToGraph( 2260 2255 GetGlobalVar, 2261 OpInfo( globalObject->assertRegisterIsInThisObject(currentInstruction[2].u.registerPointer)),2256 OpInfo(m_inlineStackTop->m_codeBlock->globalObject()->assertRegisterIsInThisObject(currentInstruction[2].u.registerPointer)), 2262 2257 OpInfo(prediction)); 2263 2258 set(currentInstruction[1].u.operand, getGlobalVar); 2264 2259 NEXT_OPCODE(op_get_global_var); 2265 }2266 2267 case op_get_global_var_watchable: {2268 SpeculatedType prediction = getPrediction();2269 2270 JSGlobalObject* globalObject = m_inlineStackTop->m_codeBlock->globalObject();2271 2272 unsigned identifierNumber = m_inlineStackTop->m_identifierRemap[currentInstruction[3].u.operand];2273 Identifier identifier = m_codeBlock->identifier(identifierNumber);2274 SymbolTableEntry entry = globalObject->symbolTable().get(identifier.impl());2275 if (!entry.couldBeWatched()) {2276 NodeIndex getGlobalVar = addToGraph(2277 GetGlobalVar,2278 OpInfo(globalObject->assertRegisterIsInThisObject(currentInstruction[2].u.registerPointer)),2279 OpInfo(prediction));2280 set(currentInstruction[1].u.operand, getGlobalVar);2281 NEXT_OPCODE(op_get_global_var_watchable);2282 }2283 2284 // The watchpoint is still intact! This means that we will get notified if the2285 // current value in the global variable changes. So, we can inline that value.2286 // Moreover, currently we can assume that this value is a JSFunction*, which2287 // implies that it's a cell. This simplifies things, since in general we'd have2288 // to use a JSConstant for non-cells and a WeakJSConstant for cells. So instead2289 // of having both cases we just assert that the value is a cell.2290 2291 // NB. If it wasn't for CSE, GlobalVarWatchpoint would have no need for the2292 // register pointer. But CSE tracks effects on global variables by comparing2293 // register pointers. Because CSE executes multiple times while the backend2294 // executes once, we use the following performance trade-off:2295 // - The node refers directly to the register pointer to make CSE super cheap.2296 // - To perform backend code generation, the node only contains the identifier2297 // number, from which it is possible to get (via a few average-time O(1)2298 // lookups) to the WatchpointSet.2299 2300 addToGraph(2301 GlobalVarWatchpoint,2302 OpInfo(globalObject->assertRegisterIsInThisObject(currentInstruction[2].u.registerPointer)),2303 OpInfo(identifierNumber));2304 2305 JSValue specificValue = globalObject->registerAt(entry.getIndex()).get();2306 ASSERT(specificValue.isCell());2307 set(currentInstruction[1].u.operand,2308 addToGraph(WeakJSConstant, OpInfo(specificValue.asCell())));2309 2310 NEXT_OPCODE(op_get_global_var_watchable);2311 2260 } 2312 2261 … … 2318 2267 value); 2319 2268 NEXT_OPCODE(op_put_global_var); 2320 }2321 2322 case op_put_global_var_check: {2323 NodeIndex value = get(currentInstruction[2].u.operand);2324 CodeBlock* codeBlock = m_inlineStackTop->m_codeBlock;2325 JSGlobalObject* globalObject = codeBlock->globalObject();2326 unsigned identifierNumber = m_inlineStackTop->m_identifierRemap[currentInstruction[4].u.operand];2327 Identifier identifier = m_codeBlock->identifier(identifierNumber);2328 SymbolTableEntry entry = globalObject->symbolTable().get(identifier.impl());2329 if (!entry.couldBeWatched()) {2330 addToGraph(2331 PutGlobalVar,2332 OpInfo(globalObject->assertRegisterIsInThisObject(currentInstruction[1].u.registerPointer)),2333 value);2334 NEXT_OPCODE(op_put_global_var_check);2335 }2336 addToGraph(2337 PutGlobalVarCheck,2338 OpInfo(codeBlock->globalObject()->assertRegisterIsInThisObject(currentInstruction[1].u.registerPointer)),2339 OpInfo(identifierNumber),2340 value);2341 NEXT_OPCODE(op_put_global_var_check);2342 2269 } 2343 2270
Note:
See TracChangeset
for help on using the changeset viewer.