| 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/linkage.h" | 10 #include "src/compiler/linkage.h" |
| (...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 Property* property = callee->AsProperty(); | 2346 Property* property = callee->AsProperty(); |
| 2347 VectorSlotPair feedback = | 2347 VectorSlotPair feedback = |
| 2348 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2348 CreateVectorSlotPair(property->PropertyFeedbackSlot()); |
| 2349 VisitForValue(property->obj()); | 2349 VisitForValue(property->obj()); |
| 2350 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2350 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2351 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2351 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2352 Node* object = environment()->Top(); | 2352 Node* object = environment()->Top(); |
| 2353 callee_value = BuildNamedLoad(object, name, feedback); | 2353 callee_value = BuildNamedLoad(object, name, feedback); |
| 2354 states.AddToNode(callee_value, property->LoadId(), | 2354 states.AddToNode(callee_value, property->LoadId(), |
| 2355 OutputFrameStateCombine::Push()); | 2355 OutputFrameStateCombine::Push()); |
| 2356 // Note that a PROPERTY_CALL requires the receiver to be wrapped into | 2356 // Note that a property call requires the receiver to be wrapped into |
| 2357 // an object for sloppy callees. However the receiver is guaranteed | 2357 // an object for sloppy callees. However the receiver is guaranteed |
| 2358 // not to be null or undefined at this point. | 2358 // not to be null or undefined at this point. |
| 2359 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; | 2359 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; |
| 2360 receiver_value = environment()->Pop(); | 2360 receiver_value = environment()->Pop(); |
| 2361 flags = CALL_AS_METHOD; | 2361 flags = CALL_AS_METHOD; |
| 2362 break; | 2362 break; |
| 2363 } | 2363 } |
| 2364 case Call::KEYED_PROPERTY_CALL: { | 2364 case Call::KEYED_PROPERTY_CALL: { |
| 2365 Property* property = callee->AsProperty(); | 2365 Property* property = callee->AsProperty(); |
| 2366 VectorSlotPair feedback = | 2366 VectorSlotPair feedback = |
| 2367 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2367 CreateVectorSlotPair(property->PropertyFeedbackSlot()); |
| 2368 VisitForValue(property->obj()); | 2368 VisitForValue(property->obj()); |
| 2369 VisitForValue(property->key()); | 2369 VisitForValue(property->key()); |
| 2370 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2370 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2371 Node* key = environment()->Pop(); | 2371 Node* key = environment()->Pop(); |
| 2372 Node* object = environment()->Top(); | 2372 Node* object = environment()->Top(); |
| 2373 callee_value = BuildKeyedLoad(object, key, feedback); | 2373 callee_value = BuildKeyedLoad(object, key, feedback); |
| 2374 states.AddToNode(callee_value, property->LoadId(), | 2374 states.AddToNode(callee_value, property->LoadId(), |
| 2375 OutputFrameStateCombine::Push()); | 2375 OutputFrameStateCombine::Push()); |
| 2376 // Note that a PROPERTY_CALL requires the receiver to be wrapped into | 2376 // Note that a property call requires the receiver to be wrapped into |
| 2377 // an object for sloppy callees. However the receiver is guaranteed | 2377 // an object for sloppy callees. However the receiver is guaranteed |
| 2378 // not to be null or undefined at this point. | 2378 // not to be null or undefined at this point. |
| 2379 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; | 2379 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; |
| 2380 receiver_value = environment()->Pop(); | 2380 receiver_value = environment()->Pop(); |
| 2381 flags = CALL_AS_METHOD; | 2381 flags = CALL_AS_METHOD; |
| 2382 break; | 2382 break; |
| 2383 } | 2383 } |
| 2384 case Call::NAMED_SUPER_PROPERTY_CALL: { | 2384 case Call::NAMED_SUPER_PROPERTY_CALL: { |
| 2385 Property* property = callee->AsProperty(); | 2385 Property* property = callee->AsProperty(); |
| 2386 SuperPropertyReference* super_ref = | 2386 SuperPropertyReference* super_ref = |
| 2387 property->obj()->AsSuperPropertyReference(); | 2387 property->obj()->AsSuperPropertyReference(); |
| 2388 VisitForValue(super_ref->home_object()); | 2388 VisitForValue(super_ref->home_object()); |
| 2389 VisitForValue(super_ref->this_var()); | 2389 VisitForValue(super_ref->this_var()); |
| 2390 Node* home = environment()->Peek(1); | 2390 Node* home = environment()->Peek(1); |
| 2391 Node* object = environment()->Top(); | 2391 Node* object = environment()->Top(); |
| 2392 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2392 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2393 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2393 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2394 callee_value = BuildNamedSuperLoad(object, home, name, VectorSlotPair()); | 2394 callee_value = BuildNamedSuperLoad(object, home, name, VectorSlotPair()); |
| 2395 states.AddToNode(callee_value, property->LoadId(), | 2395 states.AddToNode(callee_value, property->LoadId(), |
| 2396 OutputFrameStateCombine::Push()); | 2396 OutputFrameStateCombine::Push()); |
| 2397 // Note that the receiver is not the target of the property load, so | 2397 // Note that a property call requires the receiver to be wrapped into |
| 2398 // it could very well be null or undefined at this point. | 2398 // an object for sloppy callees. Since the receiver is not the target of |
| 2399 // the load, it could very well be null or undefined at this point. |
| 2399 receiver_value = environment()->Pop(); | 2400 receiver_value = environment()->Pop(); |
| 2401 flags = CALL_AS_METHOD; |
| 2400 environment()->Drop(1); | 2402 environment()->Drop(1); |
| 2401 break; | 2403 break; |
| 2402 } | 2404 } |
| 2403 case Call::KEYED_SUPER_PROPERTY_CALL: { | 2405 case Call::KEYED_SUPER_PROPERTY_CALL: { |
| 2404 Property* property = callee->AsProperty(); | 2406 Property* property = callee->AsProperty(); |
| 2405 SuperPropertyReference* super_ref = | 2407 SuperPropertyReference* super_ref = |
| 2406 property->obj()->AsSuperPropertyReference(); | 2408 property->obj()->AsSuperPropertyReference(); |
| 2407 VisitForValue(super_ref->home_object()); | 2409 VisitForValue(super_ref->home_object()); |
| 2408 VisitForValue(super_ref->this_var()); | 2410 VisitForValue(super_ref->this_var()); |
| 2409 environment()->Push(environment()->Top()); // Duplicate this_var. | 2411 environment()->Push(environment()->Top()); // Duplicate this_var. |
| 2410 environment()->Push(environment()->Peek(2)); // Duplicate home_obj. | 2412 environment()->Push(environment()->Peek(2)); // Duplicate home_obj. |
| 2411 VisitForValue(property->key()); | 2413 VisitForValue(property->key()); |
| 2412 Node* key = environment()->Pop(); | 2414 Node* key = environment()->Pop(); |
| 2413 Node* home = environment()->Pop(); | 2415 Node* home = environment()->Pop(); |
| 2414 Node* object = environment()->Pop(); | 2416 Node* object = environment()->Pop(); |
| 2415 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2417 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2416 callee_value = BuildKeyedSuperLoad(object, home, key, VectorSlotPair()); | 2418 callee_value = BuildKeyedSuperLoad(object, home, key, VectorSlotPair()); |
| 2417 states.AddToNode(callee_value, property->LoadId(), | 2419 states.AddToNode(callee_value, property->LoadId(), |
| 2418 OutputFrameStateCombine::Push()); | 2420 OutputFrameStateCombine::Push()); |
| 2419 // Note that the receiver is not the target of the property load, so | 2421 // Note that a property call requires the receiver to be wrapped into |
| 2420 // it could very well be null or undefined at this point. | 2422 // an object for sloppy callees. Since the receiver is not the target of |
| 2423 // the load, it could very well be null or undefined at this point. |
| 2421 receiver_value = environment()->Pop(); | 2424 receiver_value = environment()->Pop(); |
| 2425 flags = CALL_AS_METHOD; |
| 2422 environment()->Drop(1); | 2426 environment()->Drop(1); |
| 2423 break; | 2427 break; |
| 2424 } | 2428 } |
| 2425 case Call::SUPER_CALL: | 2429 case Call::SUPER_CALL: |
| 2426 return VisitCallSuper(expr); | 2430 return VisitCallSuper(expr); |
| 2427 case Call::POSSIBLY_EVAL_CALL: | 2431 case Call::POSSIBLY_EVAL_CALL: |
| 2428 possibly_eval = true; | 2432 possibly_eval = true; |
| 2429 if (callee->AsVariableProxy()->var()->IsLookupSlot()) { | 2433 if (callee->AsVariableProxy()->var()->IsLookupSlot()) { |
| 2430 Variable* variable = callee->AsVariableProxy()->var(); | 2434 Variable* variable = callee->AsVariableProxy()->var(); |
| 2431 Node* name = jsgraph()->Constant(variable->name()); | 2435 Node* name = jsgraph()->Constant(variable->name()); |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4249 // Phi does not exist yet, introduce one. | 4253 // Phi does not exist yet, introduce one. |
| 4250 value = NewPhi(inputs, value, control); | 4254 value = NewPhi(inputs, value, control); |
| 4251 value->ReplaceInput(inputs - 1, other); | 4255 value->ReplaceInput(inputs - 1, other); |
| 4252 } | 4256 } |
| 4253 return value; | 4257 return value; |
| 4254 } | 4258 } |
| 4255 | 4259 |
| 4256 } // namespace compiler | 4260 } // namespace compiler |
| 4257 } // namespace internal | 4261 } // namespace internal |
| 4258 } // namespace v8 | 4262 } // namespace v8 |
| OLD | NEW |