OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 realms_[index].IsEmpty()) { | 283 realms_[index].IsEmpty()) { |
284 Throw(args.GetIsolate(), "Invalid realm index"); | 284 Throw(args.GetIsolate(), "Invalid realm index"); |
285 return -1; | 285 return -1; |
286 } | 286 } |
287 return index; | 287 return index; |
288 } | 288 } |
289 | 289 |
290 | 290 |
291 #ifndef V8_SHARED | 291 #ifndef V8_SHARED |
292 // performance.now() returns a time stamp as double, measured in milliseconds. | 292 // performance.now() returns a time stamp as double, measured in milliseconds. |
| 293 // When FLAG_verify_predictable mode is enabled it returns current value |
| 294 // of Heap::allocations_count(). |
293 void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) { | 295 void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) { |
294 i::TimeDelta delta = i::TimeTicks::HighResolutionNow() - kInitialTicks; | 296 if (i::FLAG_verify_predictable) { |
295 args.GetReturnValue().Set(delta.InMillisecondsF()); | 297 Isolate* v8_isolate = args.GetIsolate(); |
| 298 i::Heap* heap = reinterpret_cast<i::Isolate*>(v8_isolate)->heap(); |
| 299 args.GetReturnValue().Set(heap->synthetic_time()); |
| 300 |
| 301 } else { |
| 302 i::TimeDelta delta = i::TimeTicks::HighResolutionNow() - kInitialTicks; |
| 303 args.GetReturnValue().Set(delta.InMillisecondsF()); |
| 304 } |
296 } | 305 } |
297 #endif // !V8_SHARED | 306 #endif // !V8_SHARED |
298 | 307 |
299 | 308 |
300 // Realm.current() returns the index of the currently active realm. | 309 // Realm.current() returns the index of the currently active realm. |
301 void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) { | 310 void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) { |
302 Isolate* isolate = args.GetIsolate(); | 311 Isolate* isolate = args.GetIsolate(); |
303 PerIsolateData* data = PerIsolateData::Get(isolate); | 312 PerIsolateData* data = PerIsolateData::Get(isolate); |
304 int index = data->RealmFind(isolate->GetEnteredContext()); | 313 int index = data->RealmFind(isolate->GetEnteredContext()); |
305 if (index == -1) return; | 314 if (index == -1) return; |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 } | 1633 } |
1625 | 1634 |
1626 } // namespace v8 | 1635 } // namespace v8 |
1627 | 1636 |
1628 | 1637 |
1629 #ifndef GOOGLE3 | 1638 #ifndef GOOGLE3 |
1630 int main(int argc, char* argv[]) { | 1639 int main(int argc, char* argv[]) { |
1631 return v8::Shell::Main(argc, argv); | 1640 return v8::Shell::Main(argc, argv); |
1632 } | 1641 } |
1633 #endif | 1642 #endif |
OLD | NEW |