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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 case VARIABLE: { | 2233 case VARIABLE: { |
2234 Variable* variable = expr->target()->AsVariableProxy()->var(); | 2234 Variable* variable = expr->target()->AsVariableProxy()->var(); |
2235 BuildVariableAssignment(variable, value, expr->op(), feedback, expr->id(), | 2235 BuildVariableAssignment(variable, value, expr->op(), feedback, expr->id(), |
2236 ast_context()->GetStateCombine()); | 2236 ast_context()->GetStateCombine()); |
2237 break; | 2237 break; |
2238 } | 2238 } |
2239 case NAMED_PROPERTY: { | 2239 case NAMED_PROPERTY: { |
2240 Node* object = environment()->Pop(); | 2240 Node* object = environment()->Pop(); |
2241 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2241 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2242 Node* store = BuildNamedStore(object, name, value, feedback); | 2242 Node* store = BuildNamedStore(object, name, value, feedback); |
2243 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); | 2243 PrepareFrameState(store, expr->AssignmentId(), |
| 2244 OutputFrameStateCombine::Push()); |
2244 break; | 2245 break; |
2245 } | 2246 } |
2246 case KEYED_PROPERTY: { | 2247 case KEYED_PROPERTY: { |
2247 Node* key = environment()->Pop(); | 2248 Node* key = environment()->Pop(); |
2248 Node* object = environment()->Pop(); | 2249 Node* object = environment()->Pop(); |
2249 Node* store = BuildKeyedStore(object, key, value, feedback); | 2250 Node* store = BuildKeyedStore(object, key, value, feedback); |
2250 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); | 2251 PrepareFrameState(store, expr->AssignmentId(), |
| 2252 OutputFrameStateCombine::Push()); |
2251 break; | 2253 break; |
2252 } | 2254 } |
2253 case NAMED_SUPER_PROPERTY: { | 2255 case NAMED_SUPER_PROPERTY: { |
2254 Node* home_object = environment()->Pop(); | 2256 Node* home_object = environment()->Pop(); |
2255 Node* receiver = environment()->Pop(); | 2257 Node* receiver = environment()->Pop(); |
2256 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2258 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2257 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); | 2259 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); |
2258 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); | 2260 PrepareFrameState(store, expr->id(), ast_context()->GetStateCombine()); |
2259 break; | 2261 break; |
2260 } | 2262 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 VectorSlotPair pair = CreateVectorSlotPair(expr->PropertyFeedbackSlot()); | 2295 VectorSlotPair pair = CreateVectorSlotPair(expr->PropertyFeedbackSlot()); |
2294 switch (property_kind) { | 2296 switch (property_kind) { |
2295 case VARIABLE: | 2297 case VARIABLE: |
2296 UNREACHABLE(); | 2298 UNREACHABLE(); |
2297 break; | 2299 break; |
2298 case NAMED_PROPERTY: { | 2300 case NAMED_PROPERTY: { |
2299 VisitForValue(expr->obj()); | 2301 VisitForValue(expr->obj()); |
2300 Node* object = environment()->Pop(); | 2302 Node* object = environment()->Pop(); |
2301 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); | 2303 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); |
2302 value = BuildNamedLoad(object, name, pair); | 2304 value = BuildNamedLoad(object, name, pair); |
2303 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2305 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); |
2304 break; | 2306 break; |
2305 } | 2307 } |
2306 case KEYED_PROPERTY: { | 2308 case KEYED_PROPERTY: { |
2307 VisitForValue(expr->obj()); | 2309 VisitForValue(expr->obj()); |
2308 VisitForValue(expr->key()); | 2310 VisitForValue(expr->key()); |
2309 Node* key = environment()->Pop(); | 2311 Node* key = environment()->Pop(); |
2310 Node* object = environment()->Pop(); | 2312 Node* object = environment()->Pop(); |
2311 value = BuildKeyedLoad(object, key, pair); | 2313 value = BuildKeyedLoad(object, key, pair); |
2312 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2314 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); |
2313 break; | 2315 break; |
2314 } | 2316 } |
2315 case NAMED_SUPER_PROPERTY: { | 2317 case NAMED_SUPER_PROPERTY: { |
2316 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2318 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2317 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | 2319 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); |
2318 Node* home_object = environment()->Pop(); | 2320 Node* home_object = environment()->Pop(); |
2319 Node* receiver = environment()->Pop(); | 2321 Node* receiver = environment()->Pop(); |
2320 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); | 2322 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); |
2321 value = BuildNamedSuperLoad(receiver, home_object, name, pair); | 2323 value = BuildNamedSuperLoad(receiver, home_object, name, pair); |
2322 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2324 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); |
2323 break; | 2325 break; |
2324 } | 2326 } |
2325 case KEYED_SUPER_PROPERTY: { | 2327 case KEYED_SUPER_PROPERTY: { |
2326 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2328 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2327 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | 2329 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); |
2328 VisitForValue(expr->key()); | 2330 VisitForValue(expr->key()); |
2329 Node* key = environment()->Pop(); | 2331 Node* key = environment()->Pop(); |
2330 Node* home_object = environment()->Pop(); | 2332 Node* home_object = environment()->Pop(); |
2331 Node* receiver = environment()->Pop(); | 2333 Node* receiver = environment()->Pop(); |
2332 value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | 2334 value = BuildKeyedSuperLoad(receiver, home_object, key, pair); |
2333 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2335 PrepareFrameState(value, expr->LoadId(), OutputFrameStateCombine::Push()); |
2334 break; | 2336 break; |
2335 } | 2337 } |
2336 } | 2338 } |
2337 ast_context()->ProduceValue(expr, value); | 2339 ast_context()->ProduceValue(expr, value); |
2338 } | 2340 } |
2339 | 2341 |
2340 | 2342 |
2341 void AstGraphBuilder::VisitCall(Call* expr) { | 2343 void AstGraphBuilder::VisitCall(Call* expr) { |
2342 Expression* callee = expr->expression(); | 2344 Expression* callee = expr->expression(); |
2343 Call::CallType call_type = expr->GetCallType(isolate()); | 2345 Call::CallType call_type = expr->GetCallType(isolate()); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 environment()->Push(value); | 2749 environment()->Push(value); |
2748 BuildVariableAssignment(variable, value, expr->op(), feedback, | 2750 BuildVariableAssignment(variable, value, expr->op(), feedback, |
2749 expr->AssignmentId()); | 2751 expr->AssignmentId()); |
2750 environment()->Pop(); | 2752 environment()->Pop(); |
2751 break; | 2753 break; |
2752 } | 2754 } |
2753 case NAMED_PROPERTY: { | 2755 case NAMED_PROPERTY: { |
2754 Node* object = environment()->Pop(); | 2756 Node* object = environment()->Pop(); |
2755 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2757 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2756 Node* store = BuildNamedStore(object, name, value, feedback); | 2758 Node* store = BuildNamedStore(object, name, value, feedback); |
2757 environment()->Push(value); | |
2758 PrepareFrameState(store, expr->AssignmentId(), | 2759 PrepareFrameState(store, expr->AssignmentId(), |
2759 OutputFrameStateCombine::Ignore()); | 2760 OutputFrameStateCombine::Push()); |
2760 environment()->Pop(); | |
2761 break; | 2761 break; |
2762 } | 2762 } |
2763 case KEYED_PROPERTY: { | 2763 case KEYED_PROPERTY: { |
2764 Node* key = environment()->Pop(); | 2764 Node* key = environment()->Pop(); |
2765 Node* object = environment()->Pop(); | 2765 Node* object = environment()->Pop(); |
2766 Node* store = BuildKeyedStore(object, key, value, feedback); | 2766 Node* store = BuildKeyedStore(object, key, value, feedback); |
2767 environment()->Push(value); | |
2768 PrepareFrameState(store, expr->AssignmentId(), | 2767 PrepareFrameState(store, expr->AssignmentId(), |
2769 OutputFrameStateCombine::Ignore()); | 2768 OutputFrameStateCombine::Push()); |
2770 environment()->Pop(); | |
2771 break; | 2769 break; |
2772 } | 2770 } |
2773 case NAMED_SUPER_PROPERTY: { | 2771 case NAMED_SUPER_PROPERTY: { |
2774 Node* home_object = environment()->Pop(); | 2772 Node* home_object = environment()->Pop(); |
2775 Node* receiver = environment()->Pop(); | 2773 Node* receiver = environment()->Pop(); |
2776 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2774 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
2777 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); | 2775 Node* store = BuildNamedSuperStore(receiver, home_object, name, value); |
2778 environment()->Push(value); | |
2779 PrepareFrameState(store, expr->AssignmentId(), | 2776 PrepareFrameState(store, expr->AssignmentId(), |
2780 OutputFrameStateCombine::Ignore()); | 2777 OutputFrameStateCombine::Push()); |
2781 environment()->Pop(); | |
2782 break; | 2778 break; |
2783 } | 2779 } |
2784 case KEYED_SUPER_PROPERTY: { | 2780 case KEYED_SUPER_PROPERTY: { |
2785 Node* key = environment()->Pop(); | 2781 Node* key = environment()->Pop(); |
2786 Node* home_object = environment()->Pop(); | 2782 Node* home_object = environment()->Pop(); |
2787 Node* receiver = environment()->Pop(); | 2783 Node* receiver = environment()->Pop(); |
2788 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value); | 2784 Node* store = BuildKeyedSuperStore(receiver, home_object, key, value); |
2789 environment()->Push(value); | |
2790 PrepareFrameState(store, expr->AssignmentId(), | 2785 PrepareFrameState(store, expr->AssignmentId(), |
2791 OutputFrameStateCombine::Ignore()); | 2786 OutputFrameStateCombine::Push()); |
2792 environment()->Pop(); | |
2793 break; | 2787 break; |
2794 } | 2788 } |
2795 } | 2789 } |
2796 | 2790 |
2797 // Restore old value for postfix expressions. | 2791 // Restore old value for postfix expressions. |
2798 if (is_postfix) value = environment()->Pop(); | 2792 if (is_postfix) value = environment()->Pop(); |
2799 | 2793 |
2800 ast_context()->ProduceValue(expr, value); | 2794 ast_context()->ProduceValue(expr, value); |
2801 } | 2795 } |
2802 | 2796 |
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4396 // Phi does not exist yet, introduce one. | 4390 // Phi does not exist yet, introduce one. |
4397 value = NewPhi(inputs, value, control); | 4391 value = NewPhi(inputs, value, control); |
4398 value->ReplaceInput(inputs - 1, other); | 4392 value->ReplaceInput(inputs - 1, other); |
4399 } | 4393 } |
4400 return value; | 4394 return value; |
4401 } | 4395 } |
4402 | 4396 |
4403 } // namespace compiler | 4397 } // namespace compiler |
4404 } // namespace internal | 4398 } // namespace internal |
4405 } // namespace v8 | 4399 } // namespace v8 |
OLD | NEW |