diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-08-01 08:38:30 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-08-01 12:53:56 +0200 |
commit | 2dcc3665abf57c3607cebffdeeca062f5894885d (patch) | |
tree | 4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/regexp | |
parent | 1ee47d550c6de132f06110aa13eceb7551d643b3 (diff) | |
download | android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.bz2 android-node-v8-2dcc3665abf57c3607cebffdeeca062f5894885d.zip |
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/regexp')
39 files changed, 540 insertions, 276 deletions
diff --git a/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.cc b/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.cc index a523ccd3d3..8b462cb03c 100644 --- a/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.cc +++ b/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.cc @@ -6,15 +6,15 @@ #include "src/regexp/arm/regexp-macro-assembler-arm.h" -#include "src/assembler-inl.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" #include "src/heap/factory.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -671,7 +671,7 @@ Handle<HeapObject> RegExpMacroAssemblerARM::GetCode(Handle<String> source) { __ bind(&stack_ok); // Allocate space on stack for registers. - __ sub(sp, sp, Operand(num_registers_ * kPointerSize)); + __ AllocateStackSpace(num_registers_ * kPointerSize); // Load string end. __ ldr(end_of_input_address(), MemOperand(frame_pointer(), kInputEnd)); // Load input start. @@ -884,8 +884,9 @@ Handle<HeapObject> RegExpMacroAssemblerARM::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); PROFILE(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); @@ -1057,7 +1058,7 @@ void RegExpMacroAssemblerARM::CallCheckStackGuardState() { // We need to make room for the return address on the stack. int stack_alignment = base::OS::ActivationFrameAlignment(); DCHECK(IsAligned(stack_alignment, kPointerSize)); - __ sub(sp, sp, Operand(stack_alignment)); + __ AllocateStackSpace(stack_alignment); // r0 will point to the return address, placed by DirectCEntry. __ mov(r0, sp); diff --git a/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.h b/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.h index c38d8a06d7..9e95f8e1f2 100644 --- a/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.h +++ b/deps/v8/src/regexp/arm/regexp-macro-assembler-arm.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ #define V8_REGEXP_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ -#include "src/arm/assembler-arm.h" -#include "src/macro-assembler.h" +#include "src/codegen/arm/assembler-arm.h" +#include "src/codegen/macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.cc b/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.cc index 70521f2603..b299ad0535 100644 --- a/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.cc +++ b/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.cc @@ -6,14 +6,14 @@ #include "src/regexp/arm64/regexp-macro-assembler-arm64.h" -#include "src/arm64/macro-assembler-arm64-inl.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/codegen/arm64/macro-assembler-arm64-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -1068,8 +1068,9 @@ Handle<HeapObject> RegExpMacroAssemblerARM64::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); PROFILE(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); @@ -1182,7 +1183,6 @@ void RegExpMacroAssemblerARM64::ReadCurrentPositionFromRegister(int reg) { break; default: UNREACHABLE(); - break; } } @@ -1514,7 +1514,6 @@ Register RegExpMacroAssemblerARM64::GetRegister(int register_index, break; default: UNREACHABLE(); - break; } DCHECK(result.Is32Bits()); return result; @@ -1548,7 +1547,6 @@ void RegExpMacroAssemblerARM64::StoreRegister(int register_index, } default: UNREACHABLE(); - break; } } diff --git a/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.h b/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.h index 9c87bf37b6..ef83f9e43c 100644 --- a/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.h +++ b/deps/v8/src/regexp/arm64/regexp-macro-assembler-arm64.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_ #define V8_REGEXP_ARM64_REGEXP_MACRO_ASSEMBLER_ARM64_H_ -#include "src/arm64/assembler-arm64.h" -#include "src/macro-assembler.h" +#include "src/codegen/arm64/assembler-arm64.h" +#include "src/codegen/macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/gen-regexp-special-case.cc b/deps/v8/src/regexp/gen-regexp-special-case.cc new file mode 100644 index 0000000000..8aace6ab88 --- /dev/null +++ b/deps/v8/src/regexp/gen-regexp-special-case.cc @@ -0,0 +1,125 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <fstream> +#include <iomanip> +#include <iostream> +#include <sstream> + +#include "src/base/logging.h" +#include "unicode/uchar.h" +#include "unicode/uniset.h" + +namespace v8 { +namespace internal { + +// The following code generates BuildSpecialAddSet() and BuildIgnoreSet() +// functions into "src/regexp/special-case.cc". +// See more details in http://shorturl.at/adfO5 +void PrintSet(std::ofstream& out, const char* func_name, + const icu::UnicodeSet& set) { + out << "icu::UnicodeSet " << func_name << "() {\n" + << " icu::UnicodeSet set;\n"; + for (int32_t i = 0; i < set.getRangeCount(); i++) { + if (set.getRangeStart(i) == set.getRangeEnd(i)) { + out << " set.add(0x" << set.getRangeStart(i) << ");\n"; + } else { + out << " set.add(0x" << set.getRangeStart(i) << ", 0x" + << set.getRangeEnd(i) << ");\n"; + } + } + out << " set.freeze();\n" + << " return set;\n" + << "}\n"; +} + +void PrintSpecial(std::ofstream& out) { + icu::UnicodeSet current; + icu::UnicodeSet processed(0xd800, 0xdbff); // Ignore surrogate range. + icu::UnicodeSet special_add; + icu::UnicodeSet ignore; + UErrorCode status = U_ZERO_ERROR; + icu::UnicodeSet upper("[\\p{Lu}]", status); + CHECK(U_SUCCESS(status)); + // Iterate through all chars in BMP except ASCII and Surrogate. + for (UChar32 i = 0x80; i < 0x010000; i++) { + // Ignore those characters which is already processed. + if (!processed.contains(i)) { + current.set(i, i); + current.closeOver(USET_CASE_INSENSITIVE); + + // Remember we already processed current. + processed.addAll(current); + + // All uppercase characters in current. + icu::UnicodeSet keep_upper(current); + keep_upper.retainAll(upper); + + // Check if we have more than one uppercase character in current. + // If there are more than one uppercase character, then it is a special + // set which need to be added into either "Special Add" set or "Ignore" + // set. + int32_t number_of_upper = 0; + for (int32_t i = 0; i < keep_upper.getRangeCount() && i <= 1; i++) { + number_of_upper += + keep_upper.getRangeEnd(i) - keep_upper.getRangeStart(i) + 1; + } + if (number_of_upper > 1) { + // Add all non uppercase characters (could be Ll or Mn) to special add + // set. + current.removeAll(upper); + special_add.addAll(current); + + // Add the uppercase characters of non uppercase character to + // special add set. + CHECK_GT(current.getRangeCount(), 0); + UChar32 main_upper = u_toupper(current.getRangeStart(0)); + special_add.add(main_upper); + + // Add all uppercase except the main upper to ignore set. + keep_upper.remove(main_upper); + ignore.addAll(keep_upper); + } + } + } + + // Remove any ASCII + special_add.remove(0x0000, 0x007f); + PrintSet(out, "BuildIgnoreSet", ignore); + PrintSet(out, "BuildSpecialAddSet", special_add); +} + +void WriteHeader(const char* header_filename) { + std::ofstream out(header_filename); + out << std::hex << std::setfill('0') << std::setw(4); + + out << "// Automatically generated by regexp/gen-regexp-special-case.cc\n" + << "// The following functions are used to build icu::UnicodeSet\n" + << "// for specical cases different between Unicode and ECMA262.\n" + << "#ifdef V8_INTL_SUPPORT\n" + << "#include \"src/regexp/special-case.h\"\n\n" + << "#include \"unicode/uniset.h\"\n" + << "namespace v8 {\n" + << "namespace internal {\n\n"; + + PrintSpecial(out); + + out << "\n" + << "} // namespace internal\n" + << "} // namespace v8\n" + << "#endif // V8_INTL_SUPPORT\n"; +} + +} // namespace internal +} // namespace v8 + +int main(int argc, const char** argv) { + if (argc != 2) { + std::cerr << "Usage: " << argv[0] << " <output filename>\n"; + std::exit(1); + } + v8::internal::WriteHeader(argv[1]); + + return 0; +} diff --git a/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.cc b/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.cc index af9237a264..eb42c23215 100644 --- a/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.cc +++ b/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.cc @@ -6,13 +6,13 @@ #include "src/regexp/ia32/regexp-macro-assembler-ia32.h" -#include "src/assembler-inl.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/unicode.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -709,7 +709,7 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { __ mov(ebx, Operand(ebp, kStartIndex)); // Allocate space on stack for registers. - __ sub(esp, Immediate(num_registers_ * kSystemPointerSize)); + __ AllocateStackSpace(num_registers_ * kSystemPointerSize); // Load string length. __ mov(esi, Operand(ebp, kInputEnd)); // Load input position. @@ -729,18 +729,6 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { // position registers. __ mov(Operand(ebp, kStringStartMinusOne), eax); -#if V8_OS_WIN - // Ensure that we write to each stack page, in order. Skipping a page - // on Windows can cause segmentation faults. Assuming page size is 4k. - const int kPageSize = 4096; - const int kRegistersPerPage = kPageSize / kSystemPointerSize; - for (int i = num_saved_registers_ + kRegistersPerPage - 1; - i < num_registers_; - i += kRegistersPerPage) { - __ mov(register_location(i), eax); // One write every page. - } -#endif // V8_OS_WIN - Label load_char_start_regexp, start_regexp; // Load newline if index is at start, previous character otherwise. __ cmp(Operand(ebp, kStartIndex), Immediate(0)); @@ -941,8 +929,9 @@ Handle<HeapObject> RegExpMacroAssemblerIA32::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(masm_->isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); PROFILE(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); diff --git a/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.h b/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.h index eb6b0335a8..914552cc93 100644 --- a/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.h +++ b/deps/v8/src/regexp/ia32/regexp-macro-assembler-ia32.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ #define V8_REGEXP_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_ -#include "src/ia32/assembler-ia32.h" -#include "src/macro-assembler.h" +#include "src/codegen/ia32/assembler-ia32.h" +#include "src/codegen/macro-assembler.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/interpreter-irregexp.cc b/deps/v8/src/regexp/interpreter-irregexp.cc index 55b862dc56..04bb63ee7a 100644 --- a/deps/v8/src/regexp/interpreter-irregexp.cc +++ b/deps/v8/src/regexp/interpreter-irregexp.cc @@ -7,12 +7,12 @@ #include "src/regexp/interpreter-irregexp.h" #include "src/ast/ast.h" -#include "src/objects-inl.h" +#include "src/objects/objects-inl.h" #include "src/regexp/bytecodes-irregexp.h" #include "src/regexp/jsregexp.h" #include "src/regexp/regexp-macro-assembler.h" -#include "src/unicode.h" -#include "src/utils.h" +#include "src/strings/unicode.h" +#include "src/utils/utils.h" #ifdef V8_INTL_SUPPORT #include "unicode/uchar.h" @@ -176,7 +176,7 @@ IrregexpInterpreter::Result HandleInterrupts(Isolate* isolate, result = isolate->stack_guard()->HandleInterrupts(); } - if (result->IsException(isolate)) { + if (result.IsException(isolate)) { return IrregexpInterpreter::EXCEPTION; } diff --git a/deps/v8/src/regexp/jsregexp-inl.h b/deps/v8/src/regexp/jsregexp-inl.h index 926fec2868..b542add17b 100644 --- a/deps/v8/src/regexp/jsregexp-inl.h +++ b/deps/v8/src/regexp/jsregexp-inl.h @@ -6,10 +6,10 @@ #ifndef V8_REGEXP_JSREGEXP_INL_H_ #define V8_REGEXP_JSREGEXP_INL_H_ -#include "src/allocation.h" -#include "src/objects.h" #include "src/objects/js-regexp-inl.h" +#include "src/objects/objects.h" #include "src/regexp/jsregexp.h" +#include "src/utils/allocation.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/jsregexp.cc b/deps/v8/src/regexp/jsregexp.cc index 7995505226..a6f3a5ebcb 100644 --- a/deps/v8/src/regexp/jsregexp.cc +++ b/deps/v8/src/regexp/jsregexp.cc @@ -8,15 +8,14 @@ #include <vector> #include "src/base/platform/platform.h" -#include "src/code-tracer.h" -#include "src/compilation-cache.h" -#include "src/elements.h" -#include "src/execution.h" +#include "src/codegen/compilation-cache.h" +#include "src/diagnostics/code-tracer.h" +#include "src/execution/execution.h" +#include "src/execution/isolate-inl.h" +#include "src/execution/message-template.h" #include "src/heap/factory.h" #include "src/heap/heap-inl.h" -#include "src/isolate-inl.h" -#include "src/message-template.h" -#include "src/ostreams.h" +#include "src/objects/elements.h" #include "src/regexp/interpreter-irregexp.h" #include "src/regexp/jsregexp-inl.h" #include "src/regexp/regexp-macro-assembler-irregexp.h" @@ -24,14 +23,19 @@ #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-parser.h" #include "src/regexp/regexp-stack.h" +#ifdef V8_INTL_SUPPORT +#include "src/regexp/special-case.h" +#endif // V8_INTL_SUPPORT #include "src/runtime/runtime.h" -#include "src/splay-tree-inl.h" -#include "src/string-search.h" -#include "src/unicode-decoder.h" -#include "src/unicode-inl.h" +#include "src/strings/string-search.h" +#include "src/strings/unicode-decoder.h" +#include "src/strings/unicode-inl.h" +#include "src/utils/ostreams.h" +#include "src/utils/splay-tree-inl.h" #include "src/zone/zone-list-inl.h" #ifdef V8_INTL_SUPPORT +#include "unicode/locid.h" #include "unicode/uniset.h" #include "unicode/utypes.h" #endif // V8_INTL_SUPPORT @@ -176,7 +180,7 @@ MaybeHandle<Object> RegExpImpl::Compile(Isolate* isolate, Handle<JSRegExp> re, if (!has_been_compiled) { IrregexpInitialize(isolate, re, pattern, flags, parse_result.capture_count); } - DCHECK(re->data()->IsFixedArray()); + DCHECK(re->data().IsFixedArray()); // Compilation succeeded so the data is set on the regexp // and we can store it in the cache. Handle<FixedArray> data(FixedArray::cast(re->data()), isolate); @@ -230,8 +234,8 @@ int RegExpImpl::AtomExecRaw(Isolate* isolate, Handle<JSRegExp> regexp, DisallowHeapAllocation no_gc; // ensure vectors stay valid String needle = String::cast(regexp->DataAt(JSRegExp::kAtomPatternIndex)); - int needle_len = needle->length(); - DCHECK(needle->IsFlat()); + int needle_len = needle.length(); + DCHECK(needle.IsFlat()); DCHECK_LT(0, needle_len); if (index + needle_len > subject->length()) { @@ -239,7 +243,7 @@ int RegExpImpl::AtomExecRaw(Isolate* isolate, Handle<JSRegExp> regexp, } for (int i = 0; i < output_size; i += 2) { - String::FlatContent needle_content = needle->GetFlatContent(no_gc); + String::FlatContent needle_content = needle.GetFlatContent(no_gc); String::FlatContent subject_content = subject->GetFlatContent(no_gc); DCHECK(needle_content.IsFlat()); DCHECK(subject_content.IsFlat()); @@ -300,8 +304,8 @@ bool RegExpImpl::EnsureCompiledIrregexp(Isolate* isolate, Handle<JSRegExp> re, bool is_one_byte) { Object compiled_code = re->DataAt(JSRegExp::code_index(is_one_byte)); if (compiled_code != Smi::FromInt(JSRegExp::kUninitializedValue)) { - DCHECK(FLAG_regexp_interpret_all ? compiled_code->IsByteArray() - : compiled_code->IsCode()); + DCHECK(FLAG_regexp_interpret_all ? compiled_code.IsByteArray() + : compiled_code.IsCode()); return true; } return CompileIrregexp(isolate, re, sample_subject, is_one_byte); @@ -317,7 +321,7 @@ bool RegExpImpl::CompileIrregexp(Isolate* isolate, Handle<JSRegExp> re, Object entry = re->DataAt(JSRegExp::code_index(is_one_byte)); // When arriving here entry can only be a smi representing an uncompiled // regexp. - DCHECK(entry->IsSmi()); + DCHECK(entry.IsSmi()); int entry_value = Smi::ToInt(entry); DCHECK_EQ(JSRegExp::kUninitializedValue, entry_value); #endif @@ -340,7 +344,7 @@ bool RegExpImpl::CompileIrregexp(Isolate* isolate, Handle<JSRegExp> re, sample_subject, is_one_byte); if (result.error_message != nullptr) { // Unable to compile regexp. - if (FLAG_abort_on_stack_or_string_length_overflow && + if (FLAG_correctness_fuzzer_suppressions && strncmp(result.error_message, "Stack overflow", 15) == 0) { FATAL("Aborting on stack overflow"); } @@ -363,37 +367,36 @@ bool RegExpImpl::CompileIrregexp(Isolate* isolate, Handle<JSRegExp> re, } int RegExpImpl::IrregexpMaxRegisterCount(FixedArray re) { - return Smi::cast( - re->get(JSRegExp::kIrregexpMaxRegisterCountIndex))->value(); + return Smi::cast(re.get(JSRegExp::kIrregexpMaxRegisterCountIndex)).value(); } void RegExpImpl::SetIrregexpMaxRegisterCount(FixedArray re, int value) { - re->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(value)); + re.set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(value)); } void RegExpImpl::SetIrregexpCaptureNameMap(FixedArray re, Handle<FixedArray> value) { if (value.is_null()) { - re->set(JSRegExp::kIrregexpCaptureNameMapIndex, Smi::kZero); + re.set(JSRegExp::kIrregexpCaptureNameMapIndex, Smi::kZero); } else { - re->set(JSRegExp::kIrregexpCaptureNameMapIndex, *value); + re.set(JSRegExp::kIrregexpCaptureNameMapIndex, *value); } } int RegExpImpl::IrregexpNumberOfCaptures(FixedArray re) { - return Smi::ToInt(re->get(JSRegExp::kIrregexpCaptureCountIndex)); + return Smi::ToInt(re.get(JSRegExp::kIrregexpCaptureCountIndex)); } int RegExpImpl::IrregexpNumberOfRegisters(FixedArray re) { - return Smi::ToInt(re->get(JSRegExp::kIrregexpMaxRegisterCountIndex)); + return Smi::ToInt(re.get(JSRegExp::kIrregexpMaxRegisterCountIndex)); } ByteArray RegExpImpl::IrregexpByteCode(FixedArray re, bool is_one_byte) { - return ByteArray::cast(re->get(JSRegExp::code_index(is_one_byte))); + return ByteArray::cast(re.get(JSRegExp::code_index(is_one_byte))); } Code RegExpImpl::IrregexpNativeCode(FixedArray re, bool is_one_byte) { - return Code::cast(re->get(JSRegExp::code_index(is_one_byte))); + return Code::cast(re.get(JSRegExp::code_index(is_one_byte))); } void RegExpImpl::IrregexpInitialize(Isolate* isolate, Handle<JSRegExp> re, @@ -525,7 +528,7 @@ MaybeHandle<Object> RegExpImpl::IrregexpExec( #ifdef DEBUG if (FLAG_regexp_interpret_all && FLAG_trace_regexp_bytecodes) { String pattern = regexp->Pattern(); - PrintF("\n\nRegexp match: /%s/\n\n", pattern->ToCString().get()); + PrintF("\n\nRegexp match: /%s/\n\n", pattern.ToCString().get()); PrintF("\n\nSubject string: '%s'\n\n", subject->ToCString().get()); } #endif @@ -1725,7 +1728,6 @@ static inline bool EmitAtomLetter(Isolate* isolate, break; default: UNREACHABLE(); - break; } return true; } @@ -2754,7 +2756,7 @@ RegExpNode* TextNode::FilterOneByte(int depth) { } if (c > unibrow::Latin1::kMaxChar) return set_replacement(nullptr); // Replace quark in case we converted to Latin-1. - uint16_t* writable_quarks = const_cast<uint16_t*>(quarks.start()); + uint16_t* writable_quarks = const_cast<uint16_t*>(quarks.begin()); writable_quarks[j] = c; } } else { @@ -5929,6 +5931,39 @@ Vector<const int> CharacterRange::GetWordBounds() { return Vector<const int>(kWordRanges, kWordRangeCount - 1); } +#ifdef V8_INTL_SUPPORT +struct IgnoreSet { + IgnoreSet() : set(BuildIgnoreSet()) {} + const icu::UnicodeSet set; +}; + +struct SpecialAddSet { + SpecialAddSet() : set(BuildSpecialAddSet()) {} + const icu::UnicodeSet set; +}; + +icu::UnicodeSet BuildAsciiAToZSet() { + icu::UnicodeSet set('a', 'z'); + set.add('A', 'Z'); + set.freeze(); + return set; +} + +struct AsciiAToZSet { + AsciiAToZSet() : set(BuildAsciiAToZSet()) {} + const icu::UnicodeSet set; +}; + +static base::LazyInstance<IgnoreSet>::type ignore_set = + LAZY_INSTANCE_INITIALIZER; + +static base::LazyInstance<SpecialAddSet>::type special_add_set = + LAZY_INSTANCE_INITIALIZER; + +static base::LazyInstance<AsciiAToZSet>::type ascii_a_to_z_set = + LAZY_INSTANCE_INITIALIZER; +#endif // V8_INTL_SUPPORT + // static void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone, ZoneList<CharacterRange>* ranges, @@ -5936,49 +5971,100 @@ void CharacterRange::AddCaseEquivalents(Isolate* isolate, Zone* zone, CharacterRange::Canonicalize(ranges); int range_count = ranges->length(); #ifdef V8_INTL_SUPPORT - icu::UnicodeSet already_added; icu::UnicodeSet others; for (int i = 0; i < range_count; i++) { CharacterRange range = ranges->at(i); - uc32 bottom = range.from(); - if (bottom > String::kMaxUtf16CodeUnit) continue; - uc32 top = Min(range.to(), String::kMaxUtf16CodeUnit); + uc32 from = range.from(); + if (from > String::kMaxUtf16CodeUnit) continue; + uc32 to = Min(range.to(), String::kMaxUtf16CodeUnit); // Nothing to be done for surrogates. - if (bottom >= kLeadSurrogateStart && top <= kTrailSurrogateEnd) continue; + if (from >= kLeadSurrogateStart && to <= kTrailSurrogateEnd) continue; if (is_one_byte && !RangeContainsLatin1Equivalents(range)) { - if (bottom > String::kMaxOneByteCharCode) continue; - if (top > String::kMaxOneByteCharCode) top = String::kMaxOneByteCharCode; + if (from > String::kMaxOneByteCharCode) continue; + if (to > String::kMaxOneByteCharCode) to = String::kMaxOneByteCharCode; } - already_added.add(bottom, top); - while (bottom <= top) { - icu::UnicodeString upper(bottom); - upper.toUpper(); - icu::UnicodeSet expanded(bottom, bottom); - expanded.closeOver(USET_CASE_INSENSITIVE); - for (int32_t i = 0; i < expanded.getRangeCount(); i++) { - UChar32 start = expanded.getRangeStart(i); - UChar32 end = expanded.getRangeEnd(i); - while (start <= end) { - icu::UnicodeString upper2(start); - upper2.toUpper(); - // Only add if the upper case are the same. - if (upper[0] == upper2[0]) { - others.add(start); + others.add(from, to); + } + + // Set of characters already added to ranges that do not need to be added + // again. + icu::UnicodeSet already_added(others); + + // Set of characters in ranges that are in the 52 ASCII characters [a-zA-Z]. + icu::UnicodeSet in_ascii_a_to_z(others); + in_ascii_a_to_z.retainAll(ascii_a_to_z_set.Pointer()->set); + + // Remove all chars in [a-zA-Z] from others. + others.removeAll(in_ascii_a_to_z); + + // Set of characters in ranges that are overlapping with special add set. + icu::UnicodeSet in_special_add(others); + in_special_add.retainAll(special_add_set.Pointer()->set); + + others.removeAll(in_special_add); + + // Ignore all chars in ignore set. + others.removeAll(ignore_set.Pointer()->set); + + // For most of the chars in ranges that is still in others, find the case + // equivlant set by calling closeOver(USET_CASE_INSENSITIVE). + others.closeOver(USET_CASE_INSENSITIVE); + + // Because closeOver(USET_CASE_INSENSITIVE) may add ASCII [a-zA-Z] to others, + // but ECMA262 "i" mode won't consider that, remove them from others. + // Ex: U+017F add 'S' and 's' to others. + others.removeAll(ascii_a_to_z_set.Pointer()->set); + + // Special handling for in_ascii_a_to_z. + for (int32_t i = 0; i < in_ascii_a_to_z.getRangeCount(); i++) { + UChar32 start = in_ascii_a_to_z.getRangeStart(i); + UChar32 end = in_ascii_a_to_z.getRangeEnd(i); + // Check if it is uppercase A-Z by checking bit 6. + if (start & 0x0020) { + // Add the lowercases + others.add(start & 0x005F, end & 0x005F); + } else { + // Add the uppercases + others.add(start | 0x0020, end | 0x0020); + } + } + + // Special handling for chars in "Special Add" set. + for (int32_t i = 0; i < in_special_add.getRangeCount(); i++) { + UChar32 end = in_special_add.getRangeEnd(i); + for (UChar32 ch = in_special_add.getRangeStart(i); ch <= end; ch++) { + // Add the uppercase of this character if itself is not an uppercase + // character. + // Note: The if condiction cannot be u_islower(ch) because ch could be + // neither uppercase nor lowercase but Mn. + if (!u_isupper(ch)) { + others.add(u_toupper(ch)); + } + icu::UnicodeSet candidates(ch, ch); + candidates.closeOver(USET_CASE_INSENSITIVE); + for (int32_t j = 0; j < candidates.getRangeCount(); j++) { + UChar32 end2 = candidates.getRangeEnd(j); + for (UChar32 ch2 = candidates.getRangeStart(j); ch2 <= end2; ch2++) { + // Add character that is not uppercase to others. + if (!u_isupper(ch2)) { + others.add(ch2); } - start++; } } - bottom++; } } + + // Remove all characters which already in the ranges. others.removeAll(already_added); + + // Add others to the ranges for (int32_t i = 0; i < others.getRangeCount(); i++) { - UChar32 start = others.getRangeStart(i); - UChar32 end = others.getRangeEnd(i); - if (start == end) { - ranges->Add(CharacterRange::Singleton(start), zone); + UChar32 from = others.getRangeStart(i); + UChar32 to = others.getRangeEnd(i); + if (from == to) { + ranges->Add(CharacterRange::Singleton(from), zone); } else { - ranges->Add(CharacterRange::Range(start, end), zone); + ranges->Add(CharacterRange::Range(from, to), zone); } } #else @@ -6872,32 +6958,32 @@ Object RegExpResultsCache::Lookup(Heap* heap, String key_string, FixedArray* last_match_cache, ResultsCacheType type) { FixedArray cache; - if (!key_string->IsInternalizedString()) return Smi::kZero; + if (!key_string.IsInternalizedString()) return Smi::kZero; if (type == STRING_SPLIT_SUBSTRINGS) { - DCHECK(key_pattern->IsString()); - if (!key_pattern->IsInternalizedString()) return Smi::kZero; + DCHECK(key_pattern.IsString()); + if (!key_pattern.IsInternalizedString()) return Smi::kZero; cache = heap->string_split_cache(); } else { DCHECK(type == REGEXP_MULTIPLE_INDICES); - DCHECK(key_pattern->IsFixedArray()); + DCHECK(key_pattern.IsFixedArray()); cache = heap->regexp_multiple_cache(); } - uint32_t hash = key_string->Hash(); + uint32_t hash = key_string.Hash(); uint32_t index = ((hash & (kRegExpResultsCacheSize - 1)) & ~(kArrayEntriesPerCacheEntry - 1)); - if (cache->get(index + kStringOffset) != key_string || - cache->get(index + kPatternOffset) != key_pattern) { + if (cache.get(index + kStringOffset) != key_string || + cache.get(index + kPatternOffset) != key_pattern) { index = ((index + kArrayEntriesPerCacheEntry) & (kRegExpResultsCacheSize - 1)); - if (cache->get(index + kStringOffset) != key_string || - cache->get(index + kPatternOffset) != key_pattern) { + if (cache.get(index + kStringOffset) != key_string || + cache.get(index + kPatternOffset) != key_pattern) { return Smi::kZero; } } - *last_match_cache = FixedArray::cast(cache->get(index + kLastMatchOffset)); - return cache->get(index + kArrayOffset); + *last_match_cache = FixedArray::cast(cache.get(index + kLastMatchOffset)); + return cache.get(index + kArrayOffset); } void RegExpResultsCache::Enter(Isolate* isolate, Handle<String> key_string, @@ -6961,7 +7047,7 @@ void RegExpResultsCache::Enter(Isolate* isolate, Handle<String> key_string, void RegExpResultsCache::Clear(FixedArray cache) { for (int i = 0; i < kRegExpResultsCacheSize; i++) { - cache->set(i, Smi::kZero); + cache.set(i, Smi::kZero); } } diff --git a/deps/v8/src/regexp/jsregexp.h b/deps/v8/src/regexp/jsregexp.h index 0a0b5c10d6..832c7e3aa5 100644 --- a/deps/v8/src/regexp/jsregexp.h +++ b/deps/v8/src/regexp/jsregexp.h @@ -5,11 +5,11 @@ #ifndef V8_REGEXP_JSREGEXP_H_ #define V8_REGEXP_JSREGEXP_H_ -#include "src/allocation.h" -#include "src/isolate.h" +#include "src/execution/isolate.h" #include "src/objects/js-regexp.h" #include "src/regexp/regexp-ast.h" #include "src/regexp/regexp-macro-assembler.h" +#include "src/utils/allocation.h" #include "src/zone/zone-splay-tree.h" namespace v8 { diff --git a/deps/v8/src/regexp/mips/OWNERS b/deps/v8/src/regexp/mips/OWNERS deleted file mode 100644 index cab3679d65..0000000000 --- a/deps/v8/src/regexp/mips/OWNERS +++ /dev/null @@ -1 +0,0 @@ -xwafish@gmail.com diff --git a/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc b/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc index 35303ff1d3..e8104ced7e 100644 --- a/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc +++ b/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc @@ -6,14 +6,14 @@ #include "src/regexp/mips/regexp-macro-assembler-mips.h" -#include "src/assembler-inl.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -899,8 +899,9 @@ Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); LOG(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); diff --git a/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.h b/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.h index 51004ecc97..b785910466 100644 --- a/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.h +++ b/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ #define V8_REGEXP_MIPS_REGEXP_MACRO_ASSEMBLER_MIPS_H_ -#include "src/macro-assembler.h" -#include "src/mips/assembler-mips.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/mips/assembler-mips.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/mips64/OWNERS b/deps/v8/src/regexp/mips64/OWNERS deleted file mode 100644 index cab3679d65..0000000000 --- a/deps/v8/src/regexp/mips64/OWNERS +++ /dev/null @@ -1 +0,0 @@ -xwafish@gmail.com diff --git a/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.cc b/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.cc index 0d1b591005..239cc87ae8 100644 --- a/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.cc +++ b/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.cc @@ -6,14 +6,14 @@ #include "src/regexp/mips64/regexp-macro-assembler-mips64.h" -#include "src/assembler-inl.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -936,8 +936,9 @@ Handle<HeapObject> RegExpMacroAssemblerMIPS::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); LOG(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); diff --git a/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.h b/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.h index 179f4844d3..d24735d08e 100644 --- a/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.h +++ b/deps/v8/src/regexp/mips64/regexp-macro-assembler-mips64.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_MIPS64_REGEXP_MACRO_ASSEMBLER_MIPS64_H_ #define V8_REGEXP_MIPS64_REGEXP_MACRO_ASSEMBLER_MIPS64_H_ -#include "src/macro-assembler.h" -#include "src/mips64/assembler-mips64.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/mips64/assembler-mips64.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc index a646aa17ef..bce612e66f 100644 --- a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc +++ b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.cc @@ -6,14 +6,14 @@ #include "src/regexp/ppc/regexp-macro-assembler-ppc.h" -#include "src/assembler-inl.h" #include "src/base/bits.h" -#include "src/log.h" -#include "src/macro-assembler.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -756,7 +756,7 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) { if (num_saved_registers_ > 8) { // One slot beyond address of register 0. __ addi(r4, frame_pointer(), Operand(kRegisterZero + kPointerSize)); - __ li(r5, Operand(num_saved_registers_)); + __ mov(r5, Operand(num_saved_registers_)); __ mtctr(r5); Label init_loop; __ bind(&init_loop); @@ -938,8 +938,9 @@ Handle<HeapObject> RegExpMacroAssemblerPPC::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); PROFILE(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); diff --git a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.h b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.h index 4e69daa1e5..418a01a9a4 100644 --- a/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.h +++ b/deps/v8/src/regexp/ppc/regexp-macro-assembler-ppc.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_PPC_REGEXP_MACRO_ASSEMBLER_PPC_H_ #define V8_REGEXP_PPC_REGEXP_MACRO_ASSEMBLER_PPC_H_ -#include "src/macro-assembler.h" -#include "src/ppc/assembler-ppc.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/ppc/assembler-ppc.h" #include "src/regexp/regexp-macro-assembler.h" namespace v8 { diff --git a/deps/v8/src/regexp/property-sequences.h b/deps/v8/src/regexp/property-sequences.h index 1d9fce3571..10c79e82b1 100644 --- a/deps/v8/src/regexp/property-sequences.h +++ b/deps/v8/src/regexp/property-sequences.h @@ -7,7 +7,7 @@ #ifdef V8_INTL_SUPPORT -#include "src/globals.h" +#include "src/common/globals.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/regexp-ast.cc b/deps/v8/src/regexp/regexp-ast.cc index 782c9c9037..561d11eef5 100644 --- a/deps/v8/src/regexp/regexp-ast.cc +++ b/deps/v8/src/regexp/regexp-ast.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/ostreams.h" #include "src/regexp/regexp-ast.h" +#include "src/utils/ostreams.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/regexp-ast.h b/deps/v8/src/regexp/regexp-ast.h index 7c21a02590..1fa9f7a35b 100644 --- a/deps/v8/src/regexp/regexp-ast.h +++ b/deps/v8/src/regexp/regexp-ast.h @@ -5,10 +5,10 @@ #ifndef V8_REGEXP_REGEXP_AST_H_ #define V8_REGEXP_REGEXP_AST_H_ -#include "src/objects.h" #include "src/objects/js-regexp.h" +#include "src/objects/objects.h" #include "src/objects/string.h" -#include "src/utils.h" +#include "src/utils/utils.h" #include "src/zone/zone-containers.h" #include "src/zone/zone.h" diff --git a/deps/v8/src/regexp/regexp-macro-assembler-irregexp-inl.h b/deps/v8/src/regexp/regexp-macro-assembler-irregexp-inl.h index 2a4d6e5e2f..cda48aa00b 100644 --- a/deps/v8/src/regexp/regexp-macro-assembler-irregexp-inl.h +++ b/deps/v8/src/regexp/regexp-macro-assembler-irregexp-inl.h @@ -20,7 +20,7 @@ void RegExpMacroAssemblerIrregexp::Emit(uint32_t byte, if (pc_ + 3 >= buffer_.length()) { Expand(); } - *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word; + *reinterpret_cast<uint32_t*>(buffer_.begin() + pc_) = word; pc_ += 4; } @@ -30,7 +30,7 @@ void RegExpMacroAssemblerIrregexp::Emit16(uint32_t word) { if (pc_ + 1 >= buffer_.length()) { Expand(); } - *reinterpret_cast<uint16_t*>(buffer_.start() + pc_) = word; + *reinterpret_cast<uint16_t*>(buffer_.begin() + pc_) = word; pc_ += 2; } @@ -40,7 +40,7 @@ void RegExpMacroAssemblerIrregexp::Emit8(uint32_t word) { if (pc_ == buffer_.length()) { Expand(); } - *reinterpret_cast<unsigned char*>(buffer_.start() + pc_) = word; + *reinterpret_cast<unsigned char*>(buffer_.begin() + pc_) = word; pc_ += 1; } @@ -50,7 +50,7 @@ void RegExpMacroAssemblerIrregexp::Emit32(uint32_t word) { if (pc_ + 3 >= buffer_.length()) { Expand(); } - *reinterpret_cast<uint32_t*>(buffer_.start() + pc_) = word; + *reinterpret_cast<uint32_t*>(buffer_.begin() + pc_) = word; pc_ += 4; } diff --git a/deps/v8/src/regexp/regexp-macro-assembler-irregexp.cc b/deps/v8/src/regexp/regexp-macro-assembler-irregexp.cc index eeffb7d262..712f00e509 100644 --- a/deps/v8/src/regexp/regexp-macro-assembler-irregexp.cc +++ b/deps/v8/src/regexp/regexp-macro-assembler-irregexp.cc @@ -5,7 +5,7 @@ #include "src/regexp/regexp-macro-assembler-irregexp.h" #include "src/ast/ast.h" -#include "src/objects-inl.h" +#include "src/objects/objects-inl.h" #include "src/regexp/bytecodes-irregexp.h" #include "src/regexp/regexp-macro-assembler-irregexp-inl.h" #include "src/regexp/regexp-macro-assembler.h" @@ -41,8 +41,8 @@ void RegExpMacroAssemblerIrregexp::Bind(Label* l) { int pos = l->pos(); while (pos != 0) { int fixup = pos; - pos = *reinterpret_cast<int32_t*>(buffer_.start() + fixup); - *reinterpret_cast<uint32_t*>(buffer_.start() + fixup) = pc_; + pos = *reinterpret_cast<int32_t*>(buffer_.begin() + fixup); + *reinterpret_cast<uint32_t*>(buffer_.begin() + fixup) = pc_; } } l->bind_to(pc_); @@ -436,7 +436,7 @@ int RegExpMacroAssemblerIrregexp::length() { } void RegExpMacroAssemblerIrregexp::Copy(byte* a) { - MemCopy(a, buffer_.start(), length()); + MemCopy(a, buffer_.begin(), length()); } @@ -445,7 +445,7 @@ void RegExpMacroAssemblerIrregexp::Expand() { Vector<byte> old_buffer = buffer_; buffer_ = Vector<byte>::New(old_buffer.length() * 2); own_buffer_ = true; - MemCopy(buffer_.start(), old_buffer.start(), old_buffer.length()); + MemCopy(buffer_.begin(), old_buffer.begin(), old_buffer.length()); if (old_buffer_was_our_own) { old_buffer.Dispose(); } diff --git a/deps/v8/src/regexp/regexp-macro-assembler-tracer.cc b/deps/v8/src/regexp/regexp-macro-assembler-tracer.cc index 945c6927b5..db9c5af569 100644 --- a/deps/v8/src/regexp/regexp-macro-assembler-tracer.cc +++ b/deps/v8/src/regexp/regexp-macro-assembler-tracer.cc @@ -5,7 +5,7 @@ #include "src/regexp/regexp-macro-assembler-tracer.h" #include "src/ast/ast.h" -#include "src/objects-inl.h" +#include "src/objects/objects-inl.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/regexp-macro-assembler.cc b/deps/v8/src/regexp/regexp-macro-assembler.cc index a75c45d24e..cfe827ef4e 100644 --- a/deps/v8/src/regexp/regexp-macro-assembler.cc +++ b/deps/v8/src/regexp/regexp-macro-assembler.cc @@ -4,11 +4,11 @@ #include "src/regexp/regexp-macro-assembler.h" -#include "src/assembler.h" -#include "src/isolate-inl.h" +#include "src/codegen/assembler.h" +#include "src/execution/isolate-inl.h" +#include "src/execution/simulator.h" #include "src/regexp/regexp-stack.h" -#include "src/simulator.h" -#include "src/unicode-inl.h" +#include "src/strings/unicode-inl.h" #ifdef V8_INTL_SUPPORT #include "unicode/uchar.h" @@ -102,30 +102,30 @@ bool NativeRegExpMacroAssembler::CanReadUnaligned() { const byte* NativeRegExpMacroAssembler::StringCharacterPosition( String subject, int start_index, const DisallowHeapAllocation& no_gc) { - if (subject->IsConsString()) { - subject = ConsString::cast(subject)->first(); - } else if (subject->IsSlicedString()) { - start_index += SlicedString::cast(subject)->offset(); - subject = SlicedString::cast(subject)->parent(); + if (subject.IsConsString()) { + subject = ConsString::cast(subject).first(); + } else if (subject.IsSlicedString()) { + start_index += SlicedString::cast(subject).offset(); + subject = SlicedString::cast(subject).parent(); } - if (subject->IsThinString()) { - subject = ThinString::cast(subject)->actual(); + if (subject.IsThinString()) { + subject = ThinString::cast(subject).actual(); } DCHECK_LE(0, start_index); - DCHECK_LE(start_index, subject->length()); - if (subject->IsSeqOneByteString()) { + DCHECK_LE(start_index, subject.length()); + if (subject.IsSeqOneByteString()) { return reinterpret_cast<const byte*>( - SeqOneByteString::cast(subject)->GetChars(no_gc) + start_index); - } else if (subject->IsSeqTwoByteString()) { + SeqOneByteString::cast(subject).GetChars(no_gc) + start_index); + } else if (subject.IsSeqTwoByteString()) { return reinterpret_cast<const byte*>( - SeqTwoByteString::cast(subject)->GetChars(no_gc) + start_index); - } else if (subject->IsExternalOneByteString()) { + SeqTwoByteString::cast(subject).GetChars(no_gc) + start_index); + } else if (subject.IsExternalOneByteString()) { return reinterpret_cast<const byte*>( - ExternalOneByteString::cast(subject)->GetChars() + start_index); + ExternalOneByteString::cast(subject).GetChars() + start_index); } else { - DCHECK(subject->IsExternalTwoByteString()); + DCHECK(subject.IsExternalTwoByteString()); return reinterpret_cast<const byte*>( - ExternalTwoByteString::cast(subject)->GetChars() + start_index); + ExternalTwoByteString::cast(subject).GetChars() + start_index); } } @@ -134,8 +134,8 @@ int NativeRegExpMacroAssembler::CheckStackGuardState( Address* return_address, Code re_code, Address* subject, const byte** input_start, const byte** input_end) { AllowHeapAllocation allow_allocation; - DCHECK(re_code->raw_instruction_start() <= *return_address); - DCHECK(*return_address <= re_code->raw_instruction_end()); + DCHECK(re_code.raw_instruction_start() <= *return_address); + DCHECK(*return_address <= re_code.raw_instruction_end()); int return_value = 0; // Prepare for possible GC. HandleScope handles(isolate); @@ -158,13 +158,13 @@ int NativeRegExpMacroAssembler::CheckStackGuardState( return_value = EXCEPTION; } else { Object result = isolate->stack_guard()->HandleInterrupts(); - if (result->IsException(isolate)) return_value = EXCEPTION; + if (result.IsException(isolate)) return_value = EXCEPTION; } DisallowHeapAllocation no_gc; if (*code_handle != re_code) { // Return address no longer valid - intptr_t delta = code_handle->address() - re_code->address(); + intptr_t delta = code_handle->address() - re_code.address(); // Overwrite the return address on the stack. *return_address += delta; } @@ -206,25 +206,25 @@ int NativeRegExpMacroAssembler::Match(Handle<Code> regexp_code, String subject_ptr = *subject; // Character offsets into string. int start_offset = previous_index; - int char_length = subject_ptr->length() - start_offset; + int char_length = subject_ptr.length() - start_offset; int slice_offset = 0; // The string has been flattened, so if it is a cons string it contains the // full string in the first part. if (StringShape(subject_ptr).IsCons()) { - DCHECK_EQ(0, ConsString::cast(subject_ptr)->second()->length()); - subject_ptr = ConsString::cast(subject_ptr)->first(); + DCHECK_EQ(0, ConsString::cast(subject_ptr).second().length()); + subject_ptr = ConsString::cast(subject_ptr).first(); } else if (StringShape(subject_ptr).IsSliced()) { SlicedString slice = SlicedString::cast(subject_ptr); - subject_ptr = slice->parent(); - slice_offset = slice->offset(); + subject_ptr = slice.parent(); + slice_offset = slice.offset(); } if (StringShape(subject_ptr).IsThin()) { - subject_ptr = ThinString::cast(subject_ptr)->actual(); + subject_ptr = ThinString::cast(subject_ptr).actual(); } // Ensure that an underlying string has the same representation. - bool is_one_byte = subject_ptr->IsOneByteRepresentation(); - DCHECK(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); + bool is_one_byte = subject_ptr.IsOneByteRepresentation(); + DCHECK(subject_ptr.IsExternalString() || subject_ptr.IsSeqString()); // String is now either Sequential or External int char_size_shift = is_one_byte ? 0 : 1; diff --git a/deps/v8/src/regexp/regexp-macro-assembler.h b/deps/v8/src/regexp/regexp-macro-assembler.h index e28ac1ef22..8626d1a19e 100644 --- a/deps/v8/src/regexp/regexp-macro-assembler.h +++ b/deps/v8/src/regexp/regexp-macro-assembler.h @@ -5,7 +5,7 @@ #ifndef V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ #define V8_REGEXP_REGEXP_MACRO_ASSEMBLER_H_ -#include "src/label.h" +#include "src/codegen/label.h" #include "src/regexp/regexp-ast.h" namespace v8 { diff --git a/deps/v8/src/regexp/regexp-parser.cc b/deps/v8/src/regexp/regexp-parser.cc index 97be9fa27b..7cae456f56 100644 --- a/deps/v8/src/regexp/regexp-parser.cc +++ b/deps/v8/src/regexp/regexp-parser.cc @@ -6,14 +6,14 @@ #include <vector> -#include "src/char-predicates-inl.h" +#include "src/execution/isolate.h" #include "src/heap/factory.h" -#include "src/isolate.h" -#include "src/objects-inl.h" -#include "src/ostreams.h" +#include "src/objects/objects-inl.h" #include "src/regexp/jsregexp.h" #include "src/regexp/property-sequences.h" -#include "src/utils.h" +#include "src/strings/char-predicates-inl.h" +#include "src/utils/ostreams.h" +#include "src/utils/utils.h" #include "src/zone/zone-list-inl.h" #ifdef V8_INTL_SUPPORT @@ -77,7 +77,7 @@ void RegExpParser::Advance() { if (has_next()) { StackLimitCheck check(isolate()); if (check.HasOverflowed()) { - if (FLAG_abort_on_stack_or_string_length_overflow) { + if (FLAG_correctness_fuzzer_suppressions) { FATAL("Aborting on stack overflow"); } ReportError(CStrVector( @@ -995,7 +995,7 @@ Handle<FixedArray> RegExpParser::CreateCaptureNameMap() { capture->name()->size()); // CSA code in ConstructNewResultFromMatchInfo requires these strings to be // internalized so they can be used as property names in the 'exec' results. - Handle<String> name = factory->InternalizeTwoByteString(capture_name); + Handle<String> name = factory->InternalizeString(capture_name); array->set(i * 2, *name); array->set(i * 2 + 1, Smi::FromInt(capture->index())); } diff --git a/deps/v8/src/regexp/regexp-parser.h b/deps/v8/src/regexp/regexp-parser.h index d6db037de0..bf9e62ed71 100644 --- a/deps/v8/src/regexp/regexp-parser.h +++ b/deps/v8/src/regexp/regexp-parser.h @@ -5,8 +5,8 @@ #ifndef V8_REGEXP_REGEXP_PARSER_H_ #define V8_REGEXP_REGEXP_PARSER_H_ -#include "src/objects.h" #include "src/objects/js-regexp.h" +#include "src/objects/objects.h" #include "src/regexp/regexp-ast.h" #include "src/zone/zone.h" diff --git a/deps/v8/src/regexp/regexp-stack.cc b/deps/v8/src/regexp/regexp-stack.cc index b87fbc399a..3885fd8e8d 100644 --- a/deps/v8/src/regexp/regexp-stack.cc +++ b/deps/v8/src/regexp/regexp-stack.cc @@ -4,7 +4,8 @@ #include "src/regexp/regexp-stack.h" -#include "src/isolate.h" +#include "src/execution/isolate.h" +#include "src/utils/memcopy.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/regexp-stack.h b/deps/v8/src/regexp/regexp-stack.h index 37cecd355b..b1d4571760 100644 --- a/deps/v8/src/regexp/regexp-stack.h +++ b/deps/v8/src/regexp/regexp-stack.h @@ -7,7 +7,7 @@ #include "src/base/logging.h" #include "src/base/macros.h" -#include "src/globals.h" +#include "src/common/globals.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/regexp-utils.cc b/deps/v8/src/regexp/regexp-utils.cc index e2e95493fe..49f9d4476b 100644 --- a/deps/v8/src/regexp/regexp-utils.cc +++ b/deps/v8/src/regexp/regexp-utils.cc @@ -4,10 +4,10 @@ #include "src/regexp/regexp-utils.h" +#include "src/execution/isolate.h" #include "src/heap/factory.h" -#include "src/isolate.h" -#include "src/objects-inl.h" #include "src/objects/js-regexp-inl.h" +#include "src/objects/objects-inl.h" #include "src/regexp/jsregexp.h" namespace v8 { @@ -37,7 +37,7 @@ Handle<String> RegExpUtils::GenericCaptureGetter( namespace { V8_INLINE bool HasInitialRegExpMap(Isolate* isolate, JSReceiver recv) { - return recv->map() == isolate->regexp_function()->initial_map(); + return recv.map() == isolate->regexp_function()->initial_map(); } } // namespace @@ -48,7 +48,7 @@ MaybeHandle<Object> RegExpUtils::SetLastIndex(Isolate* isolate, Handle<Object> value_as_object = isolate->factory()->NewNumberFromInt64(value); if (HasInitialRegExpMap(isolate, *recv)) { - JSRegExp::cast(*recv)->set_last_index(*value_as_object, SKIP_WRITE_BARRIER); + JSRegExp::cast(*recv).set_last_index(*value_as_object, SKIP_WRITE_BARRIER); return recv; } else { return Object::SetProperty( @@ -60,7 +60,7 @@ MaybeHandle<Object> RegExpUtils::SetLastIndex(Isolate* isolate, MaybeHandle<Object> RegExpUtils::GetLastIndex(Isolate* isolate, Handle<JSReceiver> recv) { if (HasInitialRegExpMap(isolate, *recv)) { - return handle(JSRegExp::cast(*recv)->last_index(), isolate); + return handle(JSRegExp::cast(*recv).last_index(), isolate); } else { return Object::GetProperty(isolate, recv, isolate->factory()->lastIndex_string()); @@ -89,7 +89,7 @@ MaybeHandle<Object> RegExpUtils::RegExpExec(Isolate* isolate, Handle<Object> result; ASSIGN_RETURN_ON_EXCEPTION( isolate, result, - Execution::Call(isolate, exec, regexp, argc, argv.start()), Object); + Execution::Call(isolate, exec, regexp, argc, argv.begin()), Object); if (!result->IsJSReceiver() && !result->IsNull(isolate)) { THROW_NEW_ERROR(isolate, @@ -115,7 +115,7 @@ MaybeHandle<Object> RegExpUtils::RegExpExec(Isolate* isolate, ScopedVector<Handle<Object>> argv(argc); argv[0] = string; - return Execution::Call(isolate, regexp_exec, regexp, argc, argv.start()); + return Execution::Call(isolate, regexp_exec, regexp, argc, argv.begin()); } } @@ -158,35 +158,33 @@ bool RegExpUtils::IsUnmodifiedRegExp(Isolate* isolate, Handle<Object> obj) { if (!HasInitialRegExpMap(isolate, recv)) return false; // Check the receiver's prototype's map. - Object proto = recv->map()->prototype(); - if (!proto->IsJSReceiver()) return false; + Object proto = recv.map().prototype(); + if (!proto.IsJSReceiver()) return false; Handle<Map> initial_proto_initial_map = isolate->regexp_prototype_map(); - Map proto_map = JSReceiver::cast(proto)->map(); + Map proto_map = JSReceiver::cast(proto).map(); if (proto_map != *initial_proto_initial_map) { return false; } // Check that the "exec" method is unmodified. - if (FLAG_track_constant_fields) { - // Check that the index refers to "exec" method (this has to be consistent - // with the init order in the bootstrapper). - DCHECK_EQ(*(isolate->factory()->exec_string()), - proto_map->instance_descriptors()->GetKey( - JSRegExp::kExecFunctionDescriptorIndex)); - if (proto_map->instance_descriptors() - ->GetDetails(JSRegExp::kExecFunctionDescriptorIndex) - .constness() != PropertyConstness::kConst) { - return false; - } + // Check that the index refers to "exec" method (this has to be consistent + // with the init order in the bootstrapper). + DCHECK_EQ(*(isolate->factory()->exec_string()), + proto_map.instance_descriptors().GetKey( + JSRegExp::kExecFunctionDescriptorIndex)); + if (proto_map.instance_descriptors() + .GetDetails(JSRegExp::kExecFunctionDescriptorIndex) + .constness() != PropertyConstness::kConst) { + return false; } if (!isolate->IsRegExpSpeciesLookupChainIntact()) return false; // The smi check is required to omit ToLength(lastIndex) calls with possible // user-code execution on the fast path. - Object last_index = JSRegExp::cast(recv)->last_index(); - return last_index->IsSmi() && Smi::ToInt(last_index) >= 0; + Object last_index = JSRegExp::cast(recv).last_index(); + return last_index.IsSmi() && Smi::ToInt(last_index) >= 0; } uint64_t RegExpUtils::AdvanceStringIndex(Handle<String> string, uint64_t index, diff --git a/deps/v8/src/regexp/regexp-utils.h b/deps/v8/src/regexp/regexp-utils.h index 4e32bf10f4..4b8714c55f 100644 --- a/deps/v8/src/regexp/regexp-utils.h +++ b/deps/v8/src/regexp/regexp-utils.h @@ -5,7 +5,7 @@ #ifndef V8_REGEXP_REGEXP_UTILS_H_ #define V8_REGEXP_REGEXP_UTILS_H_ -#include "src/objects.h" +#include "src/objects/objects.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/s390/OWNERS b/deps/v8/src/regexp/s390/OWNERS deleted file mode 100644 index 6d1a8fc472..0000000000 --- a/deps/v8/src/regexp/s390/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -jyan@ca.ibm.com -joransiu@ca.ibm.com -michael_dawson@ca.ibm.com -miladfar@ca.ibm.com
\ No newline at end of file diff --git a/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.cc b/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.cc index e73caee402..5ebdd6ce15 100644 --- a/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.cc +++ b/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.cc @@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/v8.h" +#include "src/init/v8.h" #if V8_TARGET_ARCH_S390 -#include "src/assembler-inl.h" #include "src/base/bits.h" -#include "src/log.h" -#include "src/macro-assembler.h" +#include "src/codegen/assembler-inl.h" +#include "src/codegen/macro-assembler.h" +#include "src/logging/log.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/snapshot/embedded-data.h" #include "src/regexp/s390/regexp-macro-assembler-s390.h" -#include "src/unicode.h" +#include "src/snapshot/embedded/embedded-data.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -731,7 +731,7 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) { if (num_saved_registers_ > 8) { // One slot beyond address of register 0. __ lay(r3, MemOperand(frame_pointer(), kRegisterZero + kPointerSize)); - __ LoadImmP(r4, Operand(num_saved_registers_)); + __ Load(r4, Operand(num_saved_registers_)); Label init_loop; __ bind(&init_loop); __ StoreP(r1, MemOperand(r3, -kPointerSize)); @@ -930,8 +930,9 @@ Handle<HeapObject> RegExpMacroAssemblerS390::GetCode(Handle<String> source) { CodeDesc code_desc; masm_->GetCode(isolate(), &code_desc); - Handle<Code> code = isolate()->factory()->NewCode(code_desc, Code::REGEXP, - masm_->CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate(), code_desc, Code::REGEXP) + .set_self_reference(masm_->CodeObject()) + .Build(); PROFILE(masm_->isolate(), RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); diff --git a/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.h b/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.h index a7de245a10..636ba76079 100644 --- a/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.h +++ b/deps/v8/src/regexp/s390/regexp-macro-assembler-s390.h @@ -5,9 +5,9 @@ #ifndef V8_REGEXP_S390_REGEXP_MACRO_ASSEMBLER_S390_H_ #define V8_REGEXP_S390_REGEXP_MACRO_ASSEMBLER_S390_H_ -#include "src/macro-assembler.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/s390/assembler-s390.h" #include "src/regexp/regexp-macro-assembler.h" -#include "src/s390/assembler-s390.h" namespace v8 { namespace internal { diff --git a/deps/v8/src/regexp/special-case.h b/deps/v8/src/regexp/special-case.h new file mode 100644 index 0000000000..1ccec5d31a --- /dev/null +++ b/deps/v8/src/regexp/special-case.h @@ -0,0 +1,79 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_REGEXP_SPECIAL_CASE_H_ +#define V8_REGEXP_SPECIAL_CASE_H_ + +#ifdef V8_INTL_SUPPORT +#include "unicode/uversion.h" +namespace U_ICU_NAMESPACE { +class UnicodeSet; +} // namespace U_ICU_NAMESPACE + +namespace v8 { +namespace internal { + +// Functions to build special sets of Unicode characters that need special +// handling under "i" mode that cannot use closeOver(USET_CASE_INSENSITIVE). +// +// For the characters in the "ignore set", the process should not treat other +// characters in the result of closeOver(USET_CASE_INSENSITIVE) as case +// equivlant under the ECMA262 RegExp "i" mode because these characters are +// uppercase themselves that no other characters in the set uppercase to. +// +// For the characters in the "special add set", the proecess should add only +// those characters in the result of closeOver(USET_CASE_INSENSITIVE) which is +// not uppercase characters as case equivlant under the ECMA262 RegExp "i" mode +// and also that ONE uppercase character that other non uppercase character +// uppercase into to the set. Other uppercase characters in the result of +// closeOver(USET_CASE_INSENSITIVE) should not be considered because ECMA262 +// RegExp "i" mode consider two characters as "case equivlant" if both +// characters uppercase to the same character. +// +// For example, consider the following case equivalent set defined by Unicode +// standard. Notice there are more than one uppercase characters in this set: +// U+212B Å Angstrom Sign - an uppercase character. +// U+00C5 Å Latin Capital Letter A with Ring Above - an uppercase character. +// U+00E5 å Latin Small Letter A with Ring Above - a lowercase character which +// uppercase to U+00C5. +// In this case equivlant set is a special set and need special handling while +// considering "case equivlant" under the ECMA262 RegExp "i" mode which is +// different than Unicode Standard: +// * U+212B should be included into the "ignore" set because there are no other +// characters, under the ECMA262 "i" mode, are considered as "case equivlant" +// to it because U+212B is itself an uppercase but neither U+00C5 nor U+00E5 +// uppercase to U+212B. +// * U+00C5 and U+00E5 will both be included into the "special add" set. While +// calculate the "equivlant set" under ECMA262 "i" mode, the process will +// add U+00E5, because it is not an uppercase character in the set. The +// process will also add U+00C5, because it is the uppercase character which +// other non uppercase character, U+00C5, uppercase into. +// +// For characters not included in "ignore set" and "special add set", the +// process will just use closeOver(USET_CASE_INSENSITIVE) to calcualte, which is +// much faster. +// +// Under Unicode 12.0, there are only 7 characters in the "special add set" and +// 4 characters in "ignore set" so even the special add process is slower, it is +// limited to a small set of cases only. +// +// The implementation of these two function will be generated by calling ICU +// icu::UnicodeSet during the build time into gen/src/regexp/special-case.cc by +// the code in src/regexp/gen-regexp-special-case.cc. +// +// These two function will be used with LazyInstance<> template to generate +// global sharable set to reduce memory usage and speed up performance. + +// Function to build and return the Ignore set. +icu::UnicodeSet BuildIgnoreSet(); + +// Function to build and return the Special Add set. +icu::UnicodeSet BuildSpecialAddSet(); + +} // namespace internal +} // namespace v8 + +#endif // V8_INTL_SUPPORT + +#endif // V8_REGEXP_SPECIAL_CASE_H_ diff --git a/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc b/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc index 856c481b0a..798484d52f 100644 --- a/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc +++ b/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.cc @@ -6,13 +6,13 @@ #include "src/regexp/x64/regexp-macro-assembler-x64.h" +#include "src/codegen/macro-assembler.h" #include "src/heap/factory.h" -#include "src/log.h" -#include "src/macro-assembler.h" -#include "src/objects-inl.h" +#include "src/logging/log.h" +#include "src/objects/objects-inl.h" #include "src/regexp/regexp-macro-assembler.h" #include "src/regexp/regexp-stack.h" -#include "src/unicode.h" +#include "src/strings/unicode.h" namespace v8 { namespace internal { @@ -746,7 +746,7 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { __ bind(&stack_ok); // Allocate space on stack for registers. - __ subq(rsp, Immediate(num_registers_ * kSystemPointerSize)); + __ AllocateStackSpace(num_registers_ * kSystemPointerSize); // Load string length. __ movq(rsi, Operand(rbp, kInputEnd)); // Load input position. @@ -766,18 +766,6 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { // position registers. __ movq(Operand(rbp, kStringStartMinusOne), rax); -#if V8_OS_WIN - // Ensure that we have written to each stack page, in order. Skipping a page - // on Windows can cause segmentation faults. Assuming page size is 4k. - const int kPageSize = 4096; - const int kRegistersPerPage = kPageSize / kSystemPointerSize; - for (int i = num_saved_registers_ + kRegistersPerPage - 1; - i < num_registers_; - i += kRegistersPerPage) { - __ movq(register_location(i), rax); // One write every page. - } -#endif // V8_OS_WIN - // Initialize code object pointer. __ Move(code_object_pointer(), masm_.CodeObject()); @@ -1006,8 +994,9 @@ Handle<HeapObject> RegExpMacroAssemblerX64::GetCode(Handle<String> source) { CodeDesc code_desc; Isolate* isolate = this->isolate(); masm_.GetCode(isolate, &code_desc); - Handle<Code> code = - isolate->factory()->NewCode(code_desc, Code::REGEXP, masm_.CodeObject()); + Handle<Code> code = Factory::CodeBuilder(isolate, code_desc, Code::REGEXP) + .set_self_reference(masm_.CodeObject()) + .Build(); PROFILE(isolate, RegExpCodeCreateEvent(AbstractCode::cast(*code), *source)); return Handle<HeapObject>::cast(code); } diff --git a/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h b/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h index 83193f9319..59b80ef802 100644 --- a/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h +++ b/deps/v8/src/regexp/x64/regexp-macro-assembler-x64.h @@ -5,9 +5,9 @@ #ifndef V8_REGEXP_X64_REGEXP_MACRO_ASSEMBLER_X64_H_ #define V8_REGEXP_X64_REGEXP_MACRO_ASSEMBLER_X64_H_ -#include "src/macro-assembler.h" +#include "src/codegen/macro-assembler.h" +#include "src/codegen/x64/assembler-x64.h" #include "src/regexp/regexp-macro-assembler.h" -#include "src/x64/assembler-x64.h" #include "src/zone/zone-chunk-list.h" namespace v8 { |