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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 2035813002: [Interpreter] Move jump processing to bytecode array writer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_fix_bytecode
Patch Set: Address comments Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-array-writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index b8e0c605e4e754ae7ea820764800ccf7274a1caf..fa57c16c7cca85c9faa418815cddf63dd0620b3e 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -6,6 +6,7 @@
#include "src/compiler.h"
#include "src/interpreter/bytecode-array-writer.h"
+#include "src/interpreter/bytecode-label.h"
#include "src/interpreter/bytecode-peephole-optimizer.h"
#include "src/interpreter/bytecode-register-optimizer.h"
#include "src/interpreter/interpreter-intrinsics.h"
@@ -23,14 +24,12 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone,
bytecode_generated_(false),
constant_array_builder_(isolate, zone),
handler_table_builder_(isolate, zone),
- source_position_table_builder_(isolate, zone),
return_seen_in_block_(false),
- unbound_jumps_(0),
parameter_count_(parameter_count),
local_register_count_(locals_count),
context_register_count_(context_count),
temporary_allocator_(zone, fixed_register_count()),
- bytecode_array_writer_(zone, &source_position_table_builder_),
+ bytecode_array_writer_(isolate, zone, &constant_array_builder_),
pipeline_(&bytecode_array_writer_) {
DCHECK_GE(parameter_count_, 0);
DCHECK_GE(context_register_count_, 0);
@@ -49,8 +48,6 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone,
return_position_ =
literal ? std::max(literal->start_position(), literal->end_position() - 1)
: RelocInfo::kNoPosition;
- LOG_CODE_EVENT(isolate_, CodeStartLinePosInfoRecordEvent(
- source_position_table_builder()));
}
Register BytecodeArrayBuilder::first_context_register() const {
@@ -58,55 +55,28 @@ Register BytecodeArrayBuilder::first_context_register() const {
return Register(local_register_count_);
}
-
Register BytecodeArrayBuilder::last_context_register() const {
DCHECK_GT(context_register_count_, 0);
return Register(local_register_count_ + context_register_count_ - 1);
}
-
Register BytecodeArrayBuilder::Parameter(int parameter_index) const {
DCHECK_GE(parameter_index, 0);
return Register::FromParameterIndex(parameter_index, parameter_count());
}
-
bool BytecodeArrayBuilder::RegisterIsParameterOrLocal(Register reg) const {
return reg.is_parameter() || reg.index() < locals_count();
}
-
Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() {
- DCHECK_EQ(0, unbound_jumps_);
- DCHECK_EQ(bytecode_generated_, false);
DCHECK(return_seen_in_block_);
+ DCHECK(!bytecode_generated_);
+ bytecode_generated_ = true;
- pipeline()->FlushBasicBlock();
- const ZoneVector<uint8_t>* bytecodes = bytecode_array_writer()->bytecodes();
-
- int bytecode_size = static_cast<int>(bytecodes->size());
-
- // All locals need a frame slot for the debugger, but may not be
- // present in generated code.
- int frame_size_for_locals = fixed_register_count() * kPointerSize;
- int frame_size_used = bytecode_array_writer()->GetMaximumFrameSizeUsed();
- int frame_size = std::max(frame_size_for_locals, frame_size_used);
- Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray();
Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable();
- Handle<ByteArray> source_position_table =
- source_position_table_builder()->ToSourcePositionTable();
- Handle<BytecodeArray> bytecode_array = isolate_->factory()->NewBytecodeArray(
- bytecode_size, &bytecodes->front(), frame_size, parameter_count(),
- constant_pool);
- bytecode_array->set_handler_table(*handler_table);
- bytecode_array->set_source_position_table(*source_position_table);
-
- void* line_info = source_position_table_builder()->DetachJITHandlerData();
- LOG_CODE_EVENT(isolate_, CodeEndLinePosInfoRecordEvent(
- AbstractCode::cast(*bytecode_array), line_info));
-
- bytecode_generated_ = true;
- return bytecode_array;
+ return pipeline_->ToBytecodeArray(fixed_register_count(), parameter_count(),
+ handler_table);
}
void BytecodeArrayBuilder::AttachSourceInfo(BytecodeNode* node) {
@@ -181,7 +151,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CountOperation(Token::Value op) {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LogicalNot() {
Output(Bytecode::kToBooleanLogicalNot);
return *this;
@@ -202,7 +171,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(Token::Value op,
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(
v8::internal::Smi* smi) {
int32_t raw_smi = smi->value();
@@ -217,7 +185,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(Handle<Object> object) {
size_t entry = GetConstantPoolEntry(object);
OperandScale operand_scale =
@@ -226,31 +193,26 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(Handle<Object> object) {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadUndefined() {
Output(Bytecode::kLdaUndefined);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNull() {
Output(Bytecode::kLdaNull);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadTheHole() {
Output(Bytecode::kLdaTheHole);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadTrue() {
Output(Bytecode::kLdaTrue);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadFalse() {
Output(Bytecode::kLdaFalse);
return *this;
@@ -264,7 +226,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadAccumulatorWithRegister(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
Register reg) {
OperandScale operand_scale =
@@ -273,7 +234,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::MoveRegister(Register from,
Register to) {
DCHECK(from != to);
@@ -310,7 +270,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
int slot_index) {
OperandScale operand_scale = Bytecodes::OperandSizesToScale(
@@ -320,7 +279,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context,
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context,
int slot_index) {
OperandScale operand_scale = Bytecodes::OperandSizesToScale(
@@ -386,7 +344,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
Register object, Register key, int feedback_slot,
LanguageMode language_mode) {
@@ -399,7 +356,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
Handle<SharedFunctionInfo> shared_info, PretenureFlag tenured) {
size_t entry = GetConstantPoolEntry(shared_info);
@@ -410,7 +366,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments(
CreateArgumentsType type) {
// TODO(rmcilroy): Consider passing the type as a bytecode operand rather
@@ -421,7 +376,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
Handle<String> pattern, int literal_index, int flags) {
size_t pattern_entry = GetConstantPoolEntry(pattern);
@@ -435,7 +389,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
Handle<FixedArray> constant_elements, int literal_index, int flags) {
size_t constant_elements_entry = GetConstantPoolEntry(constant_elements);
@@ -449,7 +402,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral(
Handle<FixedArray> constant_properties, int literal_index, int flags) {
size_t constant_properties_entry = GetConstantPoolEntry(constant_properties);
@@ -463,7 +415,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
OperandScale operand_scale =
Bytecodes::OperandSizesToScale(context.SizeOfOperand());
@@ -471,7 +422,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
OperandScale operand_scale =
Bytecodes::OperandSizesToScale(context.SizeOfOperand());
@@ -479,13 +429,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToJSObject() {
Output(Bytecode::kToObject);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToName() {
Output(Bytecode::kToName);
return *this;
@@ -496,204 +444,24 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToNumber() {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(BytecodeLabel* label) {
- size_t current_offset = pipeline()->FlushForOffset();
- if (label->is_forward_target()) {
- // An earlier jump instruction refers to this label. Update it's location.
- PatchJump(current_offset, label->offset());
- // Now treat as if the label will only be back referred to.
- }
- label->bind_to(current_offset);
+ pipeline_->BindLabel(label);
LeaveBasicBlock();
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(const BytecodeLabel& target,
BytecodeLabel* label) {
- DCHECK(!label->is_bound());
- DCHECK(target.is_bound());
- // There is no need to flush the pipeline here, it will have been
- // flushed when |target| was bound.
- if (label->is_forward_target()) {
- // An earlier jump instruction refers to this label. Update it's location.
- PatchJump(target.offset(), label->offset());
- // Now treat as if the label will only be back referred to.
- }
- label->bind_to(target.offset());
+ pipeline_->BindLabel(target, label);
LeaveBasicBlock();
return *this;
}
-
-// static
-Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand(
- Bytecode jump_bytecode) {
- switch (jump_bytecode) {
- case Bytecode::kJump:
- return Bytecode::kJumpConstant;
- case Bytecode::kJumpIfTrue:
- return Bytecode::kJumpIfTrueConstant;
- case Bytecode::kJumpIfFalse:
- return Bytecode::kJumpIfFalseConstant;
- case Bytecode::kJumpIfToBooleanTrue:
- return Bytecode::kJumpIfToBooleanTrueConstant;
- case Bytecode::kJumpIfToBooleanFalse:
- return Bytecode::kJumpIfToBooleanFalseConstant;
- case Bytecode::kJumpIfNotHole:
- return Bytecode::kJumpIfNotHoleConstant;
- case Bytecode::kJumpIfNull:
- return Bytecode::kJumpIfNullConstant;
- case Bytecode::kJumpIfUndefined:
- return Bytecode::kJumpIfUndefinedConstant;
- default:
- UNREACHABLE();
- return Bytecode::kIllegal;
- }
-}
-
-void BytecodeArrayBuilder::PatchJumpWith8BitOperand(
- ZoneVector<uint8_t>* bytecodes, size_t jump_location, int delta) {
- Bytecode jump_bytecode = Bytecodes::FromByte(bytecodes->at(jump_location));
- DCHECK(Bytecodes::IsJumpImmediate(jump_bytecode));
- size_t operand_location = jump_location + 1;
- DCHECK_EQ(bytecodes->at(operand_location), 0);
- if (Bytecodes::SizeForSignedOperand(delta) == OperandSize::kByte) {
- // The jump fits within the range of an Imm operand, so cancel
- // the reservation and jump directly.
- constant_array_builder()->DiscardReservedEntry(OperandSize::kByte);
- bytecodes->at(operand_location) = static_cast<uint8_t>(delta);
- } else {
- // The jump does not fit within the range of an Imm operand, so
- // commit reservation putting the offset into the constant pool,
- // and update the jump instruction and operand.
- size_t entry = constant_array_builder()->CommitReservedEntry(
- OperandSize::kByte, handle(Smi::FromInt(delta), isolate()));
- DCHECK(Bytecodes::SizeForUnsignedOperand(entry) == OperandSize::kByte);
- jump_bytecode = GetJumpWithConstantOperand(jump_bytecode);
- bytecodes->at(jump_location) = Bytecodes::ToByte(jump_bytecode);
- bytecodes->at(operand_location) = static_cast<uint8_t>(entry);
- }
-}
-
-void BytecodeArrayBuilder::PatchJumpWith16BitOperand(
- ZoneVector<uint8_t>* bytecodes, size_t jump_location, int delta) {
- Bytecode jump_bytecode = Bytecodes::FromByte(bytecodes->at(jump_location));
- DCHECK(Bytecodes::IsJumpImmediate(jump_bytecode));
- size_t operand_location = jump_location + 1;
- uint8_t operand_bytes[2];
- if (Bytecodes::SizeForSignedOperand(delta) <= OperandSize::kShort) {
- constant_array_builder()->DiscardReservedEntry(OperandSize::kShort);
- WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(delta));
- } else {
- jump_bytecode = GetJumpWithConstantOperand(jump_bytecode);
- bytecodes->at(jump_location) = Bytecodes::ToByte(jump_bytecode);
- size_t entry = constant_array_builder()->CommitReservedEntry(
- OperandSize::kShort, handle(Smi::FromInt(delta), isolate()));
- WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(entry));
- }
- DCHECK(bytecodes->at(operand_location) == 0 &&
- bytecodes->at(operand_location + 1) == 0);
- bytecodes->at(operand_location++) = operand_bytes[0];
- bytecodes->at(operand_location) = operand_bytes[1];
-}
-
-void BytecodeArrayBuilder::PatchJumpWith32BitOperand(
- ZoneVector<uint8_t>* bytecodes, size_t jump_location, int delta) {
- DCHECK(Bytecodes::IsJumpImmediate(
- Bytecodes::FromByte(bytecodes->at(jump_location))));
- constant_array_builder()->DiscardReservedEntry(OperandSize::kQuad);
- uint8_t operand_bytes[4];
- WriteUnalignedUInt32(operand_bytes, static_cast<uint32_t>(delta));
- size_t operand_location = jump_location + 1;
- DCHECK(bytecodes->at(operand_location) == 0 &&
- bytecodes->at(operand_location + 1) == 0 &&
- bytecodes->at(operand_location + 2) == 0 &&
- bytecodes->at(operand_location + 3) == 0);
- bytecodes->at(operand_location++) = operand_bytes[0];
- bytecodes->at(operand_location++) = operand_bytes[1];
- bytecodes->at(operand_location++) = operand_bytes[2];
- bytecodes->at(operand_location) = operand_bytes[3];
-}
-
-void BytecodeArrayBuilder::PatchJump(size_t jump_target, size_t jump_location) {
- ZoneVector<uint8_t>* bytecodes = bytecode_array_writer()->bytecodes();
- Bytecode jump_bytecode = Bytecodes::FromByte(bytecodes->at(jump_location));
- int delta = static_cast<int>(jump_target - jump_location);
- int prefix_offset = 0;
- OperandScale operand_scale = OperandScale::kSingle;
- if (Bytecodes::IsPrefixScalingBytecode(jump_bytecode)) {
- // If a prefix scaling bytecode is emitted the target offset is one
- // less than the case of no prefix scaling bytecode.
- delta -= 1;
- prefix_offset = 1;
- operand_scale = Bytecodes::PrefixBytecodeToOperandScale(jump_bytecode);
- jump_bytecode =
- Bytecodes::FromByte(bytecodes->at(jump_location + prefix_offset));
- }
-
- DCHECK(Bytecodes::IsJump(jump_bytecode));
- switch (operand_scale) {
- case OperandScale::kSingle:
- PatchJumpWith8BitOperand(bytecodes, jump_location, delta);
- break;
- case OperandScale::kDouble:
- PatchJumpWith16BitOperand(bytecodes, jump_location + prefix_offset,
- delta);
- break;
- case OperandScale::kQuadruple:
- PatchJumpWith32BitOperand(bytecodes, jump_location + prefix_offset,
- delta);
- break;
- default:
- UNREACHABLE();
- }
- unbound_jumps_--;
-}
-
-
BytecodeArrayBuilder& BytecodeArrayBuilder::OutputJump(Bytecode jump_bytecode,
BytecodeLabel* label) {
- if (label->is_bound()) {
- // Label has been bound already so this is a backwards jump.
- size_t current_offset = pipeline()->FlushForOffset();
- CHECK_GE(current_offset, label->offset());
- CHECK_LE(current_offset, static_cast<size_t>(kMaxInt));
- size_t abs_delta = current_offset - label->offset();
- int delta = -static_cast<int>(abs_delta);
- OperandSize operand_size = Bytecodes::SizeForSignedOperand(delta);
- if (operand_size > OperandSize::kByte) {
- // Adjust for scaling byte prefix for wide jump offset.
- DCHECK_LE(delta, 0);
- delta -= 1;
- }
- OutputScaled(jump_bytecode, Bytecodes::OperandSizesToScale(operand_size),
- SignedOperand(delta, operand_size));
- } else {
- // The label has not yet been bound so this is a forward reference
- // that will be patched when the label is bound. We create a
- // reservation in the constant pool so the jump can be patched
- // when the label is bound. The reservation means the maximum size
- // of the operand for the constant is known and the jump can
- // be emitted into the bytecode stream with space for the operand.
- unbound_jumps_++;
- OperandSize reserved_operand_size =
- constant_array_builder()->CreateReservedEntry();
- OutputScaled(jump_bytecode,
- Bytecodes::OperandSizesToScale(reserved_operand_size), 0);
-
- // Calculate the label position by flushing for offset after emitting the
- // jump bytecode.
- size_t offset = pipeline()->FlushForOffset();
- OperandScale operand_scale =
- Bytecodes::OperandSizesToScale(reserved_operand_size);
- offset -= Bytecodes::Size(jump_bytecode, operand_scale);
- if (Bytecodes::OperandScaleRequiresPrefixBytecode(operand_scale)) {
- offset -= 1;
- }
- label->set_referrer(offset);
- }
+ BytecodeNode node(jump_bytecode, 0, OperandScale::kSingle);
+ AttachSourceInfo(&node);
+ pipeline_->WriteJump(&node, label);
LeaveBasicBlock();
return *this;
}
@@ -723,6 +491,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfUndefined(
return OutputJump(Bytecode::kJumpIfUndefined, label);
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole(
+ BytecodeLabel* label) {
+ return OutputJump(Bytecode::kJumpIfNotHole, label);
+}
+
BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) {
if (position != RelocInfo::kNoPosition) {
// We need to attach a non-breakable source position to a stack check,
@@ -733,23 +506,16 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) {
return *this;
}
-BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole(
- BytecodeLabel* label) {
- return OutputJump(Bytecode::kJumpIfNotHole, label);
-}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::Throw() {
Output(Bytecode::kThrow);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::ReThrow() {
Output(Bytecode::kReThrow);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::Return() {
Output(Bytecode::kReturn);
return_seen_in_block_ = true;
@@ -792,7 +558,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInNext(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) {
OperandScale operand_scale =
Bytecodes::OperandSizesToScale(index.SizeOfOperand());
@@ -800,7 +565,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ForInStep(Register index) {
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::SuspendGenerator(
Register generator) {
OperandScale operand_scale =
@@ -810,7 +574,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::SuspendGenerator(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::ResumeGenerator(
Register generator) {
OperandScale operand_scale =
@@ -820,37 +583,31 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::ResumeGenerator(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::MarkHandler(int handler_id,
bool will_catch) {
- size_t offset = pipeline()->FlushForOffset();
- handler_table_builder()->SetHandlerTarget(handler_id, offset);
+ BytecodeLabel handler;
+ Bind(&handler);
+ handler_table_builder()->SetHandlerTarget(handler_id, handler.offset());
handler_table_builder()->SetPrediction(handler_id, will_catch);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::MarkTryBegin(int handler_id,
Register context) {
- size_t offset = pipeline()->FlushForOffset();
- handler_table_builder()->SetTryRegionStart(handler_id, offset);
+ BytecodeLabel try_begin;
+ Bind(&try_begin);
+ handler_table_builder()->SetTryRegionStart(handler_id, try_begin.offset());
handler_table_builder()->SetContextRegister(handler_id, context);
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::MarkTryEnd(int handler_id) {
- size_t offset = pipeline()->FlushForOffset();
- handler_table_builder()->SetTryRegionEnd(handler_id, offset);
+ BytecodeLabel try_end;
+ Bind(&try_end);
+ handler_table_builder()->SetTryRegionEnd(handler_id, try_end.offset());
return *this;
}
-
-void BytecodeArrayBuilder::LeaveBasicBlock() {
- pipeline()->FlushBasicBlock();
- return_seen_in_block_ = false;
-}
-
void BytecodeArrayBuilder::EnsureReturn() {
if (!return_seen_in_block_) {
LoadUndefined();
@@ -892,7 +649,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
Runtime::FunctionId function_id, Register first_arg, size_t arg_count) {
DCHECK_EQ(1, Runtime::FunctionForId(function_id)->result_size);
@@ -911,7 +667,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntimeForPair(
Runtime::FunctionId function_id, Register first_arg, size_t arg_count,
Register first_return) {
@@ -942,7 +697,6 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(
return *this;
}
-
BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
LanguageMode language_mode) {
OperandScale operand_scale =
@@ -1093,7 +847,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForBinaryOperation(Token::Value op) {
}
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForCountOperation(Token::Value op) {
switch (op) {
@@ -1107,7 +860,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForCountOperation(Token::Value op) {
}
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
switch (op) {
@@ -1135,7 +887,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
}
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForStoreNamedProperty(
LanguageMode language_mode) {
@@ -1150,7 +901,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForStoreNamedProperty(
return Bytecode::kIllegal;
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForStoreKeyedProperty(
LanguageMode language_mode) {
@@ -1165,14 +915,12 @@ Bytecode BytecodeArrayBuilder::BytecodeForStoreKeyedProperty(
return Bytecode::kIllegal;
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal(TypeofMode typeof_mode) {
return typeof_mode == INSIDE_TYPEOF ? Bytecode::kLdaGlobalInsideTypeof
: Bytecode::kLdaGlobal;
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForStoreGlobal(
LanguageMode language_mode) {
@@ -1187,7 +935,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForStoreGlobal(
return Bytecode::kIllegal;
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForStoreLookupSlot(
LanguageMode language_mode) {
@@ -1217,7 +964,6 @@ Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments(
return Bytecode::kIllegal;
}
-
// static
Bytecode BytecodeArrayBuilder::BytecodeForDelete(LanguageMode language_mode) {
switch (language_mode) {
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-array-writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698