Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1426893003: [turbofan] Fix and rework deopt in call to super property. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4521.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 } 2331 }
2332 case Call::LOOKUP_SLOT_CALL: { 2332 case Call::LOOKUP_SLOT_CALL: {
2333 Variable* variable = callee->AsVariableProxy()->var(); 2333 Variable* variable = callee->AsVariableProxy()->var();
2334 DCHECK(variable->location() == VariableLocation::LOOKUP); 2334 DCHECK(variable->location() == VariableLocation::LOOKUP);
2335 Node* name = jsgraph()->Constant(variable->name()); 2335 Node* name = jsgraph()->Constant(variable->name());
2336 const Operator* op = 2336 const Operator* op =
2337 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); 2337 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2);
2338 Node* pair = NewNode(op, current_context(), name); 2338 Node* pair = NewNode(op, current_context(), name);
2339 callee_value = NewNode(common()->Projection(0), pair); 2339 callee_value = NewNode(common()->Projection(0), pair);
2340 receiver_value = NewNode(common()->Projection(1), pair); 2340 receiver_value = NewNode(common()->Projection(1), pair);
2341
2342 PrepareFrameState(pair, expr->LookupId(), 2341 PrepareFrameState(pair, expr->LookupId(),
2343 OutputFrameStateCombine::Push(2)); 2342 OutputFrameStateCombine::Push(2));
2344 break; 2343 break;
2345 } 2344 }
2346 case Call::PROPERTY_CALL: { 2345 case Call::PROPERTY_CALL: {
2347 Property* property = callee->AsProperty(); 2346 Property* property = callee->AsProperty();
2348 VectorSlotPair pair = 2347 VectorSlotPair pair =
2349 CreateVectorSlotPair(property->PropertyFeedbackSlot()); 2348 CreateVectorSlotPair(property->PropertyFeedbackSlot());
2350 if (!property->IsSuperAccess()) { 2349 LhsKind property_type = Property::GetAssignType(property);
Michael Starzinger 2015/10/28 17:26:26 The LhsKind is somewhat being abused at this point
rossberg 2015/10/29 10:34:12 SGTM
2351 VisitForValue(property->obj()); 2350 switch (property_type) {
2352 Node* object = environment()->Top(); 2351 case NAMED_PROPERTY: {
2353 2352 VisitForValue(property->obj());
2354 if (property->key()->IsPropertyName()) {
2355 FrameStateBeforeAndAfter states(this, property->obj()->id()); 2353 FrameStateBeforeAndAfter states(this, property->obj()->id());
2356 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2354 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2355 Node* object = environment()->Top();
2357 callee_value = BuildNamedLoad(object, name, pair); 2356 callee_value = BuildNamedLoad(object, name, pair);
2358 states.AddToNode(callee_value, property->LoadId(), 2357 states.AddToNode(callee_value, property->LoadId(),
2359 OutputFrameStateCombine::Push()); 2358 OutputFrameStateCombine::Push());
2360 } else { 2359 // Note that a PROPERTY_CALL requires the receiver to be wrapped into
2360 // an object for sloppy callees. However the receiver is guaranteed
2361 // not to be null or undefined at this point.
2362 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined;
2363 receiver_value = environment()->Pop();
2364 flags = CALL_AS_METHOD;
2365 break;
2366 }
2367 case KEYED_PROPERTY: {
2368 VisitForValue(property->obj());
2361 VisitForValue(property->key()); 2369 VisitForValue(property->key());
2362 FrameStateBeforeAndAfter states(this, property->key()->id()); 2370 FrameStateBeforeAndAfter states(this, property->key()->id());
2363 Node* key = environment()->Pop(); 2371 Node* key = environment()->Pop();
2372 Node* object = environment()->Top();
2364 callee_value = BuildKeyedLoad(object, key, pair); 2373 callee_value = BuildKeyedLoad(object, key, pair);
2365 states.AddToNode(callee_value, property->LoadId(), 2374 states.AddToNode(callee_value, property->LoadId(),
2366 OutputFrameStateCombine::Push()); 2375 OutputFrameStateCombine::Push());
2376 // Note that a PROPERTY_CALL requires the receiver to be wrapped into
2377 // an object for sloppy callees. However the receiver is guaranteed
2378 // not to be null or undefined at this point.
2379 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined;
2380 receiver_value = environment()->Pop();
2381 flags = CALL_AS_METHOD;
2382 break;
2367 } 2383 }
2368 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an 2384 case NAMED_SUPER_PROPERTY: {
2369 // object for sloppy callees. However the receiver is guaranteed not to 2385 SuperPropertyReference* super_ref =
2370 // be null or undefined at this point. 2386 property->obj()->AsSuperPropertyReference();
2371 receiver_hint = ConvertReceiverMode::kNotNullOrUndefined; 2387 VisitForValue(super_ref->home_object());
2372 receiver_value = environment()->Pop(); 2388 VisitForValue(super_ref->this_var());
2373 flags = CALL_AS_METHOD; 2389 Node* home = environment()->Peek(1);
2374 2390 Node* object = environment()->Top();
2375 } else { 2391 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName();
2376 // TODO(mstarzinger): Cleanup this special handling for super access,
2377 // the stack layout seems to be completely out of sync here, fix this!
2378 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var());
2379 VisitForValue(
2380 property->obj()->AsSuperPropertyReference()->home_object());
2381 Node* home_object = environment()->Pop();
2382 receiver_value = environment()->Pop();
2383 if (property->key()->IsPropertyName()) {
2384 FrameStateBeforeAndAfter states(this, property->obj()->id()); 2392 FrameStateBeforeAndAfter states(this, property->obj()->id());
2385 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); 2393 callee_value = BuildNamedSuperLoad(object, home, name, pair);
2386 callee_value =
2387 BuildNamedSuperLoad(receiver_value, home_object, name, pair);
2388 states.AddToNode(callee_value, property->LoadId(), 2394 states.AddToNode(callee_value, property->LoadId(),
2389 OutputFrameStateCombine::Push()); 2395 OutputFrameStateCombine::Push());
2390 2396 // Note that the receiver is not the target of the property load, so
2391 } else { 2397 // it could very well be null or undefined at this point.
2398 receiver_value = environment()->Pop();
2399 environment()->Drop(1);
2400 break;
2401 }
2402 case KEYED_SUPER_PROPERTY: {
2403 SuperPropertyReference* super_ref =
2404 property->obj()->AsSuperPropertyReference();
2405 VisitForValue(super_ref->home_object());
2406 VisitForValue(super_ref->this_var());
2407 environment()->Push(environment()->Top()); // Duplicate this_var.
2408 environment()->Push(environment()->Peek(2)); // Duplicate home_obj.
2392 VisitForValue(property->key()); 2409 VisitForValue(property->key());
2410 Node* key = environment()->Pop();
2411 Node* home = environment()->Pop();
2412 Node* object = environment()->Pop();
2393 FrameStateBeforeAndAfter states(this, property->key()->id()); 2413 FrameStateBeforeAndAfter states(this, property->key()->id());
2394 Node* key = environment()->Pop(); 2414 callee_value = BuildKeyedSuperLoad(object, home, key, pair);
2395 callee_value =
2396 BuildKeyedSuperLoad(receiver_value, home_object, key, pair);
2397 states.AddToNode(callee_value, property->LoadId(), 2415 states.AddToNode(callee_value, property->LoadId(),
2398 OutputFrameStateCombine::Push()); 2416 OutputFrameStateCombine::Push());
2417 // Note that the receiver is not the target of the property load, so
2418 // it could very well be null or undefined at this point.
2419 receiver_value = environment()->Pop();
2420 environment()->Drop(1);
2421 break;
2399 } 2422 }
2423 case VARIABLE:
2424 UNREACHABLE();
2400 } 2425 }
2401
2402 break; 2426 break;
2403 } 2427 }
2404 case Call::SUPER_CALL: 2428 case Call::SUPER_CALL:
2405 return VisitCallSuper(expr); 2429 return VisitCallSuper(expr);
2406 case Call::POSSIBLY_EVAL_CALL: 2430 case Call::POSSIBLY_EVAL_CALL:
2407 possibly_eval = true; 2431 possibly_eval = true;
2408 if (callee->AsVariableProxy()->var()->IsLookupSlot()) { 2432 if (callee->AsVariableProxy()->var()->IsLookupSlot()) {
2409 Variable* variable = callee->AsVariableProxy()->var(); 2433 Variable* variable = callee->AsVariableProxy()->var();
2410 Node* name = jsgraph()->Constant(variable->name()); 2434 Node* name = jsgraph()->Constant(variable->name());
2411 const Operator* op = 2435 const Operator* op =
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
4228 // Phi does not exist yet, introduce one. 4252 // Phi does not exist yet, introduce one.
4229 value = NewPhi(inputs, value, control); 4253 value = NewPhi(inputs, value, control);
4230 value->ReplaceInput(inputs - 1, other); 4254 value->ReplaceInput(inputs - 1, other);
4231 } 4255 }
4232 return value; 4256 return value;
4233 } 4257 }
4234 4258
4235 } // namespace compiler 4259 } // namespace compiler
4236 } // namespace internal 4260 } // namespace internal
4237 } // namespace v8 4261 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4521.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698