| 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 "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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   594   if (scope()->NeedsContext()) { |   594   if (scope()->NeedsContext()) { | 
|   595     // Push a new inner context scope for the function. |   595     // Push a new inner context scope for the function. | 
|   596     VisitNewLocalFunctionContext(); |   596     VisitNewLocalFunctionContext(); | 
|   597     ContextScope local_function_context(this, scope(), false); |   597     ContextScope local_function_context(this, scope(), false); | 
|   598     VisitBuildLocalActivationContext(); |   598     VisitBuildLocalActivationContext(); | 
|   599     MakeBytecodeBody(); |   599     MakeBytecodeBody(); | 
|   600   } else { |   600   } else { | 
|   601     MakeBytecodeBody(); |   601     MakeBytecodeBody(); | 
|   602   } |   602   } | 
|   603  |   603  | 
 |   604   // In generator functions, we may not have visited every yield in the AST | 
 |   605   // since we skip some obviously dead code. Hence the generated bytecode may | 
 |   606   // contain jumps to unbound labels (resume points that will never be used). | 
 |   607   // We bind these now. | 
 |   608   for (auto& label : generator_resume_points_) { | 
 |   609     if (!label.is_bound()) builder()->Bind(&label); | 
 |   610   } | 
 |   611  | 
|   604   builder()->EnsureReturn(); |   612   builder()->EnsureReturn(); | 
|   605   return builder()->ToBytecodeArray(); |   613   return builder()->ToBytecodeArray(); | 
|   606 } |   614 } | 
|   607  |   615  | 
|   608  |   616  | 
|   609 void BytecodeGenerator::MakeBytecodeBody() { |   617 void BytecodeGenerator::MakeBytecodeBody() { | 
|   610   // Build the arguments object if it is used. |   618   // Build the arguments object if it is used. | 
|   611   VisitArgumentsObject(scope()->arguments()); |   619   VisitArgumentsObject(scope()->arguments()); | 
|   612  |   620  | 
|   613   // Build rest arguments array if it is used. |   621   // Build rest arguments array if it is used. | 
| (...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3263 } |  3271 } | 
|  3264  |  3272  | 
|  3265  |  3273  | 
|  3266 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |  3274 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 
|  3267   return info()->shared_info()->feedback_vector()->GetIndex(slot); |  3275   return info()->shared_info()->feedback_vector()->GetIndex(slot); | 
|  3268 } |  3276 } | 
|  3269  |  3277  | 
|  3270 }  // namespace interpreter |  3278 }  // namespace interpreter | 
|  3271 }  // namespace internal |  3279 }  // namespace internal | 
|  3272 }  // namespace v8 |  3280 }  // namespace v8 | 
| OLD | NEW |