| 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 3312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3323 Node* the_hole = jsgraph()->TheHoleConstant(); | 3323 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 3324 VariableMode mode = variable->mode(); | 3324 VariableMode mode = variable->mode(); |
| 3325 switch (variable->location()) { | 3325 switch (variable->location()) { |
| 3326 case VariableLocation::GLOBAL: | 3326 case VariableLocation::GLOBAL: |
| 3327 case VariableLocation::UNALLOCATED: { | 3327 case VariableLocation::UNALLOCATED: { |
| 3328 // Global var, const, or let variable. | 3328 // Global var, const, or let variable. |
| 3329 Node* script_context = current_context(); | 3329 Node* script_context = current_context(); |
| 3330 int slot_index = -1; | 3330 int slot_index = -1; |
| 3331 if (variable->index() > 0) { | 3331 if (variable->index() > 0) { |
| 3332 DCHECK(variable->IsStaticGlobalObjectProperty()); | 3332 DCHECK(variable->IsStaticGlobalObjectProperty()); |
| 3333 // Each var occupies two slots in the context: for reads and writes. | |
| 3334 slot_index = variable->index(); | 3333 slot_index = variable->index(); |
| 3335 int depth = current_scope()->ContextChainLength(variable->scope()); | 3334 int depth = current_scope()->ContextChainLength(variable->scope()); |
| 3336 if (depth > 0) { | 3335 if (depth > 0) { |
| 3337 const Operator* op = javascript()->LoadContext( | 3336 const Operator* op = javascript()->LoadContext( |
| 3338 depth - 1, Context::PREVIOUS_INDEX, true); | 3337 depth - 1, Context::PREVIOUS_INDEX, true); |
| 3339 script_context = NewNode(op, current_context()); | 3338 script_context = NewNode(op, current_context()); |
| 3340 } | 3339 } |
| 3341 } | 3340 } |
| 3342 Node* global = BuildLoadGlobalObject(); | 3341 Node* global = BuildLoadGlobalObject(); |
| 3343 Handle<Name> name = variable->name(); | 3342 Handle<Name> name = variable->name(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3474 Node* the_hole = jsgraph()->TheHoleConstant(); | 3473 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 3475 VariableMode mode = variable->mode(); | 3474 VariableMode mode = variable->mode(); |
| 3476 switch (variable->location()) { | 3475 switch (variable->location()) { |
| 3477 case VariableLocation::GLOBAL: | 3476 case VariableLocation::GLOBAL: |
| 3478 case VariableLocation::UNALLOCATED: { | 3477 case VariableLocation::UNALLOCATED: { |
| 3479 // Global var, const, or let variable. | 3478 // Global var, const, or let variable. |
| 3480 Node* script_context = current_context(); | 3479 Node* script_context = current_context(); |
| 3481 int slot_index = -1; | 3480 int slot_index = -1; |
| 3482 if (variable->index() > 0) { | 3481 if (variable->index() > 0) { |
| 3483 DCHECK(variable->IsStaticGlobalObjectProperty()); | 3482 DCHECK(variable->IsStaticGlobalObjectProperty()); |
| 3484 // Each var occupies two slots in the context: for reads and writes. | |
| 3485 slot_index = variable->index(); | 3483 slot_index = variable->index(); |
| 3486 int depth = current_scope()->ContextChainLength(variable->scope()); | 3484 int depth = current_scope()->ContextChainLength(variable->scope()); |
| 3487 if (depth > 0) { | 3485 if (depth > 0) { |
| 3488 const Operator* op = javascript()->LoadContext( | 3486 const Operator* op = javascript()->LoadContext( |
| 3489 depth - 1, Context::PREVIOUS_INDEX, true); | 3487 depth - 1, Context::PREVIOUS_INDEX, true); |
| 3490 script_context = NewNode(op, current_context()); | 3488 script_context = NewNode(op, current_context()); |
| 3491 } | 3489 } |
| 3492 } | 3490 } |
| 3493 Node* global = BuildLoadGlobalObject(); | 3491 Node* global = BuildLoadGlobalObject(); |
| 3494 Handle<Name> name = variable->name(); | 3492 Handle<Name> name = variable->name(); |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 // Phi does not exist yet, introduce one. | 4310 // Phi does not exist yet, introduce one. |
| 4313 value = NewPhi(inputs, value, control); | 4311 value = NewPhi(inputs, value, control); |
| 4314 value->ReplaceInput(inputs - 1, other); | 4312 value->ReplaceInput(inputs - 1, other); |
| 4315 } | 4313 } |
| 4316 return value; | 4314 return value; |
| 4317 } | 4315 } |
| 4318 | 4316 |
| 4319 } // namespace compiler | 4317 } // namespace compiler |
| 4320 } // namespace internal | 4318 } // namespace internal |
| 4321 } // namespace v8 | 4319 } // namespace v8 |
| OLD | NEW |