Revision f230a1cf deps/v8/src/mksnapshot.cc

View differences:

deps/v8/src/mksnapshot.cc
43 43

  
44 44
using namespace v8;
45 45

  
46
static const unsigned int kMaxCounters = 256;
47

  
48
// A single counter in a counter collection.
49
class Counter {
50
 public:
51
  static const int kMaxNameSize = 64;
52
  int32_t* Bind(const char* name) {
53
    int i;
54
    for (i = 0; i < kMaxNameSize - 1 && name[i]; i++) {
55
      name_[i] = name[i];
56
    }
57
    name_[i] = '\0';
58
    return &counter_;
59
  }
60
 private:
61
  int32_t counter_;
62
  uint8_t name_[kMaxNameSize];
63
};
64

  
65

  
66
// A set of counters and associated information.  An instance of this
67
// class is stored directly in the memory-mapped counters file if
68
// the --save-counters options is used
69
class CounterCollection {
70
 public:
71
  CounterCollection() {
72
    magic_number_ = 0xDEADFACE;
73
    max_counters_ = kMaxCounters;
74
    max_name_size_ = Counter::kMaxNameSize;
75
    counters_in_use_ = 0;
76
  }
77
  Counter* GetNextCounter() {
78
    if (counters_in_use_ == kMaxCounters) return NULL;
79
    return &counters_[counters_in_use_++];
80
  }
81
 private:
82
  uint32_t magic_number_;
83
  uint32_t max_counters_;
84
  uint32_t max_name_size_;
85
  uint32_t counters_in_use_;
86
  Counter counters_[kMaxCounters];
87
};
88

  
89 46

  
90 47
class Compressor {
91 48
 public:
......
310 267

  
311 268
int main(int argc, char** argv) {
312 269
  V8::InitializeICU();
270
  i::Isolate::SetCrashIfDefaultIsolateInitialized();
313 271

  
314 272
  // By default, log code create information in the snapshot.
315 273
  i::FLAG_log_code = true;
......
330 288
    exit(1);
331 289
  }
332 290
#endif
333
  Isolate* isolate = Isolate::GetCurrent();
291
  i::FLAG_logfile_per_isolate = false;
292

  
293
  Isolate* isolate = v8::Isolate::New();
294
  isolate->Enter();
334 295
  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
335 296
  i::Serializer::Enable(internal_isolate);
336 297
  Persistent<Context> context;

Also available in: Unified diff