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

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

Issue 998943003: Simplify pending message object handling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. Created 5 years, 9 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/assembler.cc ('k') | src/full-codegen.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/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 // TODO(mstarzinger): Remove bailout once everything works. 1257 // TODO(mstarzinger): Remove bailout once everything works.
1258 if (!FLAG_turbo_exceptions) SetStackOverflow(); 1258 if (!FLAG_turbo_exceptions) SetStackOverflow();
1259 } 1259 }
1260 1260
1261 1261
1262 void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { 1262 void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
1263 TryFinallyBuilder try_control(this); 1263 TryFinallyBuilder try_control(this);
1264 1264
1265 ExternalReference message_object = 1265 ExternalReference message_object =
1266 ExternalReference::address_of_pending_message_obj(isolate()); 1266 ExternalReference::address_of_pending_message_obj(isolate());
1267 ExternalReference message_present =
1268 ExternalReference::address_of_has_pending_message(isolate());
1269 1267
1270 // We keep a record of all paths that enter the finally-block to be able to 1268 // We keep a record of all paths that enter the finally-block to be able to
1271 // dispatch to the correct continuation point after the statements in the 1269 // dispatch to the correct continuation point after the statements in the
1272 // finally-block have been evaluated. 1270 // finally-block have been evaluated.
1273 // 1271 //
1274 // The try-finally construct can enter the finally-block in three ways: 1272 // The try-finally construct can enter the finally-block in three ways:
1275 // 1. By exiting the try-block normally, falling through at the end. 1273 // 1. By exiting the try-block normally, falling through at the end.
1276 // 2. By exiting the try-block with a function-local control flow transfer 1274 // 2. By exiting the try-block with a function-local control flow transfer
1277 // (i.e. through break/continue/return statements). 1275 // (i.e. through break/continue/return statements).
1278 // 3. By exiting the try-block with a thrown exception. 1276 // 3. By exiting the try-block with a thrown exception.
(...skipping 16 matching lines...) Expand all
1295 // - BreakStatement/ContinueStatement: Filled with the hole. 1293 // - BreakStatement/ContinueStatement: Filled with the hole.
1296 // - Falling through into finally-block: Filled with the hole. 1294 // - Falling through into finally-block: Filled with the hole.
1297 Node* result = try_control.GetResultValueNode(); 1295 Node* result = try_control.GetResultValueNode();
1298 Node* token = try_control.GetDispatchTokenNode(); 1296 Node* token = try_control.GetDispatchTokenNode();
1299 1297
1300 // The result value, dispatch token and message is expected on the operand 1298 // The result value, dispatch token and message is expected on the operand
1301 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock). 1299 // stack (this is in sync with FullCodeGenerator::EnterFinallyBlock).
1302 environment()->Push(token); // TODO(mstarzinger): Cook token! 1300 environment()->Push(token); // TODO(mstarzinger): Cook token!
1303 environment()->Push(result); 1301 environment()->Push(result);
1304 environment()->Push(BuildLoadExternal(message_object, kMachAnyTagged)); 1302 environment()->Push(BuildLoadExternal(message_object, kMachAnyTagged));
1305 environment()->Push(BuildLoadExternal(message_present, kMachBool));
1306 1303
1307 // Evaluate the finally-block. 1304 // Evaluate the finally-block.
1308 Visit(stmt->finally_block()); 1305 Visit(stmt->finally_block());
1309 try_control.EndFinally(); 1306 try_control.EndFinally();
1310 1307
1311 // The result value, dispatch token and message is restored from the operand 1308 // The result value, dispatch token and message is restored from the operand
1312 // stack (this is in sync with FullCodeGenerator::ExitFinallyBlock). 1309 // stack (this is in sync with FullCodeGenerator::ExitFinallyBlock).
1313 BuildStoreExternal(message_present, kMachBool, environment()->Pop());
1314 BuildStoreExternal(message_object, kMachAnyTagged, environment()->Pop()); 1310 BuildStoreExternal(message_object, kMachAnyTagged, environment()->Pop());
1315 result = environment()->Pop(); 1311 result = environment()->Pop();
1316 token = environment()->Pop(); // TODO(mstarzinger): Uncook token! 1312 token = environment()->Pop(); // TODO(mstarzinger): Uncook token!
1317 1313
1318 // Dynamic dispatch after the finally-block. 1314 // Dynamic dispatch after the finally-block.
1319 commands->ApplyDeferredCommands(token, result); 1315 commands->ApplyDeferredCommands(token, result);
1320 1316
1321 // TODO(mstarzinger): Remove bailout once everything works. 1317 // TODO(mstarzinger): Remove bailout once everything works.
1322 if (!FLAG_turbo_exceptions) SetStackOverflow(); 1318 if (!FLAG_turbo_exceptions) SetStackOverflow();
1323 } 1319 }
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3333 // Phi does not exist yet, introduce one. 3329 // Phi does not exist yet, introduce one.
3334 value = NewPhi(inputs, value, control); 3330 value = NewPhi(inputs, value, control);
3335 value->ReplaceInput(inputs - 1, other); 3331 value->ReplaceInput(inputs - 1, other);
3336 } 3332 }
3337 return value; 3333 return value;
3338 } 3334 }
3339 3335
3340 } // namespace compiler 3336 } // namespace compiler
3341 } // namespace internal 3337 } // namespace internal
3342 } // namespace v8 3338 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698