20 DCHECK(!masm->has_frame());
21 masm->set_has_frame(
true);
28 masm->set_has_frame(
false);
36 if (!FLAG_fast_math)
return &std::exp;
40 if (buffer ==
NULL)
return &std::exp;
41 ExternalReference::InitializeMathExpData();
43 MacroAssembler masm(
NULL, buffer,
static_cast<int>(actual_size));
45 XMMRegister input =
xmm0;
46 XMMRegister result =
xmm1;
59 DCHECK(!RelocInfo::RequiresRelocation(desc));
63 return FUNCTION_CAST<UnaryMathFunction>(buffer);
72 if (buffer ==
NULL)
return &std::sqrt;
74 MacroAssembler masm(
NULL, buffer,
static_cast<int>(actual_size));
82 DCHECK(!RelocInfo::RequiresRelocation(desc));
86 return FUNCTION_CAST<UnaryMathFunction>(buffer);
91 typedef double (*ModuloFunction)(double, double);
93 ModuloFunction CreateModuloFunction() {
95 byte* buffer =
static_cast<byte*
>(
98 Assembler masm(
NULL, buffer,
static_cast<int>(actual_size));
121 __ testb(
rax, Immediate(5));
122 __ j(
zero, &no_exceptions);
124 __ bind(&no_exceptions);
129 Label partial_remainder_loop;
130 __ bind(&partial_remainder_loop);
134 __ testl(
rax, Immediate(0x400 ));
144 __ testb(
rax, Immediate(5));
145 __ j(
zero, &valid_result);
147 int64_t kNaNValue =
V8_INT64_C(0x7ff8000000000000);
148 __ movq(
rcx, kNaNValue);
151 __ jmp(&return_result);
154 __ bind(&valid_result);
159 __ bind(&return_result);
162 Label clear_exceptions;
163 __ testb(
rax, Immediate(0x3f ));
166 __ bind(&clear_exceptions);
174 return FUNCTION_CAST<ModuloFunction>(buffer);
184 #define __ ACCESS_MASM(masm)
187 MacroAssembler* masm,
193 Label* allocation_memento_found) {
195 Register scratch =
rdi;
200 __ JumpIfJSArrayHasAllocationMemento(
201 receiver, scratch, allocation_memento_found);
206 __ RecordWriteField(receiver,
217 MacroAssembler* masm,
231 Label allocated, new_backing_store, only_change_map, done;
234 __ JumpIfJSArrayHasAllocationMemento(
rdx,
rdi, fail);
240 __ CompareRoot(
r8, Heap::kEmptyFixedArrayRootIndex);
248 Heap::kFixedCOWArrayMapRootIndex);
249 __ j(
equal, &new_backing_store);
254 __ jmp(&new_backing_store);
261 __ JumpIfNotInNewSpace(
r8,
rdi, &new_backing_store);
269 __ LoadRoot(
rdi, Heap::kFixedDoubleArrayMapRootIndex);
275 __ RecordWriteField(
rdx,
288 Label loop, entry, convert_hole;
294 __ bind(&new_backing_store);
298 __ LoadRoot(
rdi, Heap::kFixedDoubleArrayMapRootIndex);
303 __ RecordWriteField(
rdx,
315 __ bind(&only_change_map);
318 __ RecordWriteField(
rdx,
333 __ JumpIfNotSmi(
rbx, &convert_hole);
339 __ bind(&convert_hole);
341 if (FLAG_debug_code) {
342 __ CompareRoot(
rbx, Heap::kTheHoleValueRootIndex);
343 __ Assert(
equal, kObjectFoundInSmiOnlyArray);
356 MacroAssembler* masm,
369 Label loop, entry, convert_hole, gc_required, only_change_map;
372 __ JumpIfJSArrayHasAllocationMemento(
rdx,
rdi, fail);
378 __ CompareRoot(
r8, Heap::kEmptyFixedArrayRootIndex);
390 __ LoadRoot(
rdi, Heap::kFixedArrayMapRootIndex);
397 __ LoadRoot(
rdi, Heap::kTheHoleValueRootIndex);
403 __ bind(&gc_required);
420 __ AllocateHeapNumber(
rax,
r15, &gc_required);
429 __ RecordWriteArray(
r11,
435 __ jmp(&entry, Label::kNear);
438 __ bind(&convert_hole);
451 __ RecordWriteField(
rdx,
461 __ bind(&only_change_map);
464 __ RecordWriteField(
rdx,
478 Label* call_runtime) {
484 Label check_sequential;
486 __ j(
zero, &check_sequential, Label::kNear);
491 __ j(
zero, &cons_string, Label::kNear);
494 Label indirect_string_loaded;
496 __ addp(index, result);
498 __ jmp(&indirect_string_loaded, Label::kNear);
505 __ bind(&cons_string);
507 Heap::kempty_stringRootIndex);
511 __ bind(&indirect_string_loaded);
519 __ bind(&check_sequential);
522 __ j(
zero, &seq_string, Label::kNear);
525 Label one_byte_external, done;
526 if (FLAG_debug_code) {
530 __ Assert(
zero, kExternalStringExpectedButNotFound);
542 __ movzxwl(result, Operand(result, index,
times_2, 0));
543 __ jmp(&done, Label::kNear);
544 __ bind(&one_byte_external);
546 __ movzxbl(result, Operand(result, index,
times_1, 0));
547 __ jmp(&done, Label::kNear);
551 __ bind(&seq_string);
564 __ jmp(&done, Label::kNear);
580 XMMRegister double_scratch,
583 DCHECK(!input.is(result));
584 DCHECK(!input.is(double_scratch));
585 DCHECK(!result.is(double_scratch));
587 DCHECK(ExternalReference::math_exp_constants(0).address() !=
NULL);
588 DCHECK(!masm->serializer_enabled());
594 __ xorpd(result, result);
595 __ ucomisd(double_scratch, input);
602 __ mulsd(double_scratch, input);
603 __ addsd(double_scratch, result);
604 __ movq(temp2, double_scratch);
605 __ subsd(double_scratch, result);
607 __ leaq(temp1, Operand(temp2, 0x1ff800));
608 __ andq(temp2, Immediate(0x7ff));
609 __ shrq(temp1, Immediate(11));
612 __ shlq(temp1, Immediate(52));
615 __ subsd(double_scratch, input);
616 __ movsd(input, double_scratch);
617 __ subsd(result, double_scratch);
618 __ mulsd(input, double_scratch);
619 __ mulsd(result, input);
620 __ movq(input, temp1);
622 __ subsd(result, double_scratch);
624 __ mulsd(result, input);
638 patcher.masm()->pushq(
rbp);
639 patcher.masm()->movp(
rbp,
rsp);
640 patcher.masm()->Push(
rsi);
641 patcher.masm()->Push(
rdi);
646 bool CodeAgingHelper::IsOld(
byte* candidate)
const {
653 bool result = isolate->code_aging_helper()->IsYoung(sequence);
654 DCHECK(result || isolate->code_aging_helper()->IsOld(sequence));
666 Address target_address = sequence + *
reinterpret_cast<int*
>(sequence) +
678 uint32_t young_length = isolate->code_aging_helper()->young_sequence_length();
680 isolate->code_aging_helper()->CopyYoungSequenceTo(sequence);
684 CodePatcher patcher(sequence, young_length);
685 patcher.masm()->call(stub->instruction_start());
692 Operand StackArgumentsAccessor::GetArgumentOperand(
int index) {
695 int displacement_to_last_argument = base_reg_.is(
rsp) ?
697 displacement_to_last_argument += extra_displacement_to_last_argument_;
698 if (argument_count_reg_.is(
no_reg)) {
701 DCHECK(argument_count_immediate_ + receiver > 0);
702 return Operand(base_reg_, displacement_to_last_argument +
703 (argument_count_immediate_ + receiver - 1 - index) *
kPointerSize);
708 displacement_to_last_argument + (receiver - 1 - index) *
kPointerSize);
static void * Allocate(const size_t requested, size_t *allocated, bool is_executable)
static void ProtectCode(void *address, const size_t size)
static const int kMinimalBufferSize
static const int kShortCallInstructionLength
static const int kCallTargetAddressOffset
const EmbeddedVector< byte, kNoCodeAgeSequenceLength > young_sequence_
static Code * GetCodeAgeStub(Isolate *isolate, Age age, MarkingParity parity)
static Code * GetCodeFromTargetAddress(Address address)
static void PatchPlatformCodeAge(Isolate *isolate, byte *sequence, Age age, MarkingParity parity)
static bool IsYoungSequence(Isolate *isolate, byte *sequence)
static void GetCodeAgeAndParity(Code *code, Age *age, MarkingParity *parity)
static const int kFirstOffset
static const int kSecondOffset
static void FlushICache(void *start, size_t size)
static void GenerateSmiToDouble(MacroAssembler *masm, Register receiver, Register key, Register value, Register target_map, AllocationSiteMode mode, Label *fail)
static void GenerateMapChangeElementsTransition(MacroAssembler *masm, Register receiver, Register key, Register value, Register target_map, AllocationSiteMode mode, Label *allocation_memento_found)
static void GenerateDoubleToObject(MacroAssembler *masm, Register receiver, Register key, Register value, Register target_map, AllocationSiteMode mode, Label *fail)
static const int kResourceDataOffset
static const int kLengthOffset
static const int kHeaderSize
static const int kValueOffset
static const int kMapOffset
static const int kElementsOffset
static const int kInstanceTypeOffset
static void EmitMathExp(MacroAssembler *masm, DwVfpRegister input, DwVfpRegister result, DwVfpRegister double_scratch1, DwVfpRegister double_scratch2, Register temp1, Register temp2, Register temp3)
static const int kHeaderSize
static const int kParentOffset
static const int kOffsetOffset
static const int kContextOffset
static void Generate(MacroAssembler *masm, Register string, Register index, Register result, Label *call_runtime)
virtual void AfterCall(MacroAssembler *masm) const
virtual void BeforeCall(MacroAssembler *masm) const
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
static int Push(SpecialRPOStackFrame *stack, int depth, BasicBlock *child, int unvisited)
const uint32_t kStringEncodingMask
bool AreAliased(const CPURegister ®1, const CPURegister ®2, const CPURegister ®3=NoReg, const CPURegister ®4=NoReg, const CPURegister ®5=NoReg, const CPURegister ®6=NoReg, const CPURegister ®7=NoReg, const CPURegister ®8=NoReg)
const Register kScratchRegister
const uint32_t kTwoByteStringTag
const uint32_t kShortExternalStringTag
Operand FieldOperand(Register object, int offset)
const uint32_t kOneByteStringTag
UnaryMathFunction CreateExpFunction()
const uint32_t kStringRepresentationMask
@ ARGUMENTS_CONTAIN_RECEIVER
const uint32_t kSlicedNotConsMask
static const byte kCallOpcode
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
const uint64_t kHoleNanInt64
UnaryMathFunction CreateSqrtFunction()
double(* UnaryMathFunction)(double x)
static const int kNoCodeAgeSequenceLength
const uint32_t kIsIndirectStringMask
Debugger support for the V8 JavaScript engine.