Commit 537e89a3 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

Fix eval cache with --harmony-function-tostring

The code was using the "correct" cache key for lookups, but not for
creating new entries, leading to us never hitting the cache for
some Function-constructor cases.

Bug: v8:4958, chromium:801556, chromium:802400, chromium:807192
Change-Id: I4ac2234b97a9f5f71957ef936dc4b588d020916b
Reviewed-on: https://chromium-review.googlesource.com/898096Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51081}
parent ebeef1fc
...@@ -1063,17 +1063,16 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( ...@@ -1063,17 +1063,16 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
// is unused (just 0), which means it's an available field to use to indicate // is unused (just 0), which means it's an available field to use to indicate
// this separation. But to make sure we're not causing other false hits, we // this separation. But to make sure we're not causing other false hits, we
// negate the scope position. // negate the scope position.
int position = eval_scope_position;
if (FLAG_harmony_function_tostring && if (FLAG_harmony_function_tostring &&
restriction == ONLY_SINGLE_FUNCTION_LITERAL && restriction == ONLY_SINGLE_FUNCTION_LITERAL &&
parameters_end_pos != kNoSourcePosition) { parameters_end_pos != kNoSourcePosition) {
// use the parameters_end_pos as the eval_scope_position in the eval cache. // use the parameters_end_pos as the eval_scope_position in the eval cache.
DCHECK_EQ(eval_scope_position, 0); DCHECK_EQ(eval_scope_position, 0);
position = -parameters_end_pos; eval_scope_position = -parameters_end_pos;
} }
CompilationCache* compilation_cache = isolate->compilation_cache(); CompilationCache* compilation_cache = isolate->compilation_cache();
InfoVectorPair eval_result = compilation_cache->LookupEval( InfoVectorPair eval_result = compilation_cache->LookupEval(
source, outer_info, context, language_mode, position); source, outer_info, context, language_mode, eval_scope_position);
Handle<Cell> vector; Handle<Cell> vector;
if (eval_result.has_vector()) { if (eval_result.has_vector()) {
vector = Handle<Cell>(eval_result.vector(), isolate); vector = Handle<Cell>(eval_result.vector(), isolate);
......
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