summaryrefslogtreecommitdiff
path: root/deps/v8/src/mips64/codegen-mips64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/mips64/codegen-mips64.cc')
-rw-r--r--deps/v8/src/mips64/codegen-mips64.cc133
1 files changed, 15 insertions, 118 deletions
diff --git a/deps/v8/src/mips64/codegen-mips64.cc b/deps/v8/src/mips64/codegen-mips64.cc
index 814c46a326..970e0efe56 100644
--- a/deps/v8/src/mips64/codegen-mips64.cc
+++ b/deps/v8/src/mips64/codegen-mips64.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/mips64/codegen-mips64.h"
-
#if V8_TARGET_ARCH_MIPS64
#include <memory>
@@ -15,27 +13,26 @@
namespace v8 {
namespace internal {
-
#define __ masm.
-
#if defined(V8_HOST_ARCH_MIPS)
+
MemCopyUint8Function CreateMemCopyUint8Function(Isolate* isolate,
MemCopyUint8Function stub) {
#if defined(USE_SIMULATOR)
return stub;
#else
- size_t actual_size;
+ size_t allocated = 0;
byte* buffer =
- static_cast<byte*>(base::OS::Allocate(3 * KB, &actual_size, true));
+ AllocateSystemPage(isolate->heap()->GetRandomMmapAddr(), &allocated);
if (buffer == nullptr) return stub;
- // This code assumes that cache lines are 32 bytes and if the cache line is
- // larger it will not work correctly.
- MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
+ MacroAssembler masm(isolate, buffer, static_cast<int>(allocated),
CodeObjectRequired::kNo);
+ // This code assumes that cache lines are 32 bytes and if the cache line is
+ // larger it will not work correctly.
{
Label lastb, unaligned, aligned, chkw,
loop16w, chk1w, wordCopy_loop, skip_pref, lastbloop,
@@ -548,8 +545,9 @@ MemCopyUint8Function CreateMemCopyUint8Function(Isolate* isolate,
masm.GetCode(isolte, &desc);
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
- Assembler::FlushICache(isolate, buffer, actual_size);
- base::OS::ProtectCode(buffer, actual_size);
+ Assembler::FlushICache(isolate, buffer, allocated);
+ CHECK(base::OS::SetPermissions(buffer, allocated,
+ base::OS::MemoryPermission::kReadExecute));
return FUNCTION_CAST<MemCopyUint8Function>(buffer);
#endif
}
@@ -559,12 +557,12 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
#if defined(USE_SIMULATOR)
return nullptr;
#else
- size_t actual_size;
+ size_t allocated = 0;
byte* buffer =
- static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
+ AllocateSystemPage(isolate->heap()->GetRandomMmapAddr(), &allocated);
if (buffer == nullptr) return nullptr;
- MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
+ MacroAssembler masm(isolate, buffer, static_cast<int>(allocated),
CodeObjectRequired::kNo);
__ MovFromFloatParameter(f12);
@@ -576,116 +574,15 @@ UnaryMathFunctionWithIsolate CreateSqrtFunction(Isolate* isolate) {
masm.GetCode(isolate, &desc);
DCHECK(!RelocInfo::RequiresRelocation(isolate, desc));
- Assembler::FlushICache(isolate, buffer, actual_size);
- base::OS::ProtectCode(buffer, actual_size);
+ Assembler::FlushICache(isolate, buffer, allocated);
+ CHECK(base::OS::SetPermissions(buffer, allocated,
+ base::OS::MemoryPermission::kReadExecute));
return FUNCTION_CAST<UnaryMathFunctionWithIsolate>(buffer);
#endif
}
#undef __
-// -------------------------------------------------------------------------
-// Code generators
-
-#define __ ACCESS_MASM(masm)
-
-void StringCharLoadGenerator::Generate(MacroAssembler* masm,
- Register string,
- Register index,
- Register result,
- Label* call_runtime) {
- Label indirect_string_loaded;
- __ bind(&indirect_string_loaded);
-
- // Fetch the instance type of the receiver into result register.
- __ Ld(result, FieldMemOperand(string, HeapObject::kMapOffset));
- __ Lbu(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
-
- // We need special handling for indirect strings.
- Label check_sequential;
- __ And(at, result, Operand(kIsIndirectStringMask));
- __ Branch(&check_sequential, eq, at, Operand(zero_reg));
-
- // Dispatch on the indirect string shape: slice or cons.
- Label cons_string, thin_string;
- __ And(at, result, Operand(kStringRepresentationMask));
- __ Branch(&cons_string, eq, at, Operand(kConsStringTag));
- __ Branch(&thin_string, eq, at, Operand(kThinStringTag));
-
- // Handle slices.
- __ Ld(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
- __ Ld(string, FieldMemOperand(string, SlicedString::kParentOffset));
- __ dsra32(at, result, 0);
- __ Daddu(index, index, at);
- __ jmp(&indirect_string_loaded);
-
- // Handle thin strings.
- __ bind(&thin_string);
- __ Ld(string, FieldMemOperand(string, ThinString::kActualOffset));
- __ jmp(&indirect_string_loaded);
-
- // Handle cons strings.
- // Check whether the right hand side is the empty string (i.e. if
- // this is really a flat string in a cons string). If that is not
- // the case we would rather go to the runtime system now to flatten
- // the string.
- __ bind(&cons_string);
- __ Ld(result, FieldMemOperand(string, ConsString::kSecondOffset));
- __ LoadRoot(at, Heap::kempty_stringRootIndex);
- __ Branch(call_runtime, ne, result, Operand(at));
- // Get the first of the two strings and load its instance type.
- __ Ld(string, FieldMemOperand(string, ConsString::kFirstOffset));
- __ jmp(&indirect_string_loaded);
-
- // Distinguish sequential and external strings. Only these two string
- // representations can reach here (slices and flat cons strings have been
- // reduced to the underlying sequential or external string).
- Label external_string, check_encoding;
- __ bind(&check_sequential);
- STATIC_ASSERT(kSeqStringTag == 0);
- __ And(at, result, Operand(kStringRepresentationMask));
- __ Branch(&external_string, ne, at, Operand(zero_reg));
-
- // Prepare sequential strings
- STATIC_ASSERT(SeqTwoByteString::kHeaderSize == SeqOneByteString::kHeaderSize);
- __ Daddu(string,
- string,
- SeqTwoByteString::kHeaderSize - kHeapObjectTag);
- __ jmp(&check_encoding);
-
- // Handle external strings.
- __ bind(&external_string);
- if (FLAG_debug_code) {
- // Assert that we do not have a cons or slice (indirect strings) here.
- // Sequential strings have already been ruled out.
- __ And(at, result, Operand(kIsIndirectStringMask));
- __ Assert(eq, kExternalStringExpectedButNotFound,
- at, Operand(zero_reg));
- }
- // Rule out short external strings.
- STATIC_ASSERT(kShortExternalStringTag != 0);
- __ And(at, result, Operand(kShortExternalStringMask));
- __ Branch(call_runtime, ne, at, Operand(zero_reg));
- __ Ld(string, FieldMemOperand(string, ExternalString::kResourceDataOffset));
-
- Label one_byte, done;
- __ bind(&check_encoding);
- STATIC_ASSERT(kTwoByteStringTag == 0);
- __ And(at, result, Operand(kStringEncodingMask));
- __ Branch(&one_byte, ne, at, Operand(zero_reg));
- // Two-byte string.
- __ Dlsa(at, string, index, 1);
- __ Lhu(result, MemOperand(at));
- __ jmp(&done);
- __ bind(&one_byte);
- // One_byte string.
- __ Daddu(at, string, index);
- __ Lbu(result, MemOperand(at));
- __ bind(&done);
-}
-
-#undef __
-
} // namespace internal
} // namespace v8