| 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/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 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3007 | 3007 |
| 3008 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair( | 3008 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair( |
| 3009 FeedbackVectorICSlot slot) const { | 3009 FeedbackVectorICSlot slot) const { |
| 3010 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot); | 3010 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot); |
| 3011 } | 3011 } |
| 3012 | 3012 |
| 3013 | 3013 |
| 3014 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { | 3014 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { |
| 3015 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); | 3015 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); |
| 3016 bool found_eval_scope = false; | 3016 bool found_eval_scope = false; |
| 3017 EnumSet<int, uint32_t> check_depths; | 3017 uint32_t check_depths = 0; |
| 3018 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { | 3018 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { |
| 3019 if (s->num_heap_slots() <= 0) continue; | 3019 if (s->num_heap_slots() <= 0) continue; |
| 3020 // TODO(mstarzinger): If we have reached an eval scope, we check all | 3020 // TODO(mstarzinger): If we have reached an eval scope, we check all |
| 3021 // extensions from this point. Replicated from full-codegen, figure out | 3021 // extensions from this point. Replicated from full-codegen, figure out |
| 3022 // whether this is still needed. If not, drop {found_eval_scope} below. | 3022 // whether this is still needed. If not, drop {found_eval_scope} below. |
| 3023 if (s->is_eval_scope()) found_eval_scope = true; | 3023 if (s->is_eval_scope()) found_eval_scope = true; |
| 3024 if (!s->calls_sloppy_eval() && !found_eval_scope) continue; | 3024 if (!s->calls_sloppy_eval() && !found_eval_scope) continue; |
| 3025 int depth = current_scope()->ContextChainLength(s); | 3025 int depth = current_scope()->ContextChainLength(s); |
| 3026 if (depth > DynamicGlobalAccess::kMaxCheckDepth) { | 3026 if (depth > DynamicGlobalAccess::kMaxCheckDepth) { |
| 3027 return DynamicGlobalAccess::kFullCheckRequired; | 3027 return DynamicGlobalAccess::kFullCheckRequired; |
| 3028 } | 3028 } |
| 3029 check_depths.Add(depth); | 3029 check_depths |= 1 << depth; |
| 3030 } | 3030 } |
| 3031 return check_depths.ToIntegral(); | 3031 return check_depths; |
| 3032 } | 3032 } |
| 3033 | 3033 |
| 3034 | 3034 |
| 3035 uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) { | 3035 uint32_t AstGraphBuilder::ComputeBitsetForDynamicContext(Variable* variable) { |
| 3036 DCHECK_EQ(DYNAMIC_LOCAL, variable->mode()); | 3036 DCHECK_EQ(DYNAMIC_LOCAL, variable->mode()); |
| 3037 EnumSet<int, uint32_t> check_depths; | 3037 uint32_t check_depths = 0; |
| 3038 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { | 3038 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { |
| 3039 if (s->num_heap_slots() <= 0) continue; | 3039 if (s->num_heap_slots() <= 0) continue; |
| 3040 if (!s->calls_sloppy_eval() && s != variable->scope()) continue; | 3040 if (!s->calls_sloppy_eval() && s != variable->scope()) continue; |
| 3041 int depth = current_scope()->ContextChainLength(s); | 3041 int depth = current_scope()->ContextChainLength(s); |
| 3042 if (depth > DynamicContextAccess::kMaxCheckDepth) { | 3042 if (depth > DynamicContextAccess::kMaxCheckDepth) { |
| 3043 return DynamicContextAccess::kFullCheckRequired; | 3043 return DynamicContextAccess::kFullCheckRequired; |
| 3044 } | 3044 } |
| 3045 check_depths.Add(depth); | 3045 check_depths |= 1 << depth; |
| 3046 if (s == variable->scope()) break; | 3046 if (s == variable->scope()) break; |
| 3047 } | 3047 } |
| 3048 return check_depths.ToIntegral(); | 3048 return check_depths; |
| 3049 } | 3049 } |
| 3050 | 3050 |
| 3051 | 3051 |
| 3052 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { | 3052 Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) { |
| 3053 DCHECK(environment()->stack_height() >= arity); | 3053 DCHECK(environment()->stack_height() >= arity); |
| 3054 Node** all = info()->zone()->NewArray<Node*>(arity); | 3054 Node** all = info()->zone()->NewArray<Node*>(arity); |
| 3055 for (int i = arity - 1; i >= 0; --i) { | 3055 for (int i = arity - 1; i >= 0; --i) { |
| 3056 all[i] = environment()->Pop(); | 3056 all[i] = environment()->Pop(); |
| 3057 } | 3057 } |
| 3058 Node* value = NewNode(op, arity, all); | 3058 Node* value = NewNode(op, arity, all); |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4205 // Phi does not exist yet, introduce one. | 4205 // Phi does not exist yet, introduce one. |
| 4206 value = NewPhi(inputs, value, control); | 4206 value = NewPhi(inputs, value, control); |
| 4207 value->ReplaceInput(inputs - 1, other); | 4207 value->ReplaceInput(inputs - 1, other); |
| 4208 } | 4208 } |
| 4209 return value; | 4209 return value; |
| 4210 } | 4210 } |
| 4211 | 4211 |
| 4212 } // namespace compiler | 4212 } // namespace compiler |
| 4213 } // namespace internal | 4213 } // namespace internal |
| 4214 } // namespace v8 | 4214 } // namespace v8 |
| OLD | NEW |