Revision: 16737
Author: [email protected]
Date: Mon Sep 16 14:50:01 2013 UTC
Log: Don't lookup the cache for the result of Function::New
Since isFunctionCached condition is wrong, we lookup the cache even if
doNotCache is true. As a result, Function::New always returns null
except for the first time.
BUG=272579
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/23513048
Patch from Yusuke Suzuki <[email protected]>.
http://code.google.com/p/v8/source/detail?r=16737
Modified:
/branches/bleeding_edge/src/apinatives.js
/branches/bleeding_edge/test/cctest/test-api.cc
=======================================
--- /branches/bleeding_edge/src/apinatives.js Mon Sep 9 07:52:52 2013 UTC
+++ /branches/bleeding_edge/src/apinatives.js Mon Sep 16 14:50:01 2013 UTC
@@ -71,7 +71,6 @@
(serialNumber in cache) && (cache[serialNumber] != kUninitialized);
if (!isFunctionCached) {
try {
- cache[serialNumber] = null;
var fun = %CreateApiFunction(data);
if (name) %FunctionSetName(fun, name);
var flags = %GetTemplateField(data, kApiFlagOffset);
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Thu Sep 12 08:57:10
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Sep 16 14:50:01
2013 UTC
@@ -20584,6 +20584,15 @@
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());
+ CHECK(elm->IsUndefined());
+ // Verify that each Function::New creates a new function instance
+ Local<Object> data2 = v8::Object::New();
+ function_new_expected_env = data2;
+ Local<Function> func2 = Function::New(isolate, FunctionNewCallback,
data2);
+ CHECK(!func2->IsNull());
+ CHECK_NE(func, func2);
+ env->Global()->Set(v8_str("func2"), func2);
+ Local<Value> result2 = CompileRun("func2();");
+ CHECK_EQ(v8::Integer::New(17, isolate), result2);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.