OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-global-object-specialization.h" | 5 #include "src/compiler/js-global-object-specialization.h" |
6 | 6 |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Node* effect = NodeProperties::GetEffectInput(node); | 54 Node* effect = NodeProperties::GetEffectInput(node); |
55 Node* control = NodeProperties::GetControlInput(node); | 55 Node* control = NodeProperties::GetControlInput(node); |
56 | 56 |
57 // Retrieve the global object from the given {node}. | 57 // Retrieve the global object from the given {node}. |
58 Handle<JSGlobalObject> global_object; | 58 Handle<JSGlobalObject> global_object; |
59 if (!GetGlobalObject(node).ToHandle(&global_object)) return NoChange(); | 59 if (!GetGlobalObject(node).ToHandle(&global_object)) return NoChange(); |
60 | 60 |
61 // Try to lookup the name on the script context table first (lexical scoping). | 61 // Try to lookup the name on the script context table first (lexical scoping). |
62 ScriptContextTableLookupResult result; | 62 ScriptContextTableLookupResult result; |
63 if (LookupInScriptContextTable(global_object, name, &result)) { | 63 if (LookupInScriptContextTable(global_object, name, &result)) { |
64 if (result.context->is_the_hole(result.index)) return NoChange(); | 64 if (result.context->is_the_hole(isolate(), result.index)) return NoChange(); |
65 Node* context = jsgraph()->HeapConstant(result.context); | 65 Node* context = jsgraph()->HeapConstant(result.context); |
66 Node* value = effect = graph()->NewNode( | 66 Node* value = effect = graph()->NewNode( |
67 javascript()->LoadContext(0, result.index, result.immutable), context, | 67 javascript()->LoadContext(0, result.index, result.immutable), context, |
68 context, effect); | 68 context, effect); |
69 ReplaceWithValue(node, value, effect); | 69 ReplaceWithValue(node, value, effect); |
70 return Replace(value); | 70 return Replace(value); |
71 } | 71 } |
72 | 72 |
73 // Lookup on the global object instead. We only deal with own data | 73 // Lookup on the global object instead. We only deal with own data |
74 // properties of the global object here (represented as PropertyCell). | 74 // properties of the global object here (represented as PropertyCell). |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 Node* control = NodeProperties::GetControlInput(node); | 135 Node* control = NodeProperties::GetControlInput(node); |
136 Node* frame_state = NodeProperties::FindFrameStateBefore(node); | 136 Node* frame_state = NodeProperties::FindFrameStateBefore(node); |
137 | 137 |
138 // Retrieve the global object from the given {node}. | 138 // Retrieve the global object from the given {node}. |
139 Handle<JSGlobalObject> global_object; | 139 Handle<JSGlobalObject> global_object; |
140 if (!GetGlobalObject(node).ToHandle(&global_object)) return NoChange(); | 140 if (!GetGlobalObject(node).ToHandle(&global_object)) return NoChange(); |
141 | 141 |
142 // Try to lookup the name on the script context table first (lexical scoping). | 142 // Try to lookup the name on the script context table first (lexical scoping). |
143 ScriptContextTableLookupResult result; | 143 ScriptContextTableLookupResult result; |
144 if (LookupInScriptContextTable(global_object, name, &result)) { | 144 if (LookupInScriptContextTable(global_object, name, &result)) { |
145 if (result.context->is_the_hole(result.index)) return NoChange(); | 145 if (result.context->is_the_hole(isolate(), result.index)) return NoChange(); |
146 if (result.immutable) return NoChange(); | 146 if (result.immutable) return NoChange(); |
147 Node* context = jsgraph()->HeapConstant(result.context); | 147 Node* context = jsgraph()->HeapConstant(result.context); |
148 effect = graph()->NewNode(javascript()->StoreContext(0, result.index), | 148 effect = graph()->NewNode(javascript()->StoreContext(0, result.index), |
149 context, value, context, effect, control); | 149 context, value, context, effect, control); |
150 ReplaceWithValue(node, value, effect, control); | 150 ReplaceWithValue(node, value, effect, control); |
151 return Replace(value); | 151 return Replace(value); |
152 } | 152 } |
153 | 153 |
154 // Lookup on the global object instead. We only deal with own data | 154 // Lookup on the global object instead. We only deal with own data |
155 // properties of the global object here (represented as PropertyCell). | 155 // properties of the global object here (represented as PropertyCell). |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { | 278 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { |
279 return jsgraph()->simplified(); | 279 return jsgraph()->simplified(); |
280 } | 280 } |
281 | 281 |
282 } // namespace compiler | 282 } // namespace compiler |
283 } // namespace internal | 283 } // namespace internal |
284 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |