Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1150723005: [turbofan] Optimized lowering of DYNAMIC_GLOBAL lookup slot loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 2742
2743 2743
2744 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair( 2744 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair(
2745 FeedbackVectorICSlot slot) const { 2745 FeedbackVectorICSlot slot) const {
2746 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot); 2746 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot);
2747 } 2747 }
2748 2748
2749 2749
2750 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { 2750 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) {
2751 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); 2751 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode());
2752 bool found_eval_scope = false;
2752 EnumSet<int, uint32_t> check_depths; 2753 EnumSet<int, uint32_t> check_depths;
2753 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { 2754 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) {
2754 if (s->num_heap_slots() <= 0) continue; 2755 if (s->num_heap_slots() <= 0) continue;
2755 // TODO(mstarzinger): Be smarter about which checks to require! 2756 // TODO(mstarzinger): If we have reached an eval scope, we check all
2757 // extensions from this point. Replicated from full-codegen, figure out
2758 // whether this is still needed. If not, drop {found_eval_scope} below.
2759 if (s->is_eval_scope()) found_eval_scope = true;
2760 if (!s->calls_sloppy_eval() && !found_eval_scope) continue;
2756 int depth = current_scope()->ContextChainLength(s); 2761 int depth = current_scope()->ContextChainLength(s);
2757 if (depth > DynamicGlobalAccess::kMaxCheckDepth) { 2762 if (depth > DynamicGlobalAccess::kMaxCheckDepth) {
2758 return DynamicGlobalAccess::kFullCheckRequired; 2763 return DynamicGlobalAccess::kFullCheckRequired;
2759 } 2764 }
2760 check_depths.Add(depth); 2765 check_depths.Add(depth);
2761 } 2766 }
2762 return check_depths.ToIntegral(); 2767 return check_depths.ToIntegral();
2763 } 2768 }
2764 2769
2765 2770
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3015 value = BuildHoleCheckThrow(value, variable, value, bailout_id); 3020 value = BuildHoleCheckThrow(value, variable, value, bailout_id);
3016 } 3021 }
3017 return value; 3022 return value;
3018 } 3023 }
3019 case Variable::LOOKUP: { 3024 case Variable::LOOKUP: {
3020 // Dynamic lookup of context variable (anywhere in the chain). 3025 // Dynamic lookup of context variable (anywhere in the chain).
3021 Node* value = jsgraph()->TheHoleConstant(); 3026 Node* value = jsgraph()->TheHoleConstant();
3022 Handle<String> name = variable->name(); 3027 Handle<String> name = variable->name();
3023 if (mode == DYNAMIC_GLOBAL) { 3028 if (mode == DYNAMIC_GLOBAL) {
3024 uint32_t check_bitset = ComputeBitsetForDynamicGlobal(variable); 3029 uint32_t check_bitset = ComputeBitsetForDynamicGlobal(variable);
3025 const Operator* op = javascript()->LoadDynamicGlobal(name, check_bitset, 3030 const Operator* op = javascript()->LoadDynamicGlobal(
3026 contextual_mode); 3031 name, check_bitset, feedback, contextual_mode);
3027 value = NewNode(op, current_context()); 3032 value = NewNode(op, current_context());
3033 states.AddToNode(value, bailout_id, combine);
3028 } else if (mode == DYNAMIC_LOCAL) { 3034 } else if (mode == DYNAMIC_LOCAL) {
3029 Variable* local = variable->local_if_not_shadowed(); 3035 Variable* local = variable->local_if_not_shadowed();
3030 DCHECK(local->location() == Variable::CONTEXT); // Must be context. 3036 DCHECK(local->location() == Variable::CONTEXT); // Must be context.
3031 int depth = current_scope()->ContextChainLength(local->scope()); 3037 int depth = current_scope()->ContextChainLength(local->scope());
3032 uint32_t check_bitset = ComputeBitsetForDynamicContext(variable); 3038 uint32_t check_bitset = ComputeBitsetForDynamicContext(variable);
3033 const Operator* op = javascript()->LoadDynamicContext( 3039 const Operator* op = javascript()->LoadDynamicContext(
3034 name, check_bitset, depth, local->index()); 3040 name, check_bitset, depth, local->index());
3035 value = NewNode(op, current_context()); 3041 value = NewNode(op, current_context());
3042 PrepareFrameState(value, bailout_id, combine);
3036 // TODO(mstarzinger): Hole checks are missing here when optimized. 3043 // TODO(mstarzinger): Hole checks are missing here when optimized.
3037 } else if (mode == DYNAMIC) { 3044 } else if (mode == DYNAMIC) {
3038 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired; 3045 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired;
3039 const Operator* op = javascript()->LoadDynamicGlobal(name, check_bitset, 3046 const Operator* op = javascript()->LoadDynamicGlobal(
3040 contextual_mode); 3047 name, check_bitset, feedback, contextual_mode);
3041 value = NewNode(op, current_context()); 3048 value = NewNode(op, current_context());
3049 states.AddToNode(value, bailout_id, combine);
3042 } 3050 }
3043 PrepareFrameState(value, bailout_id, combine);
3044 return value; 3051 return value;
3045 } 3052 }
3046 } 3053 }
3047 UNREACHABLE(); 3054 UNREACHABLE();
3048 return NULL; 3055 return NULL;
3049 } 3056 }
3050 3057
3051 3058
3052 Node* AstGraphBuilder::BuildVariableDelete(Variable* variable, 3059 Node* AstGraphBuilder::BuildVariableDelete(Variable* variable,
3053 BailoutId bailout_id, 3060 BailoutId bailout_id,
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
3772 // Phi does not exist yet, introduce one. 3779 // Phi does not exist yet, introduce one.
3773 value = NewPhi(inputs, value, control); 3780 value = NewPhi(inputs, value, control);
3774 value->ReplaceInput(inputs - 1, other); 3781 value->ReplaceInput(inputs - 1, other);
3775 } 3782 }
3776 return value; 3783 return value;
3777 } 3784 }
3778 3785
3779 } // namespace compiler 3786 } // namespace compiler
3780 } // namespace internal 3787 } // namespace internal
3781 } // namespace v8 3788 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698