From 47d7ae1154bded0b4f3cb4171bbd3152018699ea Mon Sep 17 00:00:00 2001 From: mythria Date: Tue, 5 Jan 2016 07:35:21 -0800 Subject: [PATCH] [Interpreter] Pass correct closure argument when creating block context. After this change, https://codereview.chromium.org/1475383002 we should not pass Smi 0 for a closure and expect runtime to look it up. We should pass the correct argument always. BUG=v8:4280 LOG=N Review URL: https://codereview.chromium.org/1558153002 Cr-Commit-Position: refs/heads/master@{#33117} --- src/interpreter/bytecode-generator.cc | 8 ++++++-- test/test262/test262.status | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc index 5d88574409..c1f946d758 100644 --- a/src/interpreter/bytecode-generator.cc +++ b/src/interpreter/bytecode-generator.cc @@ -2156,8 +2156,12 @@ void BytecodeGenerator::VisitFunctionClosureForContext() { closure_scope->is_module_scope()) { // Contexts nested in the native context have a canonical empty function as // their closure, not the anonymous closure containing the global code. - // Pass a SMI sentinel and let the runtime look up the empty function. - builder()->LoadLiteral(Smi::FromInt(0)); + Register native_context = execution_result()->NewRegister(); + builder() + ->LoadContextSlot(execution_context()->reg(), + Context::NATIVE_CONTEXT_INDEX) + .StoreAccumulatorInRegister(native_context) + .LoadContextSlot(native_context, Context::CLOSURE_INDEX); } else { DCHECK(closure_scope->is_function_scope()); builder()->LoadAccumulatorWithRegister(Register::function_closure()); diff --git a/test/test262/test262.status b/test/test262/test262.status index ea51c41922..b3fc5b7c3d 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -640,7 +640,6 @@ 'language/statements/for-in/let*': [SKIP], 'language/statements/for-of/*': [SKIP], 'language/statements/generators/*': [SKIP], - 'language/statements/let/*': [SKIP], 'language/statements/try/*': [SKIP], 'language/statements/with/*': [SKIP], @@ -676,6 +675,9 @@ 'built-ins/String/prototype/startsWith/this-is-undefined-throws': [SKIP], 'built-ins/String/prototype/trim/15.5.4.20-1-1': [SKIP], 'built-ins/String/S15.5.5.1_A4_T1': [SKIP], + 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1': [SKIP], + 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2': [SKIP], + 'language/block-scope/leave/verify-context-in-labelled-block': [SKIP], 'language/block-scope/leave/x-after-break-to-label': [SKIP], 'language/computed-property-names/object/accessor/getter-super': [SKIP], 'language/computed-property-names/object/accessor/setter-super': [SKIP], @@ -685,6 +687,7 @@ 'language/default-parameters/param-ref-uninitialized': [SKIP], 'language/expressions/delete/11.4.1-4.a-5': [SKIP], 'language/expressions/delete/11.4.1-4.a-6': [SKIP], + 'language/expressions/object/method-definition/name-prop-name-yield-expr': [SKIP], 'language/expressions/object/method-definition/name-super-prop-param': [SKIP], 'language/expressions/object/method-definition/name-super-prop-body': [SKIP], 'language/expressions/object/prop-def-id-eval-error': [SKIP], @@ -718,14 +721,22 @@ 'language/statements/function/S13.2.2_A19_T6': [SKIP], 'language/statements/function/S13.2.2_A19_T7': [SKIP], 'language/statements/function/S13.2.2_A19_T8': [SKIP], - 'language/statements/while/S12.6.2_A4_T5': [SKIP], - 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-1': [SKIP], - 'language/block-scope/leave/nested-block-let-declaration-only-shadows-outer-parameter-value-2': [SKIP], - 'language/block-scope/leave/verify-context-in-labelled-block': [SKIP], - 'language/expressions/object/method-definition/name-prop-name-yield-expr': [SKIP], 'language/statements/function/S13.2.2_A18_T1': [SKIP], 'language/statements/function/S13.2.2_A17_T2': [SKIP], 'language/statements/function/S13.2.2_A17_T3': [SKIP], + 'language/statements/let/block-local-closure-get-before-initialization': [SKIP], + 'language/statements/let/block-local-closure-set-before-initialization': [SKIP], + 'language/statements/let/block-local-use-before-initialization-in-declaration-statement': [SKIP], + 'language/statements/let/block-local-use-before-initialization-in-prior-statement': [SKIP], + 'language/statements/let/function-local-closure-get-before-initialization': [SKIP], + 'language/statements/let/function-local-closure-set-before-initialization': [SKIP], + 'language/statements/let/function-local-use-before-initialization-in-declaration-statement': [SKIP], + 'language/statements/let/function-local-use-before-initialization-in-prior-statement': [SKIP], + 'language/statements/let/global-closure-get-before-initialization': [SKIP], + 'language/statements/let/global-closure-set-before-initialization': [SKIP], + 'language/statements/let/global-use-before-initialization-in-declaration-statement': [SKIP], + 'language/statements/while/S12.6.2_A4_T5': [SKIP], + }], # ignition == True ['ignition == True and (arch == arm or arch == arm64)', {