| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( | 451 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( |
| 452 FrameStateType::kJavaScriptFunction, info->num_parameters() + 1, | 452 FrameStateType::kJavaScriptFunction, info->num_parameters() + 1, |
| 453 info->scope()->num_stack_slots(), info->shared_info(), | 453 info->scope()->num_stack_slots(), info->shared_info(), |
| 454 CALL_MAINTAINS_NATIVE_CONTEXT)), | 454 CALL_MAINTAINS_NATIVE_CONTEXT)), |
| 455 js_type_feedback_(js_type_feedback) { | 455 js_type_feedback_(js_type_feedback) { |
| 456 InitializeAstVisitor(info->isolate(), local_zone); | 456 InitializeAstVisitor(info->isolate(), local_zone); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 Node* AstGraphBuilder::GetFunctionClosureForContext() { | 460 Node* AstGraphBuilder::GetFunctionClosureForContext() { |
| 461 Scope* declaration_scope = current_scope()->DeclarationScope(); | 461 Scope* closure_scope = current_scope()->ClosureScope(); |
| 462 if (declaration_scope->is_script_scope() || | 462 if (closure_scope->is_script_scope() || |
| 463 declaration_scope->is_module_scope()) { | 463 closure_scope->is_module_scope()) { |
| 464 // Contexts nested in the native context have a canonical empty function as | 464 // Contexts nested in the native context have a canonical empty function as |
| 465 // their closure, not the anonymous closure containing the global code. | 465 // their closure, not the anonymous closure containing the global code. |
| 466 // Pass a SMI sentinel and let the runtime look up the empty function. | 466 // Pass a SMI sentinel and let the runtime look up the empty function. |
| 467 return jsgraph()->SmiConstant(0); | 467 return jsgraph()->SmiConstant(0); |
| 468 } else { | 468 } else { |
| 469 DCHECK(declaration_scope->is_function_scope()); | 469 DCHECK(closure_scope->is_function_scope()); |
| 470 return GetFunctionClosure(); | 470 return GetFunctionClosure(); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 | 473 |
| 474 | 474 |
| 475 Node* AstGraphBuilder::GetFunctionClosure() { | 475 Node* AstGraphBuilder::GetFunctionClosure() { |
| 476 if (!function_closure_.is_set()) { | 476 if (!function_closure_.is_set()) { |
| 477 const Operator* op = common()->Parameter( | 477 const Operator* op = common()->Parameter( |
| 478 Linkage::kJSFunctionCallClosureParamIndex, "%closure"); | 478 Linkage::kJSFunctionCallClosureParamIndex, "%closure"); |
| 479 Node* node = NewNode(op, graph()->start()); | 479 Node* node = NewNode(op, graph()->start()); |
| (...skipping 3832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 // Phi does not exist yet, introduce one. | 4312 // Phi does not exist yet, introduce one. |
| 4313 value = NewPhi(inputs, value, control); | 4313 value = NewPhi(inputs, value, control); |
| 4314 value->ReplaceInput(inputs - 1, other); | 4314 value->ReplaceInput(inputs - 1, other); |
| 4315 } | 4315 } |
| 4316 return value; | 4316 return value; |
| 4317 } | 4317 } |
| 4318 | 4318 |
| 4319 } // namespace compiler | 4319 } // namespace compiler |
| 4320 } // namespace internal | 4320 } // namespace internal |
| 4321 } // namespace v8 | 4321 } // namespace v8 |
| OLD | NEW |