28 #ifndef V8_X64_CODE_STUBS_X64_H_
29 #define V8_X64_CODE_STUBS_X64_H_
39 class StoreBufferOverflowStub:
public PlatformCodeStub {
42 : save_doubles_(save_fp) { }
52 Major MajorKey() {
return StoreBufferOverflow; }
53 int MinorKey() {
return (save_doubles_ ==
kSaveFPRegs) ? 1 : 0; }
57 class StringHelper :
public AllStatic {
83 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
87 class SubStringStub:
public PlatformCodeStub {
92 Major MajorKey() {
return SubString; }
93 int MinorKey() {
return 0; }
95 void Generate(MacroAssembler* masm);
99 class StringCompareStub:
public PlatformCodeStub {
121 virtual Major MajorKey() {
return StringCompare; }
122 virtual int MinorKey() {
return 0; }
123 virtual void Generate(MacroAssembler* masm);
125 static void GenerateAsciiCharsCompareLoop(
126 MacroAssembler* masm,
131 Label* chars_not_equal,
132 Label::Distance near_jump = Label::kFar);
136 class NameDictionaryLookupStub:
public PlatformCodeStub {
144 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { }
166 static const int kInlinedProbes = 4;
167 static const int kTotalProbes = 20;
169 static const int kCapacityOffset =
173 static const int kElementsStartOffset =
177 Major MajorKey() {
return NameDictionaryLookup; }
180 return DictionaryBits::encode(dictionary_.
code()) |
181 ResultBits::encode(result_.
code()) |
182 IndexBits::encode(index_.
code()) |
183 LookupModeBits::encode(mode_);
186 class DictionaryBits:
public BitField<int, 0, 4> {};
187 class ResultBits:
public BitField<int, 4, 4> {};
188 class IndexBits:
public BitField<int, 8, 4> {};
189 class LookupModeBits:
public BitField<LookupMode, 12, 1> {};
191 Register dictionary_;
198 class RecordWriteStub:
public PlatformCodeStub {
208 remembered_set_action_(remembered_set_action),
209 save_fp_regs_mode_(fp_mode),
274 class RegisterAllocation {
279 : object_orig_(object),
280 address_orig_(address),
281 scratch0_orig_(scratch0),
284 scratch0_(scratch0) {
286 scratch1_ = GetRegThatIsNotRcxOr(object_, address_, scratch0_);
287 if (scratch0.
is(
rcx)) {
288 scratch0_ = GetRegThatIsNotRcxOr(object_, address_, scratch1_);
290 if (
object.is(
rcx)) {
291 object_ = GetRegThatIsNotRcxOr(address_, scratch0_, scratch1_);
293 if (address.
is(
rcx)) {
294 address_ = GetRegThatIsNotRcxOr(object_, scratch0_, scratch1_);
299 void Save(MacroAssembler* masm) {
300 ASSERT(!address_orig_.is(object_));
301 ASSERT(object_.is(object_orig_) || address_.is(address_orig_));
308 if (!scratch0_.is(scratch0_orig_)) masm->Push(scratch0_);
309 if (!
rcx.
is(scratch0_orig_) &&
310 !
rcx.
is(object_orig_) &&
311 !
rcx.
is(address_orig_)) {
314 masm->Push(scratch1_);
315 if (!address_.is(address_orig_)) {
316 masm->Push(address_);
317 masm->movp(address_, address_orig_);
319 if (!object_.is(object_orig_)) {
321 masm->movp(object_, object_orig_);
325 void Restore(MacroAssembler* masm) {
329 if (!object_.is(object_orig_)) {
330 masm->movp(object_orig_, object_);
333 if (!address_.is(address_orig_)) {
334 masm->movp(address_orig_, address_);
337 masm->Pop(scratch1_);
338 if (!
rcx.
is(scratch0_orig_) &&
339 !
rcx.
is(object_orig_) &&
340 !
rcx.
is(address_orig_)) {
343 if (!scratch0_.is(scratch0_orig_)) masm->Pop(scratch0_);
353 masm->PushCallerSaved(mode, scratch0_, scratch1_,
rcx);
356 inline void RestoreCallerSaveRegisters(MacroAssembler*masm,
358 masm->PopCallerSaved(mode, scratch0_, scratch1_,
rcx);
361 inline Register object() {
return object_; }
362 inline Register address() {
return address_; }
363 inline Register scratch0() {
return scratch0_; }
364 inline Register scratch1() {
return scratch1_; }
367 Register object_orig_;
368 Register address_orig_;
369 Register scratch0_orig_;
376 Register GetRegThatIsNotRcxOr(Register
r1,
381 if (candidate.is(
rcx))
continue;
382 if (candidate.is(r1))
continue;
383 if (candidate.is(r2))
continue;
384 if (candidate.is(r3))
continue;
393 enum OnNoNeedToInformIncrementalMarker {
394 kReturnOnNoNeedToInformIncrementalMarker,
395 kUpdateRememberedSetOnNoNeedToInformIncrementalMarker
398 void Generate(MacroAssembler* masm);
399 void GenerateIncremental(MacroAssembler* masm,
Mode mode);
400 void CheckNeedsToInformIncrementalMarker(
401 MacroAssembler* masm,
402 OnNoNeedToInformIncrementalMarker on_no_need,
404 void InformIncrementalMarker(MacroAssembler* masm);
406 Major MajorKey() {
return RecordWrite; }
409 return ObjectBits::encode(object_.
code()) |
410 ValueBits::encode(value_.
code()) |
411 AddressBits::encode(address_.
code()) |
412 RememberedSetActionBits::encode(remembered_set_action_) |
413 SaveFPRegsModeBits::encode(save_fp_regs_mode_);
416 void Activate(Code*
code) {
417 code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
420 class ObjectBits:
public BitField<int, 0, 4> {};
421 class ValueBits:
public BitField<int, 4, 4> {};
422 class AddressBits:
public BitField<int, 8, 4> {};
423 class RememberedSetActionBits:
public BitField<RememberedSetAction, 12, 1> {};
424 class SaveFPRegsModeBits:
public BitField<SaveFPRegsMode, 13, 1> {};
432 RegisterAllocation regs_;
438 #endif // V8_X64_CODE_STUBS_X64_H_
static Mode GetMode(Code *stub)
static void Patch(Code *stub, Mode mode)
static const int kElementsStartIndex
RecordWriteStub(Register object, Register value, Register address, RememberedSetAction remembered_set_action, SaveFPRegsMode fp_mode)
virtual bool SometimesSetsUpAFrame()
static const byte kTwoByteNopInstruction
static int NumAllocatableRegisters()
static void GenerateHashGetHash(MacroAssembler *masm, Register hash)
#define ASSERT(condition)
void Generate(MacroAssembler *masm)
static void GenerateCompareFlatAsciiStrings(MacroAssembler *masm, Register left, Register right, Register scratch1, Register scratch2, Register scratch3, Register scratch4)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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_string(expose_natives_as
static void GenerateCopyCharactersREP(MacroAssembler *masm, Register dest, Register src, Register count, Register scratch, bool ascii)
static void GenerateFlatAsciiStringEquals(MacroAssembler *masm, Register left, Register right, Register scratch1, Register scratch2, Register scratch3)
byte * instruction_start()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static Register FromAllocationIndex(int index)
static const byte kTwoByteJumpInstruction
static const byte kFiveByteNopInstruction
static void GenerateHashAddCharacter(MacroAssembler *masm, Register hash, Register character)
NameDictionaryLookupStub(Register dictionary, Register result, Register index, LookupMode mode)
static void GenerateNegativeLookup(MacroAssembler *masm, Label *miss, Label *done, Register receiver, Register properties, Handle< Name > name, Register scratch0)
static const int kHeaderSize
bool is(Register reg) const
void ArrayNativeCode(MacroAssembler *masm, Label *call_generic_code)
virtual bool SometimesSetsUpAFrame()
static const int kCapacityIndex
static const byte kFiveByteJumpInstruction
virtual bool SometimesSetsUpAFrame()
static void GenerateFixedRegStubsAheadOfTime(Isolate *isolate)
static void GeneratePositiveLookup(MacroAssembler *masm, Label *miss, Label *done, Register elements, Register name, Register r0, Register r1)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
StoreBufferOverflowStub(SaveFPRegsMode save_fp)
static void GenerateHashInit(MacroAssembler *masm, Register hash, Register character)
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)
void Generate(MacroAssembler *masm)