OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 | 2104 |
2105 using v8::platform::tracing::TraceBuffer; | 2105 using v8::platform::tracing::TraceBuffer; |
2106 using v8::platform::tracing::TraceConfig; | 2106 using v8::platform::tracing::TraceConfig; |
2107 using v8::platform::tracing::TraceObject; | 2107 using v8::platform::tracing::TraceObject; |
2108 | 2108 |
2109 namespace { | 2109 namespace { |
2110 | 2110 |
2111 class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter { | 2111 class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter { |
2112 public: | 2112 public: |
2113 void AppendTraceEvent(TraceObject* trace_event) override { | 2113 void AppendTraceEvent(TraceObject* trace_event) override { |
2114 if (trace_event->name() != std::string("Profile") && | 2114 if (trace_event->name() != std::string("CpuProfile") && |
2115 trace_event->name() != std::string("ProfileChunk")) | 2115 trace_event->name() != std::string("CpuProfileChunk")) |
2116 return; | 2116 return; |
2117 CHECK(!profile_id_ || trace_event->id() == profile_id_); | 2117 CHECK(!profile_id_ || trace_event->id() == profile_id_); |
2118 CHECK_EQ(1, trace_event->num_args()); | 2118 CHECK_EQ(1, trace_event->num_args()); |
2119 CHECK_EQ(TRACE_VALUE_TYPE_CONVERTABLE, trace_event->arg_types()[0]); | 2119 CHECK_EQ(TRACE_VALUE_TYPE_CONVERTABLE, trace_event->arg_types()[0]); |
2120 profile_id_ = trace_event->id(); | 2120 profile_id_ = trace_event->id(); |
2121 v8::ConvertableToTraceFormat* arg = | 2121 v8::ConvertableToTraceFormat* arg = |
2122 trace_event->arg_convertables()[0].get(); | 2122 trace_event->arg_convertables()[0].get(); |
2123 arg->AppendAsTraceFormat(&result_json_); | 2123 arg->AppendAsTraceFormat(&result_json_); |
2124 } | 2124 } |
2125 void Flush() override {} | 2125 void Flush() override {} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 printf("Profile JSON: %s\n", profile_json.c_str()); | 2170 printf("Profile JSON: %s\n", profile_json.c_str()); |
2171 std::string code = profile_checker + profile_json + ")"; | 2171 std::string code = profile_checker + profile_json + ")"; |
2172 v8::Local<v8::Value> result = | 2172 v8::Local<v8::Value> result = |
2173 CompileRunChecked(CcTest::isolate(), code.c_str()); | 2173 CompileRunChecked(CcTest::isolate(), code.c_str()); |
2174 v8::String::Utf8Value value(result); | 2174 v8::String::Utf8Value value(result); |
2175 printf("Check result: %*s\n", value.length(), *value); | 2175 printf("Check result: %*s\n", value.length(), *value); |
2176 CHECK_EQ(0, value.length()); | 2176 CHECK_EQ(0, value.length()); |
2177 | 2177 |
2178 i::V8::SetPlatformForTesting(old_platform); | 2178 i::V8::SetPlatformForTesting(old_platform); |
2179 } | 2179 } |
OLD | NEW |