| Differences between
and this patch
- Source/JavaScriptCore/ChangeLog +20 lines
Lines 1-3 Source/JavaScriptCore/ChangeLog_sec1
1
2015-03-13  Filip Pizlo  <fpizlo@apple.com>
2
3
        DFG::PutStackSinkingPhase should eliminate GetStacks that have an obviously known source
4
        https://bugs.webkit.org/show_bug.cgi?id=141624
5
6
        Reviewed by NOBODY (OOPS!).
7
        
8
        This was an obvious omission from the original PutStackSinkingPhase. Previously, we would treat
9
        GetStacks conservatively and assume that the stack slot escaped. That's pretty dumb, since a
10
        GetStack is a local load of the stack. This change makes GetStack a no-op from the standpoint of
11
        this phase's deferral analysis. At the end we either keep the GetStack (if there was no concrete
12
        deferral) or we replace it with an identity over the value that would have been stored by the
13
        deferred PutStack. Note that this might be a Phi that the phase creates, so this is strictly
14
        stronger than what GCSE could do.
15
        
16
        This is probably not a speed-up now, but it will be very useful for the varargs simplification
17
        done in bug 141174.
18
19
        * dfg/DFGPutStackSinkingPhase.cpp:
20
1
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
21
2015-03-13  Ryosuke Niwa  <rniwa@webkit.org>
2
22
3
        BytecodeGenerator needs to be re-entrant to support miranda functions
23
        BytecodeGenerator needs to be re-entrant to support miranda functions
- Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp -10 / +28 lines
Lines 221-226 public: Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp_sec1
221
                        continue;
221
                        continue;
222
                    }
222
                    }
223
                    
223
                    
224
                    if (node->op() == GetStack) {
225
                        // A GetStack doesn't affect anything, since we know which local we are reading
226
                        // from.
227
                        continue;
228
                    }
229
                    
224
                    auto escapeHandler = [&] (VirtualRegister operand) {
230
                    auto escapeHandler = [&] (VirtualRegister operand) {
225
                        if (operand.isHeader())
231
                        if (operand.isHeader())
226
                            return;
232
                            return;
Lines 390-395 public: Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp_sec2
390
                    deferred.operand(node->unlinkedLocal()) = ConflictingFlush;
396
                    deferred.operand(node->unlinkedLocal()) = ConflictingFlush;
391
                    break;
397
                    break;
392
                }
398
                }
399
                    
400
                case GetStack: {
401
                    StackAccessData* data = node->stackAccessData();
402
                    FlushFormat format = deferred.operand(data->local);
403
                    if (!isConcrete(format)) {
404
                        // This means there is no deferral. No deferral means that the most
405
                        // authoritative value for this stack slot is what is stored in the stack. So,
406
                        // keep the GetStack.
407
                        break;
408
                    }
409
                    
410
                    // We have a concrete deferral, which means a PutStack that hasn't executed yet. It
411
                    // would have stored a value with a certain format. That format must match our
412
                    // format. But more importantly, we can simply use the value that the PutStack would
413
                    // have stored and get rid of the GetStack.
414
                    DFG_ASSERT(m_graph, node, format == data->format);
415
                    
416
                    Node* incoming = mapping.operand(data->local);
417
                    node->convertToIdentity();
418
                    node->child1() = incoming->defaultEdge();
419
                    break;
420
                }
393
                
421
                
394
                default: {
422
                default: {
395
                    auto escapeHandler = [&] (VirtualRegister operand) {
423
                    auto escapeHandler = [&] (VirtualRegister operand) {
Lines 418-433 public: Source/JavaScriptCore/dfg/DFGPutStackSinkingPhase.cpp_sec3
418
                    preciseLocalClobberize(
446
                    preciseLocalClobberize(
419
                        m_graph, node, escapeHandler, escapeHandler,
447
                        m_graph, node, escapeHandler, escapeHandler,
420
                        [&] (VirtualRegister, Node*) { });
448
                        [&] (VirtualRegister, Node*) { });
421
                    
422
                    // If we're a GetStack, then we also create a mapping.
423
                    // FIXME: We should be able to just eliminate such GetLocals, when we know
424
                    // what their incoming value will be.
425
                    // https://bugs.webkit.org/show_bug.cgi?id=141624
426
                    if (node->op() == GetStack) {
427
                        StackAccessData* data = node->stackAccessData();
428
                        VirtualRegister operand = data->local;
429
                        mapping.operand(operand) = node;
430
                    }
431
                    break;
449
                    break;
432
                } }
450
                } }
433
            }
451
            }

Return to Bug 141624