aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc')
-rw-r--r--deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc52
1 files changed, 35 insertions, 17 deletions
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 36ac93275e..81f7aa73c8 100644
--- a/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc
+++ b/deps/v8/src/regexp/mips/regexp-macro-assembler-mips.cc
@@ -7,12 +7,12 @@
#include "src/regexp/mips/regexp-macro-assembler-mips.h"
#include "src/assembler-inl.h"
-#include "src/code-stubs.h"
#include "src/log.h"
#include "src/macro-assembler.h"
#include "src/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"
namespace v8 {
@@ -23,7 +23,7 @@ namespace internal {
* This assembler uses the following register assignment convention
* - t7 : Temporarily stores the index of capture start after a matching pass
* for a global regexp.
- * - t1 : Pointer to current code object (Code*) including heap object tag.
+ * - t1 : Pointer to current Code object including heap object tag.
* - t2 : Current position in input, as negative offset from end of string.
* Please notice that this is the byte offset, not the character offset!
* - t3 : Currently loaded character. Must be loaded using
@@ -75,7 +75,7 @@ namespace internal {
* The data up to the return address must be placed there by the calling
* code and the remaining arguments are passed in registers, e.g. by calling the
* code entry as cast to a function with the signature:
- * int (*match)(String* input_string,
+ * int (*match)(String input_string,
* int start_index,
* Address start,
* Address end,
@@ -90,12 +90,14 @@ namespace internal {
#define __ ACCESS_MASM(masm_)
+const int RegExpMacroAssemblerMIPS::kRegExpCodeSize;
+
RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone,
Mode mode,
int registers_to_save)
: NativeRegExpMacroAssembler(isolate, zone),
- masm_(new MacroAssembler(isolate, nullptr, kRegExpCodeSize,
- CodeObjectRequired::kYes)),
+ masm_(new MacroAssembler(isolate, CodeObjectRequired::kYes,
+ NewAssemblerBuffer(kRegExpCodeSize))),
mode_(mode),
num_registers_(registers_to_save),
num_saved_registers_(registers_to_save),
@@ -115,7 +117,6 @@ RegExpMacroAssemblerMIPS::RegExpMacroAssemblerMIPS(Isolate* isolate, Zone* zone,
__ bind(&start_label_); // And then continue from here.
}
-
RegExpMacroAssemblerMIPS::~RegExpMacroAssemblerMIPS() {
delete masm_;
// Unuse labels in case we throw away the assembler without calling GetCode.
@@ -156,7 +157,7 @@ void RegExpMacroAssemblerMIPS::AdvanceRegister(int reg, int by) {
void RegExpMacroAssemblerMIPS::Backtrack() {
CheckPreemption();
- // Pop Code* offset from backtrack stack, add Code* and jump to location.
+ // Pop Code offset from backtrack stack, add Code and jump to location.
Pop(a0);
__ Addu(a0, a0, code_pointer());
__ Jump(a0);
@@ -1087,6 +1088,9 @@ bool RegExpMacroAssemblerMIPS::CanReadUnaligned() {
// Private methods:
void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
+ DCHECK(!isolate()->ShouldLoadConstantsFromRootList());
+ DCHECK(!masm_->options().isolate_independent_code);
+
int stack_alignment = base::OS::ActivationFrameAlignment();
// Align the stack pointer and save the original sp value on the stack.
@@ -1097,16 +1101,16 @@ void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
__ sw(scratch, MemOperand(sp));
__ mov(a2, frame_pointer());
- // Code* of self.
+ // Code of self.
__ li(a1, Operand(masm_->CodeObject()), CONSTANT_SIZE);
// We need to make room for the return address on the stack.
DCHECK(IsAligned(stack_alignment, kPointerSize));
__ Subu(sp, sp, Operand(stack_alignment));
- // Stack pointer now points to cell where return address is to be written.
- // Arguments are in registers, meaning we teat the return address as
- // argument 5. Since DirectCEntryStub will handleallocating space for the C
+ // The stack pointer now points to cell where the return address will be
+ // written. Arguments are in registers, meaning we treat the return address as
+ // argument 5. Since DirectCEntry will handle allocating space for the C
// argument slots, we don't need to care about that here. This is how the
// stack will look (sp meaning the value of sp at this moment):
// [sp + 3] - empty slot if needed for alignment.
@@ -1120,10 +1124,24 @@ void RegExpMacroAssemblerMIPS::CallCheckStackGuardState(Register scratch) {
ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(masm_->isolate());
__ li(t9, Operand(stack_guard_check));
- DirectCEntryStub stub(isolate());
- stub.GenerateCall(masm_, t9);
- // DirectCEntryStub allocated space for the C argument slots so we have to
+ if (FLAG_embedded_builtins) {
+ EmbeddedData d = EmbeddedData::FromBlob();
+ CHECK(Builtins::IsIsolateIndependent(Builtins::kDirectCEntry));
+ Address entry = d.InstructionStartOfBuiltin(Builtins::kDirectCEntry);
+ __ li(kScratchReg, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
+ __ Call(kScratchReg);
+ } else {
+ // TODO(v8:8519): Remove this once embedded builtins are on unconditionally.
+ Handle<Code> code = BUILTIN_CODE(isolate(), DirectCEntry);
+ __ li(kScratchReg,
+ Operand(reinterpret_cast<intptr_t>(code.location()),
+ RelocInfo::CODE_TARGET),
+ CONSTANT_SIZE);
+ __ Call(kScratchReg);
+ }
+
+ // DirectCEntry allocated space for the C argument slots so we have to
// drop them with the return address from the stack with loading saved sp.
// At this point stack must look:
// [sp + 7] - empty slot if needed for alignment.
@@ -1152,15 +1170,15 @@ static T* frame_entry_address(Address re_frame, int frame_offset) {
return reinterpret_cast<T*>(re_frame + frame_offset);
}
-
int RegExpMacroAssemblerMIPS::CheckStackGuardState(Address* return_address,
- Code* re_code,
+ Address raw_code,
Address re_frame) {
+ Code re_code = Code::cast(Object(raw_code));
return NativeRegExpMacroAssembler::CheckStackGuardState(
frame_entry<Isolate*>(re_frame, kIsolate),
frame_entry<int>(re_frame, kStartIndex),
frame_entry<int>(re_frame, kDirectCall) == 1, return_address, re_code,
- frame_entry_address<String*>(re_frame, kInputString),
+ frame_entry_address<Address>(re_frame, kInputString),
frame_entry_address<const byte*>(re_frame, kInputStart),
frame_entry_address<const byte*>(re_frame, kInputEnd));
}