Revision f230a1cf deps/v8/src/d8.cc

View differences:

deps/v8/src/d8.cc
49 49
#endif  // !V8_SHARED
50 50

  
51 51
#ifdef V8_SHARED
52
#include "../include/v8-defaults.h"
52 53
#include "../include/v8-testing.h"
53 54
#endif  // V8_SHARED
54 55

  
......
66 67
#include "natives.h"
67 68
#include "platform.h"
68 69
#include "v8.h"
70
#include "v8-defaults.h"
69 71
#endif  // V8_SHARED
70 72

  
71 73
#if !defined(_WIN32) && !defined(_WIN64)
......
158 160
CounterCollection Shell::local_counters_;
159 161
CounterCollection* Shell::counters_ = &local_counters_;
160 162
i::Mutex Shell::context_mutex_;
163
const i::TimeTicks Shell::kInitialTicks = i::TimeTicks::HighResolutionNow();
161 164
Persistent<Context> Shell::utility_context_;
162 165
#endif  // V8_SHARED
163 166

  
......
263 266
  data_->realm_current_ = 0;
264 267
  data_->realm_switch_ = 0;
265 268
  data_->realms_ = new Persistent<Context>[1];
266
  data_->realms_[0].Reset(data_->isolate_, Context::GetEntered());
269
  data_->realms_[0].Reset(data_->isolate_,
270
                          data_->isolate_->GetEnteredContext());
267 271
  data_->realm_shared_.Clear();
268 272
}
269 273

  
......
286 290
}
287 291

  
288 292

  
293
#ifndef V8_SHARED
294
// performance.now() returns a time stamp as double, measured in milliseconds.
295
void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) {
296
  i::TimeDelta delta = i::TimeTicks::HighResolutionNow() - kInitialTicks;
297
  args.GetReturnValue().Set(delta.InMillisecondsF());
298
}
299
#endif  // V8_SHARED
300

  
301

  
289 302
// Realm.current() returns the index of the currently active realm.
290 303
void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) {
291 304
  Isolate* isolate = args.GetIsolate();
292 305
  PerIsolateData* data = PerIsolateData::Get(isolate);
293
  int index = data->RealmFind(Context::GetEntered());
306
  int index = data->RealmFind(isolate->GetEnteredContext());
294 307
  if (index == -1) return;
295 308
  args.GetReturnValue().Set(index);
296 309
}
......
869 882
                              RealmSharedGet, RealmSharedSet);
870 883
  global_template->Set(String::New("Realm"), realm_template);
871 884

  
885
#ifndef V8_SHARED
886
  Handle<ObjectTemplate> performance_template = ObjectTemplate::New();
887
  performance_template->Set(String::New("now"),
888
                            FunctionTemplate::New(PerformanceNow));
889
  global_template->Set(String::New("performance"), performance_template);
890
#endif  // V8_SHARED
891

  
872 892
#if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64)
873 893
  Handle<ObjectTemplate> os_templ = ObjectTemplate::New();
874 894
  AddOSMethods(os_templ);
......
939 959
  i::Factory* factory = reinterpret_cast<i::Isolate*>(isolate)->factory();
940 960
  i::JSArguments js_args = i::FLAG_js_arguments;
941 961
  i::Handle<i::FixedArray> arguments_array =
942
      factory->NewFixedArray(js_args.argc());
943
  for (int j = 0; j < js_args.argc(); j++) {
962
      factory->NewFixedArray(js_args.argc);
963
  for (int j = 0; j < js_args.argc; j++) {
944 964
    i::Handle<i::String> arg =
945 965
        factory->NewStringFromUtf8(i::CStrVector(js_args[j]));
946 966
    arguments_array->set(j, *arg);
......
1228 1248

  
1229 1249

  
1230 1250
void SourceGroup::Execute(Isolate* isolate) {
1251
  bool exception_was_thrown = false;
1231 1252
  for (int i = begin_offset_; i < end_offset_; ++i) {
1232 1253
    const char* arg = argv_[i];
1233 1254
    if (strcmp(arg, "-e") == 0 && i + 1 < end_offset_) {
......
1236 1257
      Handle<String> file_name = String::New("unnamed");
1237 1258
      Handle<String> source = String::New(argv_[i + 1]);
1238 1259
      if (!Shell::ExecuteString(isolate, source, file_name, false, true)) {
1239
        Shell::Exit(1);
1260
        exception_was_thrown = true;
1261
        break;
1240 1262
      }
1241 1263
      ++i;
1242 1264
    } else if (arg[0] == '-') {
......
1251 1273
        Shell::Exit(1);
1252 1274
      }
1253 1275
      if (!Shell::ExecuteString(isolate, source, file_name, false, true)) {
1254
        Shell::Exit(1);
1276
        exception_was_thrown = true;
1277
        break;
1255 1278
      }
1256 1279
    }
1257 1280
  }
1281
  if (exception_was_thrown != Shell::options.expected_to_throw) {
1282
    Shell::Exit(1);
1283
  }
1258 1284
}
1259 1285

  
1260 1286

  
......
1410 1436
      options.dump_heap_constants = true;
1411 1437
      argv[i] = NULL;
1412 1438
#endif
1439
    } else if (strcmp(argv[i], "--throws") == 0) {
1440
      options.expected_to_throw = true;
1441
      argv[i] = NULL;
1413 1442
    }
1414 1443
#ifdef V8_SHARED
1415 1444
    else if (strcmp(argv[i], "--dump-counters") == 0) {
......
1525 1554
    // Start preemption if threads have been created and preemption is enabled.
1526 1555
    if (threads.length() > 0
1527 1556
        && options.use_preemption) {
1528
      Locker::StartPreemption(options.preemption_interval);
1557
      Locker::StartPreemption(isolate, options.preemption_interval);
1529 1558
    }
1530 1559
#endif  // V8_SHARED
1531 1560
  }
......
1543 1572

  
1544 1573
  if (threads.length() > 0 && options.use_preemption) {
1545 1574
    Locker lock(isolate);
1546
    Locker::StopPreemption();
1575
    Locker::StopPreemption(isolate);
1547 1576
  }
1548 1577
#endif  // V8_SHARED
1549 1578
  return 0;
......
1648 1677
#else
1649 1678
  SetStandaloneFlagsViaCommandLine();
1650 1679
#endif
1680
  v8::SetDefaultResourceConstraintsForCurrentPlatform();
1651 1681
  ShellArrayBufferAllocator array_buffer_allocator;
1652 1682
  v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
1653 1683
  int result = 0;

Also available in: Unified diff