Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: test/cctest/test-sampler-api.cc

Issue 877753007: Reland "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: VS201x now happy? Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 // Tests the sampling API in include/v8.h 5 // Tests the sampling API in include/v8.h
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include "include/v8.h" 9 #include "include/v8.h"
10 #include "src/simulator.h" 10 #include "src/simulator.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 public: 84 public:
85 struct CodeEventEntry { 85 struct CodeEventEntry {
86 std::string name; 86 std::string name;
87 const void* code_start; 87 const void* code_start;
88 size_t code_len; 88 size_t code_len;
89 }; 89 };
90 typedef std::map<const void*, CodeEventEntry> CodeEntries; 90 typedef std::map<const void*, CodeEventEntry> CodeEntries;
91 91
92 explicit SamplingTestHelper(const std::string& test_function) 92 explicit SamplingTestHelper(const std::string& test_function)
93 : sample_is_taken_(false), isolate_(CcTest::isolate()) { 93 : sample_is_taken_(false), isolate_(CcTest::isolate()) {
94 DCHECK_EQ(NULL, instance_); 94 DCHECK(!instance_);
95 instance_ = this; 95 instance_ = this;
96 v8::HandleScope scope(isolate_); 96 v8::HandleScope scope(isolate_);
97 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); 97 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
98 global->Set(v8::String::NewFromUtf8(isolate_, "CollectSample"), 98 global->Set(v8::String::NewFromUtf8(isolate_, "CollectSample"),
99 v8::FunctionTemplate::New(isolate_, CollectSample)); 99 v8::FunctionTemplate::New(isolate_, CollectSample));
100 LocalContext env(isolate_, NULL, global); 100 LocalContext env(isolate_, NULL, global);
101 isolate_->SetJitCodeEventHandler(v8::kJitCodeEventDefault, 101 isolate_->SetJitCodeEventHandler(v8::kJitCodeEventDefault,
102 JitCodeEventHandler); 102 JitCodeEventHandler);
103 v8::Script::Compile( 103 v8::Script::Compile(
104 v8::String::NewFromUtf8(isolate_, test_function.c_str()))->Run(); 104 v8::String::NewFromUtf8(isolate_, test_function.c_str()))->Run();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 " return test_sampler_api_inner() + arguments.callee.toString();" 235 " return test_sampler_api_inner() + arguments.callee.toString();"
236 "}" 236 "}"
237 "test_sampler_api_outer();"; 237 "test_sampler_api_outer();";
238 238
239 SamplingTestHelper helper(test_script); 239 SamplingTestHelper helper(test_script);
240 Sample& sample = helper.sample(); 240 Sample& sample = helper.sample();
241 CHECK_EQ(3, sample.size()); 241 CHECK_EQ(3, sample.size());
242 242
243 const SamplingTestHelper::CodeEventEntry* entry; 243 const SamplingTestHelper::CodeEventEntry* entry;
244 entry = helper.FindEventEntry(sample.begin()[0]); 244 entry = helper.FindEventEntry(sample.begin()[0]);
245 CHECK_NE(NULL, entry); 245 CHECK(entry);
246 CHECK(std::string::npos != entry->name.find("test_sampler_api_inner")); 246 CHECK(std::string::npos != entry->name.find("test_sampler_api_inner"));
247 247
248 entry = helper.FindEventEntry(sample.begin()[1]); 248 entry = helper.FindEventEntry(sample.begin()[1]);
249 CHECK_NE(NULL, entry); 249 CHECK(entry);
250 CHECK(std::string::npos != entry->name.find("test_sampler_api_outer")); 250 CHECK(std::string::npos != entry->name.find("test_sampler_api_outer"));
251 } 251 }
OLDNEW
« no previous file with comments | « test/cctest/test-regexp.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698