OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static void AddCounter(v8::Local<v8::Object> object, | 44 static void AddCounter(v8::Local<v8::Object> object, |
45 StatsCounter* counter, | 45 StatsCounter* counter, |
46 const char* name) { | 46 const char* name) { |
47 if (counter->Enabled()) { | 47 if (counter->Enabled()) { |
48 object->Set(v8::String::New(name), | 48 object->Set(v8::String::New(name), |
49 v8::Number::New(*counter->GetInternalPointer())); | 49 v8::Number::New(*counter->GetInternalPointer())); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 static void AddNumber(v8::Local<v8::Object> object, | 53 static void AddNumber(v8::Local<v8::Object> object, |
54 double value, | 54 intptr_t value, |
55 const char* name) { | 55 const char* name) { |
56 object->Set(v8::String::New(name), v8::Number::New(value)); | 56 object->Set(v8::String::New(name), |
| 57 v8::Number::New(static_cast<double>(value))); |
57 } | 58 } |
58 | 59 |
59 | 60 |
60 v8::Handle<v8::Value> StatisticsExtension::GetCounters( | 61 v8::Handle<v8::Value> StatisticsExtension::GetCounters( |
61 const v8::Arguments& args) { | 62 const v8::Arguments& args) { |
62 Isolate* isolate = Isolate::Current(); | 63 Isolate* isolate = Isolate::Current(); |
63 Heap* heap = isolate->heap(); | 64 Heap* heap = isolate->heap(); |
64 | 65 |
65 if (args.Length() > 0) { // GC if first argument evaluates to true. | 66 if (args.Length() > 0) { // GC if first argument evaluates to true. |
66 if (args[0]->IsBoolean() && args[0]->ToBoolean()->Value()) { | 67 if (args[0]->IsBoolean() && args[0]->ToBoolean()->Value()) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return result; | 144 return result; |
144 } | 145 } |
145 | 146 |
146 | 147 |
147 void StatisticsExtension::Register() { | 148 void StatisticsExtension::Register() { |
148 static StatisticsExtension statistics_extension; | 149 static StatisticsExtension statistics_extension; |
149 static v8::DeclareExtension declaration(&statistics_extension); | 150 static v8::DeclareExtension declaration(&statistics_extension); |
150 } | 151 } |
151 | 152 |
152 } } // namespace v8::internal | 153 } } // namespace v8::internal |
OLD | NEW |