| 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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 3341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3352 value = BuildThrowReferenceError(variable, bailout_id); | 3352 value = BuildThrowReferenceError(variable, bailout_id); |
| 3353 } else if (value->opcode() == IrOpcode::kPhi) { | 3353 } else if (value->opcode() == IrOpcode::kPhi) { |
| 3354 value = BuildHoleCheckThenThrow(value, variable, value, bailout_id); | 3354 value = BuildHoleCheckThenThrow(value, variable, value, bailout_id); |
| 3355 } | 3355 } |
| 3356 } | 3356 } |
| 3357 return value; | 3357 return value; |
| 3358 } | 3358 } |
| 3359 case VariableLocation::CONTEXT: { | 3359 case VariableLocation::CONTEXT: { |
| 3360 // Context variable (potentially up the context chain). | 3360 // Context variable (potentially up the context chain). |
| 3361 int depth = current_scope()->ContextChainLength(variable->scope()); | 3361 int depth = current_scope()->ContextChainLength(variable->scope()); |
| 3362 bool immutable = variable->maybe_assigned() == kNotAssigned; | 3362 // TODO(mstarzinger): The {maybe_assigned} flag computed during variable |
| 3363 // resolution is highly inaccurate and cannot be trusted. We are only |
| 3364 // taking this information into account when asm.js compilation is used. |
| 3365 bool immutable = variable->maybe_assigned() == kNotAssigned && |
| 3366 info()->is_function_context_specializing(); |
| 3363 const Operator* op = | 3367 const Operator* op = |
| 3364 javascript()->LoadContext(depth, variable->index(), immutable); | 3368 javascript()->LoadContext(depth, variable->index(), immutable); |
| 3365 Node* value = NewNode(op, current_context()); | 3369 Node* value = NewNode(op, current_context()); |
| 3366 // TODO(titzer): initialization checks are redundant for already | 3370 // TODO(titzer): initialization checks are redundant for already |
| 3367 // initialized immutable context loads, but only specialization knows. | 3371 // initialized immutable context loads, but only specialization knows. |
| 3368 // Maybe specializer should be a parameter to the graph builder? | 3372 // Maybe specializer should be a parameter to the graph builder? |
| 3369 if (variable->binding_needs_init()) { | 3373 if (variable->binding_needs_init()) { |
| 3370 // Perform check for uninitialized let/const variables. | 3374 // Perform check for uninitialized let/const variables. |
| 3371 value = BuildHoleCheckThenThrow(value, variable, value, bailout_id); | 3375 value = BuildHoleCheckThenThrow(value, variable, value, bailout_id); |
| 3372 } | 3376 } |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4355 // Phi does not exist yet, introduce one. | 4359 // Phi does not exist yet, introduce one. |
| 4356 value = NewPhi(inputs, value, control); | 4360 value = NewPhi(inputs, value, control); |
| 4357 value->ReplaceInput(inputs - 1, other); | 4361 value->ReplaceInput(inputs - 1, other); |
| 4358 } | 4362 } |
| 4359 return value; | 4363 return value; |
| 4360 } | 4364 } |
| 4361 | 4365 |
| 4362 } // namespace compiler | 4366 } // namespace compiler |
| 4363 } // namespace internal | 4367 } // namespace internal |
| 4364 } // namespace v8 | 4368 } // namespace v8 |
| OLD | NEW |