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

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

Issue 888613002: Initial switch to Chromium-style CHECK_* and DCHECK_* macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CHECK_NULL/NOT_NULL is back. 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 public: 78 public:
79 struct CodeEventEntry { 79 struct CodeEventEntry {
80 std::string name; 80 std::string name;
81 const void* code_start; 81 const void* code_start;
82 size_t code_len; 82 size_t code_len;
83 }; 83 };
84 typedef std::map<const void*, CodeEventEntry> CodeEntries; 84 typedef std::map<const void*, CodeEventEntry> CodeEntries;
85 85
86 explicit SamplingTestHelper(const std::string& test_function) 86 explicit SamplingTestHelper(const std::string& test_function)
87 : sample_is_taken_(false), isolate_(CcTest::isolate()) { 87 : sample_is_taken_(false), isolate_(CcTest::isolate()) {
88 DCHECK_EQ(NULL, instance_); 88 DCHECK(!instance_);
89 instance_ = this; 89 instance_ = this;
90 v8::HandleScope scope(isolate_); 90 v8::HandleScope scope(isolate_);
91 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_); 91 v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate_);
92 global->Set(v8::String::NewFromUtf8(isolate_, "CollectSample"), 92 global->Set(v8::String::NewFromUtf8(isolate_, "CollectSample"),
93 v8::FunctionTemplate::New(isolate_, CollectSample)); 93 v8::FunctionTemplate::New(isolate_, CollectSample));
94 LocalContext env(isolate_, NULL, global); 94 LocalContext env(isolate_, NULL, global);
95 isolate_->SetJitCodeEventHandler(v8::kJitCodeEventDefault, 95 isolate_->SetJitCodeEventHandler(v8::kJitCodeEventDefault,
96 JitCodeEventHandler); 96 JitCodeEventHandler);
97 v8::Script::Compile( 97 v8::Script::Compile(
98 v8::String::NewFromUtf8(isolate_, test_function.c_str()))->Run(); 98 v8::String::NewFromUtf8(isolate_, test_function.c_str()))->Run();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 " return test_sampler_api_inner() + arguments.callee.toString();" 229 " return test_sampler_api_inner() + arguments.callee.toString();"
230 "}" 230 "}"
231 "test_sampler_api_outer();"; 231 "test_sampler_api_outer();";
232 232
233 SamplingTestHelper helper(test_script); 233 SamplingTestHelper helper(test_script);
234 Sample& sample = helper.sample(); 234 Sample& sample = helper.sample();
235 CHECK_EQ(3, sample.size()); 235 CHECK_EQ(3, sample.size());
236 236
237 const SamplingTestHelper::CodeEventEntry* entry; 237 const SamplingTestHelper::CodeEventEntry* entry;
238 entry = helper.FindEventEntry(sample.begin()[0]); 238 entry = helper.FindEventEntry(sample.begin()[0]);
239 CHECK_NE(NULL, entry); 239 CHECK(entry);
240 CHECK(std::string::npos != entry->name.find("test_sampler_api_inner")); 240 CHECK(std::string::npos != entry->name.find("test_sampler_api_inner"));
241 241
242 entry = helper.FindEventEntry(sample.begin()[1]); 242 entry = helper.FindEventEntry(sample.begin()[1]);
243 CHECK_NE(NULL, entry); 243 CHECK(entry);
244 CHECK(std::string::npos != entry->name.find("test_sampler_api_outer")); 244 CHECK(std::string::npos != entry->name.find("test_sampler_api_outer"));
245 } 245 }
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