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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 index >= realm_count_ || | 282 index >= realm_count_ || |
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. |
Hannes Payer (out of office)
2014/06/09 15:23:51
Please adjust the comment, i.e. say what it return
Igor Sheludko
2014/06/10 08:22:54
Done.
| |
293 void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) { | 293 void Shell::PerformanceNow(const v8::FunctionCallbackInfo<v8::Value>& args) { |
294 i::TimeDelta delta = i::TimeTicks::HighResolutionNow() - kInitialTicks; | 294 if (i::FLAG_verify_predictable) { |
295 args.GetReturnValue().Set(delta.InMillisecondsF()); | 295 Isolate* v8_isolate = args.GetIsolate(); |
296 i::Heap* heap = reinterpret_cast<i::Isolate*>(v8_isolate)->heap(); | |
297 args.GetReturnValue().Set(static_cast<double>(heap->allocations_count())); | |
298 | |
299 } else { | |
300 i::TimeDelta delta = i::TimeTicks::HighResolutionNow() - kInitialTicks; | |
301 args.GetReturnValue().Set(delta.InMillisecondsF()); | |
302 } | |
296 } | 303 } |
297 #endif // !V8_SHARED | 304 #endif // !V8_SHARED |
298 | 305 |
299 | 306 |
300 // Realm.current() returns the index of the currently active realm. | 307 // Realm.current() returns the index of the currently active realm. |
301 void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) { | 308 void Shell::RealmCurrent(const v8::FunctionCallbackInfo<v8::Value>& args) { |
302 Isolate* isolate = args.GetIsolate(); | 309 Isolate* isolate = args.GetIsolate(); |
303 PerIsolateData* data = PerIsolateData::Get(isolate); | 310 PerIsolateData* data = PerIsolateData::Get(isolate); |
304 int index = data->RealmFind(isolate->GetEnteredContext()); | 311 int index = data->RealmFind(isolate->GetEnteredContext()); |
305 if (index == -1) return; | 312 if (index == -1) return; |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1624 } | 1631 } |
1625 | 1632 |
1626 } // namespace v8 | 1633 } // namespace v8 |
1627 | 1634 |
1628 | 1635 |
1629 #ifndef GOOGLE3 | 1636 #ifndef GOOGLE3 |
1630 int main(int argc, char* argv[]) { | 1637 int main(int argc, char* argv[]) { |
1631 return v8::Shell::Main(argc, argv); | 1638 return v8::Shell::Main(argc, argv); |
1632 } | 1639 } |
1633 #endif | 1640 #endif |
OLD | NEW |