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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1308693014: [Interpreter] Ensure that implicit return undefined is generated. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment Created 5 years, 3 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/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('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-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 31
32 void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) { 32 void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) {
33 parameter_count_ = number_of_parameters; 33 parameter_count_ = number_of_parameters;
34 } 34 }
35 35
36 36
37 int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; } 37 int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; }
38 38
39 39
40 bool BytecodeArrayBuilder::HasExplicitReturn() {
41 // TODO(rmcilroy): When we have control flow we should return false here if
42 // there is an outstanding jump target, even if the last bytecode is kReturn.
43 return !bytecodes_.empty() &&
44 bytecodes_.back() == Bytecodes::ToByte(Bytecode::kReturn);
45 }
46
47
40 Register BytecodeArrayBuilder::Parameter(int parameter_index) { 48 Register BytecodeArrayBuilder::Parameter(int parameter_index) {
41 DCHECK_GE(parameter_index, 0); 49 DCHECK_GE(parameter_index, 0);
42 DCHECK_LT(parameter_index, parameter_count_); 50 DCHECK_LT(parameter_index, parameter_count_);
43 return Register::FromParameterIndex(parameter_index, parameter_count_); 51 return Register::FromParameterIndex(parameter_index, parameter_count_);
44 } 52 }
45 53
46 54
47 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { 55 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
48 DCHECK_EQ(bytecode_generated_, false); 56 DCHECK_EQ(bytecode_generated_, false);
49 DCHECK_GE(parameter_count_, 0); 57 DCHECK_GE(parameter_count_, 0);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 334
327 Register TemporaryRegisterScope::NewRegister() { 335 Register TemporaryRegisterScope::NewRegister() {
328 count_++; 336 count_++;
329 last_register_index_ = builder_->BorrowTemporaryRegister(); 337 last_register_index_ = builder_->BorrowTemporaryRegister();
330 return Register(last_register_index_); 338 return Register(last_register_index_);
331 } 339 }
332 340
333 } // namespace interpreter 341 } // namespace interpreter
334 } // namespace internal 342 } // namespace internal
335 } // namespace v8 343 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698