Index: src/crankshaft/lithium.cc |
diff --git a/src/crankshaft/lithium.cc b/src/crankshaft/lithium.cc |
index a1a73e4beb84042075fdf72be63a93ea8b170a06..3b25081f5527eb4bfe7fd2bd4c57c504b2252cbe 100644 |
--- a/src/crankshaft/lithium.cc |
+++ b/src/crankshaft/lithium.cc |
@@ -522,12 +522,28 @@ LEnvironment* LChunkBuilderBase::CreateEnvironment( |
ZoneList<HValue*>* objects_to_materialize) { |
if (hydrogen_env == NULL) return NULL; |
+ BailoutId ast_id = hydrogen_env->ast_id(); |
+ DCHECK(!ast_id.IsNone() || |
+ (hydrogen_env->frame_type() != JS_FUNCTION && |
+ hydrogen_env->frame_type() != TAIL_CALLER_FUNCTION)); |
+ |
+ if (hydrogen_env->frame_type() == TAIL_CALLER_FUNCTION) { |
+ // Skip potential outer arguments adaptor frame. |
+ HEnvironment* outer_hydrogen_env = hydrogen_env->outer(); |
+ if (outer_hydrogen_env != nullptr && |
+ outer_hydrogen_env->frame_type() == ARGUMENTS_ADAPTOR) { |
+ outer_hydrogen_env = outer_hydrogen_env->outer(); |
+ } |
+ LEnvironment* outer = CreateEnvironment( |
+ outer_hydrogen_env, argument_index_accumulator, objects_to_materialize); |
+ return new (zone()) |
+ LEnvironment(hydrogen_env->closure(), hydrogen_env->frame_type(), |
+ ast_id, 0, 0, 0, outer, hydrogen_env->entry(), zone()); |
+ } |
+ |
LEnvironment* outer = |
CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator, |
objects_to_materialize); |
- BailoutId ast_id = hydrogen_env->ast_id(); |
- DCHECK(!ast_id.IsNone() || |
- hydrogen_env->frame_type() != JS_FUNCTION); |
int omitted_count = (hydrogen_env->frame_type() == JS_FUNCTION) |
? 0 |