[deoptimizer] Add support for materializing Generator objects.
This adds support for materializing objects of {JSGeneratorObject} type during deoptimization. Cases where soft-deopts remove any escaping use of the implicit generator object can cause it to be escape analyzed. R=jarin@chromium.org TEST=mjsunit/regress/regress-crbug-732169 BUG=chromium:732169 Change-Id: I2ec10b2a509a4f37a456a8ca2fd74b8de2fb55be Reviewed-on: https://chromium-review.googlesource.com/530847 Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#45849}
This commit is contained in:
parent
f6c8ba8bed
commit
f555a6922d
@ -4442,6 +4442,30 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
|
||||
object->set_bound_arguments(FixedArray::cast(*bound_arguments));
|
||||
return object;
|
||||
}
|
||||
case JS_GENERATOR_OBJECT_TYPE: {
|
||||
Handle<JSGeneratorObject> object = Handle<JSGeneratorObject>::cast(
|
||||
isolate_->factory()->NewJSObjectFromMap(map, NOT_TENURED));
|
||||
slot->value_ = object;
|
||||
Handle<Object> properties = materializer.FieldAt(value_index);
|
||||
Handle<Object> elements = materializer.FieldAt(value_index);
|
||||
Handle<Object> function = materializer.FieldAt(value_index);
|
||||
Handle<Object> context = materializer.FieldAt(value_index);
|
||||
Handle<Object> receiver = materializer.FieldAt(value_index);
|
||||
Handle<Object> input_or_debug_pos = materializer.FieldAt(value_index);
|
||||
Handle<Object> resume_mode = materializer.FieldAt(value_index);
|
||||
Handle<Object> continuation_offset = materializer.FieldAt(value_index);
|
||||
Handle<Object> register_file = materializer.FieldAt(value_index);
|
||||
object->set_properties(FixedArray::cast(*properties));
|
||||
object->set_elements(FixedArrayBase::cast(*elements));
|
||||
object->set_function(JSFunction::cast(*function));
|
||||
object->set_context(Context::cast(*context));
|
||||
object->set_receiver(*receiver);
|
||||
object->set_input_or_debug_pos(*input_or_debug_pos);
|
||||
object->set_resume_mode(Smi::cast(*resume_mode)->value());
|
||||
object->set_continuation(Smi::cast(*continuation_offset)->value());
|
||||
object->set_register_file(FixedArray::cast(*register_file));
|
||||
return object;
|
||||
}
|
||||
case CONS_STRING_TYPE: {
|
||||
Handle<ConsString> object = Handle<ConsString>::cast(
|
||||
isolate_->factory()
|
||||
@ -4544,7 +4568,6 @@ Handle<Object> TranslatedState::MaterializeCapturedObjectAt(
|
||||
case JS_MESSAGE_OBJECT_TYPE:
|
||||
case JS_DATE_TYPE:
|
||||
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
|
||||
case JS_GENERATOR_OBJECT_TYPE:
|
||||
case JS_ASYNC_GENERATOR_OBJECT_TYPE:
|
||||
case JS_MODULE_NAMESPACE_TYPE:
|
||||
case JS_ARRAY_BUFFER_TYPE:
|
||||
|
14
test/mjsunit/regress/regress-crbug-732169.js
Normal file
14
test/mjsunit/regress/regress-crbug-732169.js
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
function* f([x]) { yield x }
|
||||
// No warm-up of {f} to trigger soft deopt.
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
var gen = f([23]);
|
||||
|
||||
assertEquals("[object Generator]", gen.toString());
|
||||
assertEquals({ done:false, value:23 }, gen.next());
|
||||
assertEquals({ done:true, value:undefined }, gen.next());
|
Loading…
Reference in New Issue
Block a user