Chromium Code Reviews| Index: test/cctest/test-api.cc |
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
| index 1e572ba95bbecc7ad9f7269bd1a59b984ac7779c..18be6c0e0dae4cebf2482bf8a6d8624173af33bb 100644 |
| --- a/test/cctest/test-api.cc |
| +++ b/test/cctest/test-api.cc |
| @@ -20491,4 +20491,33 @@ THREADED_TEST(CrankshaftInterceptorFieldWrite) { |
| ExpectInt32("obj.interceptor_age", 103); |
| } |
| + |
| +static Local<Value> function_new_expected_env; |
| +static void FunctionNewCallback(const v8::FunctionCallbackInfo<Value>& info) { |
| + CHECK_EQ(function_new_expected_env, info.Data()); |
| + info.GetReturnValue().Set(17); |
| +} |
| + |
| + |
| +THREADED_TEST(FunctionNew) { |
| + LocalContext env; |
| + v8::Isolate* isolate = env->GetIsolate(); |
| + v8::HandleScope scope(isolate); |
| + Local<Object> data = v8::Object::New(); |
| + function_new_expected_env = data; |
| + Local<Function> func = Function::New(isolate, FunctionNewCallback, data); |
| + env->Global()->Set(v8_str("func"), func); |
| + Local<Value> result = CompileRun("func();"); |
| + CHECK_EQ(v8::Integer::New(17, isolate), 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::Object* elm = i_isolate->native_context()->function_cache() |
| + ->GetElementNoExceptionThrown(i_isolate, serial_number); |
| + CHECK(elm->IsNull()); |
| +} |
| + |
| + |
| #endif // V8_OS_POSIX |
|
Michael Starzinger
2013/09/06 14:41:50
I think this #endif was already misplaced before.
dcarney
2013/09/06 17:59:49
when i see a 20,000 line file, I just stick new co
|