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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2501503005: [Interpreter] Add SetPendingMessage bytecode. (Closed)
Patch Set: cl format Created 4 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 | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-info.h" 10 #include "src/compilation-info.h"
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 Visit(stmt->try_block()); 1293 Visit(stmt->try_block());
1294 } 1294 }
1295 try_control_builder.EndTry(); 1295 try_control_builder.EndTry();
1296 1296
1297 // Create a catch scope that binds the exception. 1297 // Create a catch scope that binds the exception.
1298 BuildNewLocalCatchContext(stmt->variable(), stmt->scope()); 1298 BuildNewLocalCatchContext(stmt->variable(), stmt->scope());
1299 builder()->StoreAccumulatorInRegister(context); 1299 builder()->StoreAccumulatorInRegister(context);
1300 1300
1301 // If requested, clear message object as we enter the catch block. 1301 // If requested, clear message object as we enter the catch block.
1302 if (stmt->clear_pending_message()) { 1302 if (stmt->clear_pending_message()) {
1303 builder()->CallRuntime(Runtime::kInterpreterClearPendingMessage); 1303 builder()->LoadTheHole().SetPendingMessage();
1304 } 1304 }
1305 1305
1306 // Load the catch context into the accumulator. 1306 // Load the catch context into the accumulator.
1307 builder()->LoadAccumulatorWithRegister(context); 1307 builder()->LoadAccumulatorWithRegister(context);
1308 1308
1309 // Evaluate the catch-block. 1309 // Evaluate the catch-block.
1310 VisitInScope(stmt->catch_block(), stmt->scope()); 1310 VisitInScope(stmt->catch_block(), stmt->scope());
1311 try_control_builder.EndCatch(); 1311 try_control_builder.EndCatch();
1312 } 1312 }
1313 1313
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 commands.RecordFallThroughPath(); 1352 commands.RecordFallThroughPath();
1353 try_control_builder.LeaveTry(); 1353 try_control_builder.LeaveTry();
1354 try_control_builder.BeginHandler(); 1354 try_control_builder.BeginHandler();
1355 commands.RecordHandlerReThrowPath(); 1355 commands.RecordHandlerReThrowPath();
1356 1356
1357 // Pending message object is saved on entry. 1357 // Pending message object is saved on entry.
1358 try_control_builder.BeginFinally(); 1358 try_control_builder.BeginFinally();
1359 Register message = context; // Reuse register. 1359 Register message = context; // Reuse register.
1360 1360
1361 // Clear message object as we enter the finally block. 1361 // Clear message object as we enter the finally block.
1362 builder() 1362 builder()->LoadTheHole().SetPendingMessage().StoreAccumulatorInRegister(
1363 ->CallRuntime(Runtime::kInterpreterClearPendingMessage) 1363 message);
1364 .StoreAccumulatorInRegister(message);
1365 1364
1366 // Evaluate the finally-block. 1365 // Evaluate the finally-block.
1367 Visit(stmt->finally_block()); 1366 Visit(stmt->finally_block());
1368 try_control_builder.EndFinally(); 1367 try_control_builder.EndFinally();
1369 1368
1370 // Pending message object is restored on exit. 1369 // Pending message object is restored on exit.
1371 builder()->CallRuntime(Runtime::kInterpreterSetPendingMessage, message); 1370 builder()->LoadAccumulatorWithRegister(message).SetPendingMessage();
1372 1371
1373 // Dynamic dispatch after the finally-block. 1372 // Dynamic dispatch after the finally-block.
1374 commands.ApplyDeferredCommands(); 1373 commands.ApplyDeferredCommands();
1375 } 1374 }
1376 1375
1377 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) { 1376 void BytecodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) {
1378 builder()->SetStatementPosition(stmt); 1377 builder()->SetStatementPosition(stmt);
1379 builder()->Debugger(); 1378 builder()->Debugger();
1380 } 1379 }
1381 1380
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 } 3185 }
3187 3186
3188 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3187 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3189 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3188 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3190 : Runtime::kStoreKeyedToSuper_Sloppy; 3189 : Runtime::kStoreKeyedToSuper_Sloppy;
3191 } 3190 }
3192 3191
3193 } // namespace interpreter 3192 } // namespace interpreter
3194 } // namespace internal 3193 } // namespace internal
3195 } // namespace v8 3194 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698