Changeset 34659 in webkit for trunk/JavaScriptCore/API/JSBase.cpp


Ignore:
Timestamp:
Jun 19, 2008, 10:29:29 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Prepare JavaScript heap for being per-thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSBase.cpp

    r34581 r34659  
    2929
    3030#include "APICast.h"
     31#include "completion.h"
    3132#include <kjs/ExecState.h>
    3233#include <kjs/InitializeThreading.h>
     
    8687        initializeThreading();
    8788
     89    // It might seem that we have a context passed to this function, and can use toJS(ctx)->heap(), but the parameter is likely to be NULL,
     90    // and it may actually be garbage for some clients (most likely, because of JSGarbageCollect being called after releasing the context).
     91
    8892    JSLock lock;
    89     if (!Collector::isBusy())
    90         Collector::collect();
     93
     94    // FIXME: It would be good to avoid creating a JSGlobalData instance if it didn't exist for this thread yet.
     95    Heap* heap = JSGlobalData::threadInstance().heap;
     96    if (!heap->isBusy())
     97        heap->collect();
     98
     99    // FIXME: Similarly, we shouldn't create a shared instance here.
     100    heap = JSGlobalData::sharedInstance().heap;
     101    if (!heap->isBusy())
     102        heap->collect();
     103
    91104    // FIXME: Perhaps we should trigger a second mark and sweep
    92105    // once the garbage collector is done if this is called when
Note: See TracChangeset for help on using the changeset viewer.