Commit a9b9c7ab authored by bmeurer's avatar bmeurer Committed by Commit Bot

[objects] Relax JSBoundFunction verification.

The heap verifier does certain invariant checks on JSBoundFunction
objects, i.e. it assumes that the bound_target_function is a proper
JSReceiver. The Deoptimizer cannot maintain this invariant, because it
first allocates the JSBoundFunction in an invalid state and only
afterwards fix up the state. But the GC (and thus the heap verifier)
can observe this invalid state why materializing field values, so
we need to relax the verification slightly.

BUG=chromium:729573,chromium:732176
R=mstarzinger@chromium.org

Review-Url: https://codereview.chromium.org/2933283002
Cr-Commit-Position: refs/heads/master@{#45988}
parent 8a32788f
...@@ -687,11 +687,14 @@ void JSBoundFunction::JSBoundFunctionVerify() { ...@@ -687,11 +687,14 @@ void JSBoundFunction::JSBoundFunctionVerify() {
VerifyObjectField(kBoundThisOffset); VerifyObjectField(kBoundThisOffset);
VerifyObjectField(kBoundTargetFunctionOffset); VerifyObjectField(kBoundTargetFunctionOffset);
VerifyObjectField(kBoundArgumentsOffset); VerifyObjectField(kBoundArgumentsOffset);
CHECK(bound_target_function()->IsCallable());
CHECK(IsCallable()); CHECK(IsCallable());
CHECK_EQ(IsConstructor(), bound_target_function()->IsConstructor());
}
Isolate* const isolate = GetIsolate();
if (!raw_bound_target_function()->IsUndefined(isolate)) {
CHECK(bound_target_function()->IsCallable());
CHECK_EQ(IsConstructor(), bound_target_function()->IsConstructor());
}
}
void JSFunction::JSFunctionVerify() { void JSFunction::JSFunctionVerify() {
CHECK(IsJSFunction()); CHECK(IsJSFunction());
......
...@@ -4505,6 +4505,9 @@ Handle<Map> Map::CopyInitialMap(Handle<Map> map) { ...@@ -4505,6 +4505,9 @@ Handle<Map> Map::CopyInitialMap(Handle<Map> map) {
map->unused_property_fields()); map->unused_property_fields());
} }
Object* JSBoundFunction::raw_bound_target_function() const {
return READ_FIELD(this, kBoundTargetFunctionOffset);
}
ACCESSORS(JSBoundFunction, bound_target_function, JSReceiver, ACCESSORS(JSBoundFunction, bound_target_function, JSReceiver,
kBoundTargetFunctionOffset) kBoundTargetFunctionOffset)
......
...@@ -4947,6 +4947,7 @@ class Module : public Struct { ...@@ -4947,6 +4947,7 @@ class Module : public Struct {
class JSBoundFunction : public JSObject { class JSBoundFunction : public JSObject {
public: public:
// [bound_target_function]: The wrapped function object. // [bound_target_function]: The wrapped function object.
inline Object* raw_bound_target_function() const;
DECL_ACCESSORS(bound_target_function, JSReceiver) DECL_ACCESSORS(bound_target_function, JSReceiver)
// [bound_this]: The value that is always passed as the this value when // [bound_this]: The value that is always passed as the this value when
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment