| OLD | NEW |
| 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/api.h" |
| 7 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 8 #include "src/vm-state.h" | 9 #include "src/vm-state.h" |
| 9 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
| 10 | 11 |
| 11 template <typename T> | 12 template <typename T> |
| 12 static void CheckReturnValue(const T& t, i::Address callback) { | 13 static void CheckReturnValue(const T& t, i::Address callback) { |
| 13 v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); | 14 v8::ReturnValue<v8::Value> rv = t.GetReturnValue(); |
| 14 i::Object** o = *reinterpret_cast<i::Object***>(&rv); | 15 i::Object** o = *reinterpret_cast<i::Object***>(&rv); |
| 15 CHECK_EQ(CcTest::isolate(), t.GetIsolate()); | 16 CHECK_EQ(CcTest::isolate(), t.GetIsolate()); |
| 16 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate()); | 17 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(t.GetIsolate()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 CHECK((*o)->IsTheHole(isolate) || (*o)->IsUndefined(isolate)); | 31 CHECK((*o)->IsTheHole(isolate) || (*o)->IsUndefined(isolate)); |
| 31 CHECK_EQ(is_runtime, (*o)->IsTheHole(isolate)); | 32 CHECK_EQ(is_runtime, (*o)->IsTheHole(isolate)); |
| 32 // If CPU profiler is active check that when API callback is invoked | 33 // If CPU profiler is active check that when API callback is invoked |
| 33 // VMState is set to EXTERNAL. | 34 // VMState is set to EXTERNAL. |
| 34 if (isolate->is_profiling()) { | 35 if (isolate->is_profiling()) { |
| 35 CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state()); | 36 CHECK_EQ(v8::EXTERNAL, isolate->current_vm_state()); |
| 36 CHECK(isolate->external_callback_scope()); | 37 CHECK(isolate->external_callback_scope()); |
| 37 CHECK_EQ(callback, isolate->external_callback_scope()->callback()); | 38 CHECK_EQ(callback, isolate->external_callback_scope()->callback()); |
| 38 } | 39 } |
| 39 } | 40 } |
| OLD | NEW |