Reviewers: Igor Sheludko, ulan,
Message:
PTAL
Description:
Properly handle non-JSFunction constructors in CanRetainOtherContext
BUG=
Please review this at https://codereview.chromium.org/1017263003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -9 lines):
M src/type-info.cc
A + test/mjsunit/regress/regress-filter-contexts.js
Index: src/type-info.cc
diff --git a/src/type-info.cc b/src/type-info.cc
index
48d516019911b6aaffdba9fe9ce4204f82499dd0..7e1d6011d0e82ad1a26cc47c272567a7c87cc3d0
100644
--- a/src/type-info.cc
+++ b/src/type-info.cc
@@ -438,6 +438,9 @@ bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
}
constructor = map->GetConstructor();
if (constructor->IsNull()) return false;
+ // If the constructor is not null or a JSFunction, we have to
conservatively
+ // assume that it may retain a native context.
+ if (!constructor->IsJSFunction()) return true;
JSFunction* function = JSFunction::cast(constructor);
return CanRetainOtherContext(function, native_context);
}
Index: test/mjsunit/regress/regress-filter-contexts.js
diff --git a/test/mjsunit/regress/regress-449291.js
b/test/mjsunit/regress/regress-filter-contexts.js
similarity index 67%
copy from test/mjsunit/regress/regress-449291.js
copy to test/mjsunit/regress/regress-filter-contexts.js
index
fb56027b67f3f176f1432c11b39075aec6cc8429..d2abe0032548428324afd6675a7031bf53a5e56e
100644
--- a/test/mjsunit/regress/regress-449291.js
+++ b/test/mjsunit/regress/regress-filter-contexts.js
@@ -4,16 +4,11 @@
// Flags: --allow-natives-syntax
-a = {y:1.5};
-a.y = 1093445778;
-b = a.y;
-c = {y:{}};
-
-function f() {
- return {y: b};
-}
+function f() { return f.x; }
+f.__proto__ = null;
+f.prototype = "";
f();
f();
%OptimizeFunctionOnNextCall(f);
-assertEquals(f().y, 1093445778);
+f();
--
--
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/d/optout.