OLD | NEW |
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 <stack> | 7 #include <stack> |
8 | 8 |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // Visit implicit declaration of the function name. | 35 // Visit implicit declaration of the function name. |
36 if (scope()->is_function_scope() && scope()->function() != NULL) { | 36 if (scope()->is_function_scope() && scope()->function() != NULL) { |
37 VisitVariableDeclaration(scope()->function()); | 37 VisitVariableDeclaration(scope()->function()); |
38 } | 38 } |
39 | 39 |
40 // Visit declarations within the function scope. | 40 // Visit declarations within the function scope. |
41 VisitDeclarations(scope()->declarations()); | 41 VisitDeclarations(scope()->declarations()); |
42 | 42 |
43 // Visit statements in the function body. | 43 // Visit statements in the function body. |
44 VisitStatements(info->function()->body()); | 44 VisitStatements(info->literal()->body()); |
45 | 45 |
46 set_scope(nullptr); | 46 set_scope(nullptr); |
47 return builder_.ToBytecodeArray(); | 47 return builder_.ToBytecodeArray(); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 void BytecodeGenerator::VisitBlock(Block* node) { | 51 void BytecodeGenerator::VisitBlock(Block* node) { |
52 if (node->scope() == NULL) { | 52 if (node->scope() == NULL) { |
53 // Visit statements in the same scope, no declarations. | 53 // Visit statements in the same scope, no declarations. |
54 VisitStatements(node->statements()); | 54 VisitStatements(node->statements()); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 361 |
362 Visit(left); | 362 Visit(left); |
363 builder().StoreAccumulatorInRegister(temporary); | 363 builder().StoreAccumulatorInRegister(temporary); |
364 Visit(right); | 364 Visit(right); |
365 builder().BinaryOperation(op, temporary); | 365 builder().BinaryOperation(op, temporary); |
366 } | 366 } |
367 | 367 |
368 } // namespace interpreter | 368 } // namespace interpreter |
369 } // namespace internal | 369 } // namespace internal |
370 } // namespace v8 | 370 } // namespace v8 |
OLD | NEW |