| 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 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 | 3642 |
| 3643 | 3643 |
| 3644 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) { | 3644 Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) { |
| 3645 return graph()->NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object, | 3645 return graph()->NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object, |
| 3646 jsgraph()->IntPtrConstant(offset - kHeapObjectTag), | 3646 jsgraph()->IntPtrConstant(offset - kHeapObjectTag), |
| 3647 graph()->start(), graph()->start()); | 3647 graph()->start(), graph()->start()); |
| 3648 } | 3648 } |
| 3649 | 3649 |
| 3650 | 3650 |
| 3651 Node* AstGraphBuilder::BuildLoadGlobalObject() { | 3651 Node* AstGraphBuilder::BuildLoadGlobalObject() { |
| 3652 return BuildLoadNativeContextField(Context::EXTENSION_INDEX); | 3652 const Operator* load_op = |
| 3653 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true); |
| 3654 return NewNode(load_op, GetFunctionContext()); |
| 3653 } | 3655 } |
| 3654 | 3656 |
| 3655 | 3657 |
| 3656 Node* AstGraphBuilder::BuildLoadNativeContextField(int index) { | 3658 Node* AstGraphBuilder::BuildLoadNativeContextField(int index) { |
| 3657 const Operator* op = | 3659 Node* global = BuildLoadGlobalObject(); |
| 3658 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true); | 3660 Node* native_context = NewNode(javascript()->LoadNativeContext(), global); |
| 3659 Node* native_context = NewNode(op, current_context()); | |
| 3660 return NewNode(javascript()->LoadContext(0, index, true), native_context); | 3661 return NewNode(javascript()->LoadContext(0, index, true), native_context); |
| 3661 } | 3662 } |
| 3662 | 3663 |
| 3663 | 3664 |
| 3664 Node* AstGraphBuilder::BuildLoadFeedbackVector() { | 3665 Node* AstGraphBuilder::BuildLoadFeedbackVector() { |
| 3665 if (!feedback_vector_.is_set()) { | 3666 if (!feedback_vector_.is_set()) { |
| 3666 Node* closure = GetFunctionClosure(); | 3667 Node* closure = GetFunctionClosure(); |
| 3667 Node* shared = BuildLoadImmutableObjectField( | 3668 Node* shared = BuildLoadImmutableObjectField( |
| 3668 closure, JSFunction::kSharedFunctionInfoOffset); | 3669 closure, JSFunction::kSharedFunctionInfoOffset); |
| 3669 Node* vector = BuildLoadImmutableObjectField( | 3670 Node* vector = BuildLoadImmutableObjectField( |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4304 // Phi does not exist yet, introduce one. | 4305 // Phi does not exist yet, introduce one. |
| 4305 value = NewPhi(inputs, value, control); | 4306 value = NewPhi(inputs, value, control); |
| 4306 value->ReplaceInput(inputs - 1, other); | 4307 value->ReplaceInput(inputs - 1, other); |
| 4307 } | 4308 } |
| 4308 return value; | 4309 return value; |
| 4309 } | 4310 } |
| 4310 | 4311 |
| 4311 } // namespace compiler | 4312 } // namespace compiler |
| 4312 } // namespace internal | 4313 } // namespace internal |
| 4313 } // namespace v8 | 4314 } // namespace v8 |
| OLD | NEW |