OLD | NEW |
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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 const int kMaxCheckDepth = 30; | 3077 const int kMaxCheckDepth = 30; |
3078 | 3078 |
3079 // Sentinel for {TryLoadDynamicVariable} disabling inline checks. | 3079 // Sentinel for {TryLoadDynamicVariable} disabling inline checks. |
3080 const uint32_t kFullCheckRequired = -1; | 3080 const uint32_t kFullCheckRequired = -1; |
3081 | 3081 |
3082 } // namespace | 3082 } // namespace |
3083 | 3083 |
3084 | 3084 |
3085 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { | 3085 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { |
3086 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); | 3086 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); |
3087 bool found_eval_scope = false; | |
3088 uint32_t check_depths = 0; | 3087 uint32_t check_depths = 0; |
3089 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { | 3088 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { |
3090 if (s->num_heap_slots() <= 0) continue; | 3089 if (s->num_heap_slots() <= 0) continue; |
3091 // TODO(mstarzinger): If we have reached an eval scope, we check all | 3090 if (!s->calls_sloppy_eval()) continue; |
3092 // extensions from this point. Replicated from full-codegen, figure out | |
3093 // whether this is still needed. If not, drop {found_eval_scope} below. | |
3094 if (s->is_eval_scope()) found_eval_scope = true; | |
3095 if (!s->calls_sloppy_eval() && !found_eval_scope) continue; | |
3096 int depth = current_scope()->ContextChainLength(s); | 3091 int depth = current_scope()->ContextChainLength(s); |
3097 if (depth > kMaxCheckDepth) return kFullCheckRequired; | 3092 if (depth > kMaxCheckDepth) return kFullCheckRequired; |
3098 check_depths |= 1 << depth; | 3093 check_depths |= 1 << depth; |
3099 } | 3094 } |
3100 return check_depths; | 3095 return check_depths; |
3101 } | 3096 } |
3102 | 3097 |
3103 | 3098 |
3104 uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) { | 3099 uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) { |
3105 DCHECK_EQ(DYNAMIC_LOCAL, variable->mode()); | 3100 DCHECK_EQ(DYNAMIC_LOCAL, variable->mode()); |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4330 // Phi does not exist yet, introduce one. | 4325 // Phi does not exist yet, introduce one. |
4331 value = NewPhi(inputs, value, control); | 4326 value = NewPhi(inputs, value, control); |
4332 value->ReplaceInput(inputs - 1, other); | 4327 value->ReplaceInput(inputs - 1, other); |
4333 } | 4328 } |
4334 return value; | 4329 return value; |
4335 } | 4330 } |
4336 | 4331 |
4337 } // namespace compiler | 4332 } // namespace compiler |
4338 } // namespace internal | 4333 } // namespace internal |
4339 } // namespace v8 | 4334 } // namespace v8 |
OLD | NEW |