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

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: 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
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 return !bytecodes_.empty() &&
42 bytecodes_.back() == Bytecodes::ToByte(Bytecode::kReturn);
43 }
44
45
40 Register BytecodeArrayBuilder::Parameter(int parameter_index) { 46 Register BytecodeArrayBuilder::Parameter(int parameter_index) {
41 DCHECK_GE(parameter_index, 0); 47 DCHECK_GE(parameter_index, 0);
42 DCHECK_LT(parameter_index, parameter_count_); 48 DCHECK_LT(parameter_index, parameter_count_);
43 return Register::FromParameterIndex(parameter_index, parameter_count_); 49 return Register::FromParameterIndex(parameter_index, parameter_count_);
44 } 50 }
45 51
46 52
47 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { 53 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
48 DCHECK_EQ(bytecode_generated_, false); 54 DCHECK_EQ(bytecode_generated_, false);
49 DCHECK_GE(parameter_count_, 0); 55 DCHECK_GE(parameter_count_, 0);
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 332
327 Register TemporaryRegisterScope::NewRegister() { 333 Register TemporaryRegisterScope::NewRegister() {
328 count_++; 334 count_++;
329 last_register_index_ = builder_->BorrowTemporaryRegister(); 335 last_register_index_ = builder_->BorrowTemporaryRegister();
330 return Register(last_register_index_); 336 return Register(last_register_index_);
331 } 337 }
332 338
333 } // namespace interpreter 339 } // namespace interpreter
334 } // namespace internal 340 } // namespace internal
335 } // namespace v8 341 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698