21 #define __ ACCESS_MASM(masm)
24 static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm, Register type,
25 Label* global_object) {
44 static void GenerateDictionaryLoad(MacroAssembler* masm, Label* miss_label,
45 Register elements, Register
name,
46 Register
r0, Register
r1, Register result) {
71 const int kElementsStartOffset =
74 const int kDetailsOffset = kElementsStartOffset + 2 *
kPointerSize;
76 Immediate(PropertyDetails::TypeField::kMask <<
kSmiTagSize));
80 const int kValueOffset = kElementsStartOffset +
kPointerSize;
92 static void GenerateDictionaryStore(MacroAssembler* masm, Label* miss_label,
93 Register elements, Register
name,
94 Register value, Register
r0, Register
r1) {
117 const int kElementsStartOffset =
120 const int kDetailsOffset = kElementsStartOffset + 2 *
kPointerSize;
121 const int kTypeAndReadOnlyMask =
122 (PropertyDetails::TypeField::kMask |
123 PropertyDetails::AttributesField::encode(
READ_ONLY))
126 Immediate(kTypeAndReadOnlyMask));
130 const int kValueOffset = kElementsStartOffset +
kPointerSize;
132 __ mov(Operand(
r0, 0), value);
142 static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm,
143 Register receiver, Register
map,
144 int interceptor_bit, Label* slow) {
151 __ JumpIfSmi(receiver, slow);
173 static void GenerateFastArrayLoad(MacroAssembler* masm, Register receiver,
174 Register key, Register scratch,
175 Register result, Label* not_fast_array,
176 Label* out_of_range) {
186 if (not_fast_array !=
NULL) {
189 masm->isolate()->factory()->fixed_array_map(),
193 __ AssertFastElements(scratch);
201 __ cmp(scratch, Immediate(masm->isolate()->factory()->the_hole_value()));
205 if (!result.is(scratch)) {
206 __ mov(result, scratch);
213 static void GenerateKeyNameCheck(MacroAssembler* masm, Register key,
214 Register
map, Register hash,
215 Label* index_string, Label* not_unique) {
243 static Operand GenerateMappedArgumentsLookup(
244 MacroAssembler* masm, Register
object, Register key, Register scratch1,
245 Register scratch2, Label* unmapped_case, Label* slow_case) {
246 Heap* heap = masm->isolate()->heap();
247 Factory* factory = masm->isolate()->factory();
252 __ JumpIfSmi(
object, slow_case);
258 __ test(key, Immediate(0x80000001));
262 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
270 __ cmp(key, scratch2);
277 __ cmp(scratch2, factory->the_hole_value());
290 static Operand GenerateUnmappedArgumentsLookup(MacroAssembler* masm,
292 Register parameter_map,
298 Register backing_store = parameter_map;
299 __ mov(backing_store,
FieldOperand(parameter_map, kBackingStoreOffset));
300 Handle<Map> fixed_array_map(masm->isolate()->heap()->fixed_array_map());
303 __ cmp(key, scratch);
312 Label slow, check_name, index_smi, index_name, property_array_property;
313 Label probe_dictionary, check_number_dictionary;
321 __ JumpIfNotSmi(key, &check_name);
326 GenerateKeyedLoadReceiverCheck(masm, receiver,
eax,
330 __ CheckFastElements(
eax, &check_number_dictionary);
332 GenerateFastArrayLoad(masm, receiver, key,
eax,
eax,
NULL, &slow);
333 Isolate*
isolate = masm->isolate();
335 __ IncrementCounter(counters->keyed_load_generic_smi(), 1);
338 __ bind(&check_number_dictionary);
348 Label slow_pop_receiver;
357 __ bind(&slow_pop_receiver);
363 __ IncrementCounter(counters->keyed_load_generic_slow(), 1);
366 __ bind(&check_name);
367 GenerateKeyNameCheck(masm, key,
eax,
ebx, &index_name, &slow);
377 __ j(
equal, &probe_dictionary);
381 if (FLAG_debug_code) {
383 __ Check(
equal, kMapIsNoLongerInEax);
394 Label load_in_object_property;
396 Label hit_on_nth_entry[kEntriesPerBucket];
397 ExternalReference cache_keys =
398 ExternalReference::keyed_lookup_cache_keys(masm->isolate());
400 for (
int i = 0;
i < kEntriesPerBucket - 1;
i++) {
401 Label try_next_entry;
410 __ cmp(key, Operand::StaticArray(
edi,
times_1, cache_keys));
412 __ bind(&try_next_entry);
421 __ cmp(key, Operand::StaticArray(
edi,
times_1, cache_keys));
427 ExternalReference cache_field_offsets =
428 ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
431 for (
int i = kEntriesPerBucket - 1;
i >= 0;
i--) {
432 __ bind(&hit_on_nth_entry[
i]);
434 __ add(
eax, Immediate(
i));
442 __ jmp(&load_in_object_property);
447 __ bind(&load_in_object_property);
451 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
455 __ bind(&property_array_property);
459 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
464 __ bind(&probe_dictionary);
468 GenerateGlobalInstanceTypeCheck(masm,
eax, &slow);
470 GenerateDictionaryLoad(masm, &slow,
ebx, key,
eax,
edi,
eax);
471 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
474 __ bind(&index_name);
475 __ IndexFromHash(
ebx, key);
487 Register scratch =
ebx;
488 DCHECK(!scratch.is(receiver) && !scratch.is(index));
489 Register result =
eax;
490 DCHECK(!result.is(scratch));
492 StringCharAtGenerator char_at_generator(receiver, index, scratch, result,
497 char_at_generator.GenerateFast(masm);
500 StubRuntimeCallHelper call_helper;
501 char_at_generator.GenerateSlow(masm, call_helper);
518 Operand mapped_location = GenerateMappedArgumentsLookup(
519 masm, receiver,
name,
ebx,
edi, ¬in, &slow);
520 __ mov(mapped_location, value);
521 __ lea(
ecx, mapped_location);
527 Operand unmapped_location =
528 GenerateUnmappedArgumentsLookup(masm,
name,
ebx,
edi, &slow);
529 __ mov(unmapped_location, value);
530 __ lea(
edi, unmapped_location);
539 static void KeyedStoreGenerateGenericHelper(
540 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
542 Label transition_smi_elements;
543 Label finish_object_store, non_double_value, transition_double_elements;
544 Label fast_double_without_map_check;
555 __ bind(fast_object);
558 __ cmp(
edi, masm->isolate()->factory()->fixed_array_map());
565 Label holecheck_passed1;
567 masm->isolate()->factory()->the_hole_value());
569 __ JumpIfDictionaryInPrototypeChain(receiver,
ebx,
edi, slow);
572 __ bind(&holecheck_passed1);
576 __ JumpIfNotSmi(value, &non_smi_value);
586 __ bind(&non_smi_value);
589 __ CheckFastObjectElements(
edi, &transition_smi_elements);
592 __ bind(&finish_object_store);
605 __ bind(fast_double);
609 __ cmp(
edi, masm->isolate()->factory()->fixed_double_array_map());
621 __ JumpIfDictionaryInPrototypeChain(receiver,
ebx,
edi, slow);
624 __ bind(&fast_double_without_map_check);
625 __ StoreNumberToDoubleElements(value,
ebx, key,
edi,
626 &transition_double_elements,
false);
634 __ bind(&transition_smi_elements);
638 __ CheckMap(value, masm->isolate()->factory()->heap_number_map(),
650 __ jmp(&fast_double_without_map_check);
652 __ bind(&non_double_value);
658 masm, receiver, key, value,
ebx,
mode, slow);
660 __ jmp(&finish_object_store);
662 __ bind(&transition_double_elements);
673 __ jmp(&finish_object_store);
680 Label slow, fast_object, fast_object_grow;
681 Label fast_double, fast_double_grow;
682 Label array, extra, check_if_double_array;
689 __ JumpIfSmi(receiver, &slow);
698 __ JumpIfNotSmi(key, &slow);
731 __ cmp(
edi, masm->isolate()->factory()->fixed_array_map());
733 __ jmp(&fast_object_grow);
735 __ bind(&check_if_double_array);
736 __ cmp(
edi, masm->isolate()->factory()->fixed_double_array_map());
738 __ jmp(&fast_double_grow);
754 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow,
756 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
762 Register dictionary =
eax;
770 GenerateDictionaryLoad(masm, &slow, dictionary,
780 static void LoadIC_PushArgs(MacroAssembler* masm) {
794 __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
796 LoadIC_PushArgs(masm);
799 ExternalReference ref =
800 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
801 __ TailCallExternalReference(ref, 2, 1);
807 LoadIC_PushArgs(masm);
810 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
816 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
818 LoadIC_PushArgs(masm);
821 ExternalReference ref =
822 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
823 __ TailCallExternalReference(ref, 2, 1);
829 LoadIC_PushArgs(masm);
832 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
840 masm->isolate()->stub_cache()->GenerateProbe(
849 static void StoreIC_PushArgs(MacroAssembler* masm) {
866 StoreIC_PushArgs(masm);
869 ExternalReference ref =
870 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
871 __ TailCallExternalReference(ref, 3, 1);
880 Register dictionary =
ebx;
888 GenerateDictionaryStore(masm, &restore_miss, dictionary,
name, value,
891 Counters* counters = masm->isolate()->counters();
892 __ IncrementCounter(counters->store_normal_hit(), 1);
895 __ bind(&restore_miss);
897 __ IncrementCounter(counters->store_normal_miss(), 1);
904 StoreIC_PushArgs(masm);
907 ExternalReference ref =
908 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
909 __ TailCallExternalReference(ref, 3, 1);
918 case Token::EQ_STRICT:
938 Address test_instruction_address =
949 Address test_instruction_address =
959 Address delta_address = test_instruction_address + 1;
962 uint8_t delta = *
reinterpret_cast<uint8_t*
>(delta_address);
964 PrintF(
"[ patching ic at %p, test=%p, delta=%d\n", address,
965 test_instruction_address, delta);
971 Address jmp_address = test_instruction_address - delta;
static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind)
static const byte kJnzShortOpcode
static const byte kNopByte
static const byte kJccShortPrefix
static const byte kJncShortOpcode
static const byte kTestAlByte
static const int kCallTargetAddressOffset
static const byte kJcShortOpcode
static const byte kJzShortOpcode
static Flags ComputeHandlerFlags(Kind handler_kind, StubType type=NORMAL, CacheHolderFlag holder=kCacheOnReceiver)
static Flags RemoveTypeAndHolderFromFlags(Flags flags)
static bool HasInlinedSmiCode(Address address)
static Condition ComputeCondition(Token::Value op)
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 kLengthOffset
static const int kHeaderSize
static const int kElementsStartIndex
static const int kMapOffset
Isolate * isolate() const
static const int kLengthOffset
static const int kPropertiesOffset
static const int kElementsOffset
static void GenerateMiss(MacroAssembler *masm)
static void GenerateString(MacroAssembler *masm)
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
static void GenerateGeneric(MacroAssembler *masm)
static const int kHashMask
static const int kCapacityMask
static const int kMapHashShift
static const int kEntriesPerBucket
static void GenerateMiss(MacroAssembler *masm)
static void GenerateSloppyArguments(MacroAssembler *masm)
static void GenerateGeneric(MacroAssembler *masm, StrictMode strict_mode)
static const Register ReceiverRegister()
static const Register NameRegister()
static void GenerateNormal(MacroAssembler *masm)
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm)
static const int kHasIndexedInterceptor
static const int kBitFieldOffset
static const int kIsAccessCheckNeeded
static const int kInstanceTypeOffset
static const int kInstanceSizeOffset
static const int kInObjectPropertiesOffset
static const int kIsObserved
static const int kHasNamedInterceptor
static void GeneratePositiveLookup(MacroAssembler *masm, Label *miss, Label *done, Register elements, Register name, Register r0, Register r1)
static const int kHashShift
static const int kHashFieldOffset
static const unsigned int kContainsCachedArrayIndexMask
static void GenerateRuntimeSetProperty(MacroAssembler *masm, StrictMode strict_mode)
static Smi * FromInt(int value)
static const Register ReceiverRegister()
static const Register NameRegister()
static const Register ValueRegister()
static void GenerateMiss(MacroAssembler *masm)
static void GenerateMegamorphic(MacroAssembler *masm)
StrictMode strict_mode() const
static void GenerateNormal(MacroAssembler *masm)
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 map
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
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)
@ ENABLE_INLINED_SMI_CHECK
Operand FieldOperand(Register object, int offset)
const uint32_t kNotInternalizedTag
const int kPointerSizeLog2
@ JS_BUILTINS_OBJECT_TYPE
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check)
@ times_half_pointer_size
void PrintF(const char *format,...)
Operand FixedArrayElementOperand(Register array, Register index_as_smi, int additional_offset=0)
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
const uint32_t kIsNotInternalizedMask
const uint32_t kHoleNanLower32
@ STRING_INDEX_IS_ARRAY_INDEX
const uint32_t kHoleNanUpper32
KeyedStoreIncrementLength
Debugger support for the V8 JavaScript engine.
bool is(Register reg) const