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

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

Issue 1682853004: [interpreter, debugger] implement bytecode break location iterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix build Created 4 years, 10 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 #include "src/compiler.h"
6 7
7 namespace v8 { 8 namespace v8 {
8 namespace internal { 9 namespace internal {
9 namespace interpreter { 10 namespace interpreter {
10 11
11 class BytecodeArrayBuilder::PreviousBytecodeHelper BASE_EMBEDDED { 12 class BytecodeArrayBuilder::PreviousBytecodeHelper BASE_EMBEDDED {
12 public: 13 public:
13 explicit PreviousBytecodeHelper(const BytecodeArrayBuilder& array_builder) 14 explicit PreviousBytecodeHelper(const BytecodeArrayBuilder& array_builder)
14 : array_builder_(array_builder), 15 : array_builder_(array_builder),
15 previous_bytecode_start_(array_builder_.last_bytecode_start_) { 16 previous_bytecode_start_(array_builder_.last_bytecode_start_) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 109 }
109 110
110 111
111 bool BytecodeArrayBuilder::RegisterIsParameterOrLocal(Register reg) const { 112 bool BytecodeArrayBuilder::RegisterIsParameterOrLocal(Register reg) const {
112 return reg.is_parameter() || reg.index() < locals_count(); 113 return reg.is_parameter() || reg.index() < locals_count();
113 } 114 }
114 115
115 116
116 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { 117 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
117 DCHECK_EQ(bytecode_generated_, false); 118 DCHECK_EQ(bytecode_generated_, false);
118 EnsureReturn(); 119 DCHECK(exit_seen_in_block_);
119 120
120 int bytecode_size = static_cast<int>(bytecodes_.size()); 121 int bytecode_size = static_cast<int>(bytecodes_.size());
121 int register_count = 122 int register_count =
122 fixed_and_temporary_register_count() + translation_register_count(); 123 fixed_and_temporary_register_count() + translation_register_count();
123 int frame_size = register_count * kPointerSize; 124 int frame_size = register_count * kPointerSize;
124 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray(); 125 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray();
125 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable(); 126 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable();
126 Handle<FixedArray> source_position_table = 127 Handle<FixedArray> source_position_table =
127 source_position_table_builder()->ToFixedArray(); 128 source_position_table_builder()->ToFixedArray();
128 Handle<BytecodeArray> output = isolate_->factory()->NewBytecodeArray( 129 Handle<BytecodeArray> output = isolate_->factory()->NewBytecodeArray(
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 handler_table_builder()->SetTryRegionEnd(handler_id, bytecodes()->size()); 1068 handler_table_builder()->SetTryRegionEnd(handler_id, bytecodes()->size());
1068 return *this; 1069 return *this;
1069 } 1070 }
1070 1071
1071 1072
1072 void BytecodeArrayBuilder::LeaveBasicBlock() { 1073 void BytecodeArrayBuilder::LeaveBasicBlock() {
1073 last_block_end_ = bytecodes()->size(); 1074 last_block_end_ = bytecodes()->size();
1074 exit_seen_in_block_ = false; 1075 exit_seen_in_block_ = false;
1075 } 1076 }
1076 1077
1077 1078 void BytecodeArrayBuilder::EnsureReturn(FunctionLiteral* literal) {
1078 void BytecodeArrayBuilder::EnsureReturn() {
1079 if (!exit_seen_in_block_) { 1079 if (!exit_seen_in_block_) {
1080 LoadUndefined(); 1080 LoadUndefined();
1081 SetReturnPosition(literal);
1081 Return(); 1082 Return();
1082 } 1083 }
1083 } 1084 }
1084 1085
1085 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, 1086 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
1086 Register receiver_args, 1087 Register receiver_args,
1087 size_t receiver_args_count, 1088 size_t receiver_args_count,
1088 int feedback_slot) { 1089 int feedback_slot) {
1089 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) && 1090 if (FitsInReg8Operand(callable) && FitsInReg8Operand(receiver_args) &&
1090 FitsInIdx8Operand(receiver_args_count) && 1091 FitsInIdx8Operand(receiver_args_count) &&
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 BytecodeArrayBuilder& BytecodeArrayBuilder::DeleteLookupSlot() { 1207 BytecodeArrayBuilder& BytecodeArrayBuilder::DeleteLookupSlot() {
1207 Output(Bytecode::kDeleteLookupSlot); 1208 Output(Bytecode::kDeleteLookupSlot);
1208 return *this; 1209 return *this;
1209 } 1210 }
1210 1211
1211 1212
1212 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { 1213 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
1213 return constant_array_builder()->Insert(object); 1214 return constant_array_builder()->Insert(object);
1214 } 1215 }
1215 1216
1217 void BytecodeArrayBuilder::SetReturnPosition(FunctionLiteral* fun) {
1218 int pos = std::max(fun->start_position(), fun->end_position() - 1);
1219 source_position_table_builder_.AddStatementPosition(bytecodes_.size(), pos);
1220 }
1221
1216 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) { 1222 void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) {
1217 if (stmt->position() == RelocInfo::kNoPosition) return; 1223 if (stmt->position() == RelocInfo::kNoPosition) return;
1218 source_position_table_builder_.AddStatementPosition(bytecodes_.size(), 1224 source_position_table_builder_.AddStatementPosition(bytecodes_.size(),
1219 stmt->position()); 1225 stmt->position());
1220 } 1226 }
1221 1227
1222 void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) { 1228 void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) {
1223 if (expr->position() == RelocInfo::kNoPosition) return; 1229 if (expr->position() == RelocInfo::kNoPosition) return;
1224 source_position_table_builder_.AddExpressionPosition(bytecodes_.size(), 1230 source_position_table_builder_.AddExpressionPosition(bytecodes_.size(),
1225 expr->position()); 1231 expr->position());
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 } 1698 }
1693 1699
1694 // static 1700 // static
1695 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { 1701 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) {
1696 return value.is_short_operand(); 1702 return value.is_short_operand();
1697 } 1703 }
1698 1704
1699 } // namespace interpreter 1705 } // namespace interpreter
1700 } // namespace internal 1706 } // namespace internal
1701 } // namespace v8 1707 } // 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