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

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

Issue 1412443003: [turbofan] Introduce lazy bailout, masked as a call. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Enable test Created 5 years, 2 months 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 | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/common-operator.h » ('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/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 try_control.BeginTry(); 1403 try_control.BeginTry();
1404 { 1404 {
1405 ControlScopeForCatch scope(this, &try_control); 1405 ControlScopeForCatch scope(this, &try_control);
1406 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); 1406 STATIC_ASSERT(TryBlockConstant::kElementCount == 1);
1407 environment()->Push(current_context()); 1407 environment()->Push(current_context());
1408 Visit(stmt->try_block()); 1408 Visit(stmt->try_block());
1409 environment()->Pop(); 1409 environment()->Pop();
1410 } 1410 }
1411 try_control.EndTry(); 1411 try_control.EndTry();
1412 1412
1413 // TODO(mstarzinger): We are only using a runtime call to get a lazy bailout 1413 // Insert lazy bailout point.
1414 // point, there is no need to really emit an actual call. Optimize this! 1414 // TODO(mstarzinger): We are only using a 'call' to get a lazy bailout
1415 Node* guard = NewNode(javascript()->CallRuntime(Runtime::kMaxSmi, 0)); 1415 // point. Ideally, we whould not re-enter optimized code when deoptimized
1416 PrepareFrameState(guard, stmt->HandlerId()); 1416 // lazily. Tracked by issue v8:4195.
1417 NewNode(common()->LazyBailout(),
1418 jsgraph()->ZeroConstant(), // dummy target.
1419 environment()->Checkpoint(stmt->HandlerId())); // frame state.
1417 1420
1418 // Clear message object as we enter the catch block. 1421 // Clear message object as we enter the catch block.
1419 Node* the_hole = jsgraph()->TheHoleConstant(); 1422 Node* the_hole = jsgraph()->TheHoleConstant();
1420 BuildStoreExternal(message_object, kMachAnyTagged, the_hole); 1423 BuildStoreExternal(message_object, kMachAnyTagged, the_hole);
1421 1424
1422 // Create a catch scope that binds the exception. 1425 // Create a catch scope that binds the exception.
1423 Node* exception = try_control.GetExceptionNode(); 1426 Node* exception = try_control.GetExceptionNode();
1424 Handle<String> name = stmt->variable()->name(); 1427 Handle<String> name = stmt->variable()->name();
1425 const Operator* op = javascript()->CreateCatchContext(name); 1428 const Operator* op = javascript()->CreateCatchContext(name);
1426 Node* context = NewNode(op, exception, GetFunctionClosureForContext()); 1429 Node* context = NewNode(op, exception, GetFunctionClosureForContext());
(...skipping 27 matching lines...) Expand all
1454 try_control.BeginTry(); 1457 try_control.BeginTry();
1455 { 1458 {
1456 ControlScopeForFinally scope(this, commands, &try_control); 1459 ControlScopeForFinally scope(this, commands, &try_control);
1457 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); 1460 STATIC_ASSERT(TryBlockConstant::kElementCount == 1);
1458 environment()->Push(current_context()); 1461 environment()->Push(current_context());
1459 Visit(stmt->try_block()); 1462 Visit(stmt->try_block());
1460 environment()->Pop(); 1463 environment()->Pop();
1461 } 1464 }
1462 try_control.EndTry(commands->GetFallThroughToken(), fallthrough_result); 1465 try_control.EndTry(commands->GetFallThroughToken(), fallthrough_result);
1463 1466
1464 // TODO(mstarzinger): We are only using a runtime call to get a lazy bailout 1467 // Insert lazy bailout point.
1465 // point, there is no need to really emit an actual call. Optimize this! 1468 // TODO(mstarzinger): We are only using a 'call' to get a lazy bailout
1466 Node* guard = NewNode(javascript()->CallRuntime(Runtime::kMaxSmi, 0)); 1469 // point. Ideally, we whould not re-enter optimized code when deoptimized
1467 PrepareFrameState(guard, stmt->HandlerId()); 1470 // lazily. Tracked by issue v8:4195.
1471 NewNode(common()->LazyBailout(),
1472 jsgraph()->ZeroConstant(), // dummy target.
1473 environment()->Checkpoint(stmt->HandlerId())); // frame state.
1468 1474
1469 // The result value semantics depend on how the block was entered: 1475 // The result value semantics depend on how the block was entered:
1470 // - ReturnStatement: It represents the return value being returned. 1476 // - ReturnStatement: It represents the return value being returned.
1471 // - ThrowStatement: It represents the exception being thrown. 1477 // - ThrowStatement: It represents the exception being thrown.
1472 // - BreakStatement/ContinueStatement: Filled with the hole. 1478 // - BreakStatement/ContinueStatement: Filled with the hole.
1473 // - Falling through into finally-block: Filled with the hole. 1479 // - Falling through into finally-block: Filled with the hole.
1474 Node* result = try_control.GetResultValueNode(); 1480 Node* result = try_control.GetResultValueNode();
1475 Node* token = try_control.GetDispatchTokenNode(); 1481 Node* token = try_control.GetDispatchTokenNode();
1476 1482
1477 // The result value, dispatch token and message is expected on the operand 1483 // The result value, dispatch token and message is expected on the operand
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 // Phi does not exist yet, introduce one. 4291 // Phi does not exist yet, introduce one.
4286 value = NewPhi(inputs, value, control); 4292 value = NewPhi(inputs, value, control);
4287 value->ReplaceInput(inputs - 1, other); 4293 value->ReplaceInput(inputs - 1, other);
4288 } 4294 }
4289 return value; 4295 return value;
4290 } 4296 }
4291 4297
4292 } // namespace compiler 4298 } // namespace compiler
4293 } // namespace internal 4299 } // namespace internal
4294 } // namespace v8 4300 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698