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

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

Issue 1523423003: [Interpreter] Marks that 'throw' has returned a value. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Throw always marks that a result is returned. Created 4 years, 11 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 | « no previous file | test/test262/test262.status » ('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/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/interpreter/bytecode-register-allocator.h" 9 #include "src/interpreter/bytecode-register-allocator.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Build assignment to {new.target} variable if it is used. 402 // Build assignment to {new.target} variable if it is used.
403 VisitNewTargetVariable(scope()->new_target_var()); 403 VisitNewTargetVariable(scope()->new_target_var());
404 404
405 // TODO(rmcilroy): Emit tracing call if requested to do so. 405 // TODO(rmcilroy): Emit tracing call if requested to do so.
406 if (FLAG_trace) { 406 if (FLAG_trace) {
407 UNIMPLEMENTED(); 407 UNIMPLEMENTED();
408 } 408 }
409 409
410 // Visit illegal re-declaration and bail out if it exists. 410 // Visit illegal re-declaration and bail out if it exists.
411 if (scope()->HasIllegalRedeclaration()) { 411 if (scope()->HasIllegalRedeclaration()) {
412 Visit(scope()->GetIllegalRedeclaration()); 412 VisitForEffect(scope()->GetIllegalRedeclaration());
mythria 2016/01/19 10:48:04 GetIllegalRedeclaration is an expression, so I add
rmcilroy 2016/01/19 11:45:55 SGTM
Michael Starzinger 2016/01/19 11:45:59 Acknowledged.
413 return; 413 return;
414 } 414 }
415 415
416 // Visit declarations within the function scope. 416 // Visit declarations within the function scope.
417 VisitDeclarations(scope()->declarations()); 417 VisitDeclarations(scope()->declarations());
418 418
419 // Visit statements in the function body. 419 // Visit statements in the function body.
420 VisitStatements(info()->literal()->body()); 420 VisitStatements(info()->literal()->body());
421 } 421 }
422 422
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 execution_result()->SetResultInAccumulator(); 1473 execution_result()->SetResultInAccumulator();
1474 } 1474 }
1475 1475
1476 1476
1477 void BytecodeGenerator::VisitYield(Yield* expr) { UNIMPLEMENTED(); } 1477 void BytecodeGenerator::VisitYield(Yield* expr) { UNIMPLEMENTED(); }
1478 1478
1479 1479
1480 void BytecodeGenerator::VisitThrow(Throw* expr) { 1480 void BytecodeGenerator::VisitThrow(Throw* expr) {
1481 VisitForAccumulatorValue(expr->exception()); 1481 VisitForAccumulatorValue(expr->exception());
1482 builder()->Throw(); 1482 builder()->Throw();
1483 // Throw statments are modeled as expression instead of statments. These are
1484 // converted to assignment statements in Rewriter::ReWrite pass. An
Michael Starzinger 2016/01/19 11:45:59 nit: s/to/from/
mythria 2016/01/20 13:45:10 Done.
1485 // assignment statement expects a value in the accumulator. This is a hack to
1486 // avoid DCHECK fails assert accumulator has been set.
1487 execution_result()->SetResultInAccumulator();
1483 } 1488 }
1484 1489
1485 1490
1486 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) { 1491 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) {
1487 LhsKind property_kind = Property::GetAssignType(expr); 1492 LhsKind property_kind = Property::GetAssignType(expr);
1488 FeedbackVectorSlot slot = expr->PropertyFeedbackSlot(); 1493 FeedbackVectorSlot slot = expr->PropertyFeedbackSlot();
1489 switch (property_kind) { 1494 switch (property_kind) {
1490 case VARIABLE: 1495 case VARIABLE:
1491 UNREACHABLE(); 1496 UNREACHABLE();
1492 case NAMED_PROPERTY: { 1497 case NAMED_PROPERTY: {
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 } 2221 }
2217 2222
2218 2223
2219 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2224 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2220 return info()->feedback_vector()->GetIndex(slot); 2225 return info()->feedback_vector()->GetIndex(slot);
2221 } 2226 }
2222 2227
2223 } // namespace interpreter 2228 } // namespace interpreter
2224 } // namespace internal 2229 } // namespace internal
2225 } // namespace v8 2230 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698