7 #if V8_TARGET_ARCH_IA32
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) {
188 __ CheckMap(scratch, masm->isolate()->factory()->fixed_array_map(),
191 __ AssertFastElements(scratch);
199 __ cmp(scratch, Immediate(masm->isolate()->factory()->the_hole_value()));
203 if (!result.is(scratch)) {
204 __ mov(result, scratch);
211 static void GenerateKeyNameCheck(MacroAssembler* masm, Register key,
212 Register
map, Register hash,
213 Label* index_string, Label* not_unique) {
241 static Operand GenerateMappedArgumentsLookup(
242 MacroAssembler* masm, Register
object, Register key, Register scratch1,
243 Register scratch2, Label* unmapped_case, Label* slow_case) {
244 Heap* heap = masm->isolate()->heap();
245 Factory* factory = masm->isolate()->factory();
250 __ JumpIfSmi(
object, slow_case);
256 __ test(key, Immediate(0x80000001));
260 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
268 __ cmp(key, scratch2);
275 __ cmp(scratch2, factory->the_hole_value());
288 static Operand GenerateUnmappedArgumentsLookup(MacroAssembler* masm,
290 Register parameter_map,
296 Register backing_store = parameter_map;
297 __ mov(backing_store,
FieldOperand(parameter_map, kBackingStoreOffset));
298 Handle<Map> fixed_array_map(masm->isolate()->heap()->fixed_array_map());
301 __ cmp(key, scratch);
310 Label slow, check_name, index_smi, index_name, property_array_property;
311 Label probe_dictionary, check_number_dictionary;
319 __ JumpIfNotSmi(key, &check_name);
324 GenerateKeyedLoadReceiverCheck(masm, receiver,
eax,
328 __ CheckFastElements(
eax, &check_number_dictionary);
330 GenerateFastArrayLoad(masm, receiver, key,
eax,
eax,
NULL, &slow);
331 Isolate*
isolate = masm->isolate();
333 __ IncrementCounter(counters->keyed_load_generic_smi(), 1);
336 __ bind(&check_number_dictionary);
346 Label slow_pop_receiver;
355 __ bind(&slow_pop_receiver);
361 __ IncrementCounter(counters->keyed_load_generic_slow(), 1);
364 __ bind(&check_name);
365 GenerateKeyNameCheck(masm, key,
eax,
ebx, &index_name, &slow);
375 __ j(
equal, &probe_dictionary);
379 if (FLAG_debug_code) {
381 __ Check(
equal, kMapIsNoLongerInEax);
392 Label load_in_object_property;
394 Label hit_on_nth_entry[kEntriesPerBucket];
395 ExternalReference cache_keys =
396 ExternalReference::keyed_lookup_cache_keys(masm->isolate());
398 for (
int i = 0;
i < kEntriesPerBucket - 1;
i++) {
399 Label try_next_entry;
408 __ cmp(key, Operand::StaticArray(
edi,
times_1, cache_keys));
410 __ bind(&try_next_entry);
419 __ cmp(key, Operand::StaticArray(
edi,
times_1, cache_keys));
425 ExternalReference cache_field_offsets =
426 ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
429 for (
int i = kEntriesPerBucket - 1;
i >= 0;
i--) {
430 __ bind(&hit_on_nth_entry[
i]);
432 __ add(
eax, Immediate(
i));
440 __ jmp(&load_in_object_property);
445 __ bind(&load_in_object_property);
449 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
453 __ bind(&property_array_property);
457 __ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
462 __ bind(&probe_dictionary);
466 GenerateGlobalInstanceTypeCheck(masm,
eax, &slow);
468 GenerateDictionaryLoad(masm, &slow,
ebx, key,
eax,
edi,
eax);
469 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
472 __ bind(&index_name);
473 __ IndexFromHash(
ebx, key);
485 Register scratch =
ebx;
486 DCHECK(!scratch.is(receiver) && !scratch.is(index));
487 Register result =
eax;
488 DCHECK(!result.is(scratch));
490 StringCharAtGenerator char_at_generator(receiver, index, scratch, result,
495 char_at_generator.GenerateFast(masm);
498 StubRuntimeCallHelper call_helper;
499 char_at_generator.GenerateSlow(masm, call_helper);
516 Operand mapped_location = GenerateMappedArgumentsLookup(
517 masm, receiver,
name,
ebx,
edi, ¬in, &slow);
518 __ mov(mapped_location, value);
519 __ lea(
ecx, mapped_location);
525 Operand unmapped_location =
526 GenerateUnmappedArgumentsLookup(masm,
name,
ebx,
edi, &slow);
527 __ mov(unmapped_location, value);
528 __ lea(
edi, unmapped_location);
537 static void KeyedStoreGenerateGenericHelper(
538 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow,
540 Label transition_smi_elements;
541 Label finish_object_store, non_double_value, transition_double_elements;
542 Label fast_double_without_map_check;
553 __ bind(fast_object);
556 __ cmp(
edi, masm->isolate()->factory()->fixed_array_map());
563 Label holecheck_passed1;
565 masm->isolate()->factory()->the_hole_value());
567 __ JumpIfDictionaryInPrototypeChain(receiver,
ebx,
edi, slow);
570 __ bind(&holecheck_passed1);
574 __ JumpIfNotSmi(value, &non_smi_value);
584 __ bind(&non_smi_value);
587 __ CheckFastObjectElements(
edi, &transition_smi_elements);
590 __ bind(&finish_object_store);
603 __ bind(fast_double);
607 __ cmp(
edi, masm->isolate()->factory()->fixed_double_array_map());
619 __ JumpIfDictionaryInPrototypeChain(receiver,
ebx,
edi, slow);
622 __ bind(&fast_double_without_map_check);
623 __ StoreNumberToDoubleElements(value,
ebx, key,
edi,
xmm0,
624 &transition_double_elements);
632 __ bind(&transition_smi_elements);
636 __ CheckMap(value, masm->isolate()->factory()->heap_number_map(),
648 __ jmp(&fast_double_without_map_check);
650 __ bind(&non_double_value);
656 masm, receiver, key, value,
ebx,
mode, slow);
658 __ jmp(&finish_object_store);
660 __ bind(&transition_double_elements);
671 __ jmp(&finish_object_store);
678 Label slow, fast_object, fast_object_grow;
679 Label fast_double, fast_double_grow;
680 Label array, extra, check_if_double_array;
687 __ JumpIfSmi(receiver, &slow);
696 __ JumpIfNotSmi(key, &slow);
729 __ cmp(
edi, masm->isolate()->factory()->fixed_array_map());
731 __ jmp(&fast_object_grow);
733 __ bind(&check_if_double_array);
734 __ cmp(
edi, masm->isolate()->factory()->fixed_double_array_map());
736 __ jmp(&fast_double_grow);
752 KeyedStoreGenerateGenericHelper(masm, &fast_object, &fast_double, &slow,
754 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
760 Register dictionary =
eax;
768 GenerateDictionaryLoad(masm, &slow, dictionary,
778 static void LoadIC_PushArgs(MacroAssembler* masm) {
792 __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
794 LoadIC_PushArgs(masm);
797 ExternalReference ref =
798 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
799 __ TailCallExternalReference(ref, 2, 1);
805 LoadIC_PushArgs(masm);
808 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
814 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
816 LoadIC_PushArgs(masm);
819 ExternalReference ref =
820 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
821 __ TailCallExternalReference(ref, 2, 1);
827 LoadIC_PushArgs(masm);
830 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
838 masm->isolate()->stub_cache()->GenerateProbe(
847 static void StoreIC_PushArgs(MacroAssembler* masm) {
864 StoreIC_PushArgs(masm);
867 ExternalReference ref =
868 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
869 __ TailCallExternalReference(ref, 3, 1);
878 Register dictionary =
ebx;
886 GenerateDictionaryStore(masm, &restore_miss, dictionary,
name, value,
889 Counters* counters = masm->isolate()->counters();
890 __ IncrementCounter(counters->store_normal_hit(), 1);
893 __ bind(&restore_miss);
895 __ IncrementCounter(counters->store_normal_miss(), 1);
902 StoreIC_PushArgs(masm);
905 ExternalReference ref =
906 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
907 __ TailCallExternalReference(ref, 3, 1);
916 case Token::EQ_STRICT:
936 Address test_instruction_address =
947 Address test_instruction_address =
957 Address delta_address = test_instruction_address + 1;
960 uint8_t delta = *
reinterpret_cast<uint8_t*
>(delta_address);
962 PrintF(
"[ patching ic at %p, test=%p, delta=%d\n", address,
963 test_instruction_address, delta);
969 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