| Index: runtime/vm/regexp_assembler_bytecode.cc
|
| diff --git a/runtime/vm/regexp_assembler_bytecode.cc b/runtime/vm/regexp_assembler_bytecode.cc
|
| index 986c0e30fcc658f0ea5205bb0131a8084c578f74..a67c37b9960006fd40d57fe902efb9e41913d87d 100644
|
| --- a/runtime/vm/regexp_assembler_bytecode.cc
|
| +++ b/runtime/vm/regexp_assembler_bytecode.cc
|
| @@ -22,7 +22,7 @@ BytecodeRegExpMacroAssembler::BytecodeRegExpMacroAssembler(
|
| : RegExpMacroAssembler(zone),
|
| buffer_(buffer),
|
| pc_(0),
|
| - advance_current_end_(kInvalidPC) { }
|
| + advance_current_end_(kInvalidPC) {}
|
|
|
|
|
| BytecodeRegExpMacroAssembler::~BytecodeRegExpMacroAssembler() {
|
| @@ -81,7 +81,8 @@ void BytecodeRegExpMacroAssembler::PushRegister(intptr_t register_index) {
|
|
|
|
|
| void BytecodeRegExpMacroAssembler::WriteCurrentPositionToRegister(
|
| - intptr_t register_index, intptr_t cp_offset) {
|
| + intptr_t register_index,
|
| + intptr_t cp_offset) {
|
| ASSERT(register_index >= 0);
|
| ASSERT(register_index <= kMaxRegister);
|
| Emit(BC_SET_REGISTER_TO_CP, register_index);
|
| @@ -204,7 +205,7 @@ void BytecodeRegExpMacroAssembler::AdvanceCurrentPosition(intptr_t by) {
|
|
|
|
|
| void BytecodeRegExpMacroAssembler::CheckGreedyLoop(
|
| - BlockLabel* on_tos_equals_current_position) {
|
| + BlockLabel* on_tos_equals_current_position) {
|
| Emit(BC_CHECK_GREEDY, 0);
|
| EmitOrLink(on_tos_equals_current_position);
|
| }
|
| @@ -356,8 +357,8 @@ void BytecodeRegExpMacroAssembler::CheckCharacterNotInRange(
|
| }
|
|
|
|
|
| -void BytecodeRegExpMacroAssembler::CheckBitInTable(
|
| - const TypedData& table, BlockLabel* on_bit_set) {
|
| +void BytecodeRegExpMacroAssembler::CheckBitInTable(const TypedData& table,
|
| + BlockLabel* on_bit_set) {
|
| Emit(BC_CHECK_BIT_IN_TABLE, 0);
|
| EmitOrLink(on_bit_set);
|
| for (int i = 0; i < kTableSize; i += kBitsPerByte) {
|
| @@ -449,28 +450,30 @@ void BytecodeRegExpMacroAssembler::Expand() {
|
| buffer_->Add(0);
|
| buffer_->Add(0);
|
| intptr_t x = buffer_->length();
|
| - for (intptr_t i = 0; i < x; i++) buffer_->Add(0);
|
| + for (intptr_t i = 0; i < x; i++)
|
| + buffer_->Add(0);
|
| }
|
|
|
|
|
| static intptr_t Prepare(const RegExp& regexp,
|
| const String& subject,
|
| Zone* zone) {
|
| - bool is_one_byte = subject.IsOneByteString() ||
|
| - subject.IsExternalOneByteString();
|
| + bool is_one_byte =
|
| + subject.IsOneByteString() || subject.IsExternalOneByteString();
|
|
|
| if (regexp.bytecode(is_one_byte) == TypedData::null()) {
|
| const String& pattern = String::Handle(zone, regexp.pattern());
|
| - NOT_IN_PRODUCT(TimelineDurationScope tds(Thread::Current(),
|
| - Timeline::GetCompilerStream(),
|
| - "CompileIrregexpBytecode");
|
| +#if !defined(PRODUCT)
|
| + TimelineDurationScope tds(Thread::Current(), Timeline::GetCompilerStream(),
|
| + "CompileIrregexpBytecode");
|
| if (tds.enabled()) {
|
| tds.SetNumArguments(1);
|
| tds.CopyArgument(0, "pattern", pattern.ToCString());
|
| - }); // !PRODUCT
|
| + }
|
| +#endif // !defined(PRODUCT)
|
|
|
| const bool multiline = regexp.is_multi_line();
|
| - RegExpCompileData* compile_data = new(zone) RegExpCompileData();
|
| + RegExpCompileData* compile_data = new (zone) RegExpCompileData();
|
| if (!RegExpParser::ParseRegExp(pattern, multiline, compile_data)) {
|
| // Parsing failures are handled in the RegExp factory constructor.
|
| UNREACHABLE();
|
| @@ -505,15 +508,15 @@ static IrregexpInterpreter::IrregexpResult ExecRaw(const RegExp& regexp,
|
| int32_t* output,
|
| intptr_t output_size,
|
| Zone* zone) {
|
| - bool is_one_byte = subject.IsOneByteString() ||
|
| - subject.IsExternalOneByteString();
|
| + bool is_one_byte =
|
| + subject.IsOneByteString() || subject.IsExternalOneByteString();
|
|
|
| ASSERT(regexp.num_bracket_expressions() != Smi::null());
|
|
|
| // We must have done EnsureCompiledIrregexp, so we can get the number of
|
| // registers.
|
| int number_of_capture_registers =
|
| - (Smi::Value(regexp.num_bracket_expressions()) + 1) * 2;
|
| + (Smi::Value(regexp.num_bracket_expressions()) + 1) * 2;
|
| int32_t* raw_output = &output[number_of_capture_registers];
|
|
|
| // We do not touch the actual capture result registers until we know there
|
| @@ -558,21 +561,17 @@ RawInstance* BytecodeRegExpMacroAssembler::Interpret(const RegExp& regexp,
|
| // V8 uses a shared copy on the isolate when smaller than some threshold.
|
| int32_t* output_registers = zone->Alloc<int32_t>(required_registers);
|
|
|
| - IrregexpInterpreter::IrregexpResult result = ExecRaw(regexp,
|
| - subject,
|
| - start_index.Value(),
|
| - output_registers,
|
| - required_registers,
|
| - zone);
|
| + IrregexpInterpreter::IrregexpResult result =
|
| + ExecRaw(regexp, subject, start_index.Value(), output_registers,
|
| + required_registers, zone);
|
|
|
| if (result == IrregexpInterpreter::RE_SUCCESS) {
|
| intptr_t capture_count = Smi::Value(regexp.num_bracket_expressions());
|
| intptr_t capture_register_count = (capture_count + 1) * 2;
|
| ASSERT(required_registers >= capture_register_count);
|
|
|
| - const TypedData& result =
|
| - TypedData::Handle(TypedData::New(kTypedDataInt32ArrayCid,
|
| - capture_register_count));
|
| + const TypedData& result = TypedData::Handle(
|
| + TypedData::New(kTypedDataInt32ArrayCid, capture_register_count));
|
| {
|
| #ifdef DEBUG
|
| // These indices will be used with substring operations that don't check
|
| @@ -584,8 +583,7 @@ RawInstance* BytecodeRegExpMacroAssembler::Interpret(const RegExp& regexp,
|
| #endif
|
|
|
| NoSafepointScope no_safepoint;
|
| - memmove(result.DataAddr(0),
|
| - output_registers,
|
| + memmove(result.DataAddr(0), output_registers,
|
| capture_register_count * sizeof(int32_t));
|
| }
|
|
|
|
|