Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 0ee53ba8abe69ff385d1f166772ac4cdd00d24d3..b9c5ee1e84d61210c498f3e07f9df5685e36c5a4 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -20038,15 +20038,15 @@ THREADED_TEST(FunctionNew) { |
env->Global()->Set(v8_str("func"), func); |
Local<Value> result = CompileRun("func();"); |
CHECK(v8::Integer::New(isolate, 17)->Equals(result)); |
- // Verify function not cached |
- int serial_number = |
- i::Smi::cast(v8::Utils::OpenHandle(*func) |
- ->shared()->get_api_func_data()->serial_number())->value(); |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
- i::Handle<i::FixedArray> cache(i_isolate->native_context()->function_cache()); |
- if (serial_number < cache->length()) { |
- CHECK(cache->get(serial_number)->IsUndefined()); |
- } |
+ // Verify function not cached |
+ auto serial_number = handle(i::Smi::cast(v8::Utils::OpenHandle(*func) |
+ ->shared() |
+ ->get_api_func_data() |
+ ->serial_number()), |
+ i_isolate); |
+ auto cache = i_isolate->function_cache(); |
+ CHECK(cache->Lookup(serial_number)->IsTheHole()); |
// Verify that each Function::New creates a new function instance |
Local<Object> data2 = v8::Object::New(isolate); |
function_new_expected_env = data2; |