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

Side by Side Diff: test/cctest/test-api.h

Issue 1356223004: Move heap and CPU profilers into a dedicated directory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebaseline Created 5 years, 2 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 | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-circular-queue.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/cpu-profiler.h"
8 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/profiler/cpu-profiler.h"
9 #include "src/vm-state.h" 9 #include "src/vm-state.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
11 11
12 template <typename T> 12 template <typename T>
13 static void CheckReturnValue(const T& t, i::Address callback) { 13 static void CheckReturnValue(const T& t, i::Address callback) {
14 v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); 14 v8::ReturnValue<v8::Value> rv = t.GetReturnValue();
15 i::Object** o = *reinterpret_cast<i::Object***>(&rv); 15 i::Object** o = *reinterpret_cast<i::Object***>(&rv);
16 CHECK_EQ(CcTest::isolate(), t.GetIsolate()); 16 CHECK_EQ(CcTest::isolate(), t.GetIsolate());
17 CHECK_EQ(t.GetIsolate(), rv.GetIsolate()); 17 CHECK_EQ(t.GetIsolate(), rv.GetIsolate());
18 CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); 18 CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
19 // Verify reset 19 // Verify reset
20 bool is_runtime = (*o)->IsTheHole(); 20 bool is_runtime = (*o)->IsTheHole();
21 rv.Set(true); 21 rv.Set(true);
22 CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined()); 22 CHECK(!(*o)->IsTheHole() && !(*o)->IsUndefined());
23 rv.Set(v8::Local<v8::Object>()); 23 rv.Set(v8::Local<v8::Object>());
24 CHECK((*o)->IsTheHole() || (*o)->IsUndefined()); 24 CHECK((*o)->IsTheHole() || (*o)->IsUndefined());
25 CHECK_EQ(is_runtime, (*o)->IsTheHole()); 25 CHECK_EQ(is_runtime, (*o)->IsTheHole());
26 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate()); 26 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate());
27 // If CPU profiler is active check that when API callback is invoked 27 // If CPU profiler is active check that when API callback is invoked
28 // VMState is set to EXTERNAL. 28 // VMState is set to EXTERNAL.
29 if (isolate->cpu_profiler()->is_profiling()) { 29 if (isolate->cpu_profiler()->is_profiling()) {
30 CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state()); 30 CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state());
31 CHECK(isolate->external_callback_scope()); 31 CHECK(isolate->external_callback_scope());
32 CHECK_EQ(callback, isolate->external_callback_scope()->callback()); 32 CHECK_EQ(callback, isolate->external_callback_scope()->callback());
33 } 33 }
34 } 34 }
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-circular-queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698