30 #if defined(V8_TARGET_ARCH_X64)
39 #define __ ACCESS_MASM(masm)
42 static void ProbeTable(Isolate* isolate,
59 ExternalReference key_offset(isolate->stub_cache()->key_reference(table));
60 ExternalReference value_offset(isolate->stub_cache()->value_reference(table));
64 __ lea(offset, Operand(offset, offset,
times_2, 0));
90 __ cmpl(offset, Immediate(flags));
114 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
121 Counters* counters = masm->isolate()->counters();
122 __ IncrementCounter(counters->negative_lookups(), 1);
123 __ IncrementCounter(counters->negative_lookups_miss(), 1);
127 const int kInterceptorOrAccessCheckNeededMask =
132 Immediate(kInterceptorOrAccessCheckNeededMask));
140 Register properties =
r0;
145 Heap::kHashTableMapRootIndex);
156 __ DecrementCounter(counters->negative_lookups_miss(), 1);
168 Isolate* isolate = masm->isolate();
175 ASSERT(
sizeof(Entry) == 24);
181 ASSERT(!scratch.is(receiver));
182 ASSERT(!scratch.is(name));
189 Counters* counters = masm->isolate()->counters();
190 __ IncrementCounter(counters->megamorphic_stub_cache_probes(), 1);
193 __ JumpIfSmi(receiver, &miss);
199 __ xor_(scratch, Immediate(flags));
205 ProbeTable(isolate, masm, flags,
kPrimary, receiver, name, scratch);
210 __ xor_(scratch, Immediate(flags));
212 __ subl(scratch, name);
213 __ addl(scratch, Immediate(flags));
217 ProbeTable(isolate, masm, flags,
kSecondary, receiver, name, scratch);
222 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1);
226 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
228 Register prototype) {
245 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
246 MacroAssembler* masm,
250 Isolate* isolate = masm->isolate();
252 __ Move(prototype, isolate->global());
257 Handle<JSFunction>
function(
260 __ Move(prototype, Handle<Map>(function->initial_map()));
266 void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
271 __ JumpIfSmi(receiver, miss_label);
285 static void GenerateStringCheck(MacroAssembler* masm,
289 Label* non_string_object) {
291 __ JumpIfSmi(receiver, smi);
302 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
307 bool support_wrappers) {
312 GenerateStringCheck(masm, receiver, scratch1, miss,
313 support_wrappers ? &check_wrapper : miss);
319 if (support_wrappers) {
321 __ bind(&check_wrapper);
328 GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
335 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
340 __ TryGetFunctionPrototype(receiver, result, miss_label);
341 if (!result.is(
rax))
__ movq(
rax, result);
349 void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
352 Handle<JSObject> holder,
355 index -= holder->map()->inobject_properties();
358 int offset = holder->map()->instance_size() + (index *
kPointerSize);
369 static void PushInterceptorArguments(MacroAssembler* masm,
373 Handle<JSObject> holder_obj) {
375 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor());
376 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor));
382 __ PushAddress(ExternalReference::isolate_address());
386 static void CompileCallLoadPropertyWithInterceptor(
387 MacroAssembler* masm,
391 Handle<JSObject> holder_obj) {
392 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
394 ExternalReference ref =
395 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
398 __ LoadAddress(
rbx, ref);
406 static const int kFastApiCallArguments = 4;
413 static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
418 __ movq(scratch, Operand(
rsp, 0));
420 __ movq(Operand(
rsp, 0), scratch);
422 for (
int i = 1; i <= kFastApiCallArguments; i++) {
429 static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
438 __ movq(scratch, Operand(
rsp, 0));
445 static void GenerateFastApiCall(MacroAssembler* masm,
446 const CallOptimization& optimization,
463 Handle<JSFunction>
function = optimization.constant_function();
464 __ LoadHeapObject(
rdi,
function);
469 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
470 Handle<Object> call_data(api_call_info->data());
471 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
472 __ Move(
rcx, api_call_info);
484 #if defined(__MINGW64__)
485 Register arguments_arg =
rcx;
486 #elif defined(_WIN64)
488 Register arguments_arg =
rdx;
490 Register arguments_arg =
rdi;
495 const int kApiStackSpace = 4;
497 __ PrepareCallApiFunction(kApiStackSpace);
510 Address function_address = v8::ToCData<Address>(api_call_info->callback());
511 __ CallApiFunctionAndReturn(function_address,
512 argc + kFastApiCallArguments + 1);
518 CallInterceptorCompiler(StubCompiler* stub_compiler,
519 const ParameterCount& arguments,
522 : stub_compiler_(stub_compiler),
523 arguments_(arguments),
525 extra_ic_state_(extra_ic_state) {}
527 void Compile(MacroAssembler* masm,
528 Handle<JSObject>
object,
529 Handle<JSObject> holder,
531 LookupResult* lookup,
537 ASSERT(holder->HasNamedInterceptor());
538 ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
541 __ JumpIfSmi(receiver, miss);
543 CallOptimization optimization(lookup);
544 if (optimization.is_constant_call()) {
545 CompileCacheable(masm,
object, receiver, scratch1, scratch2, scratch3,
546 holder, lookup, name, optimization, miss);
548 CompileRegular(masm,
object, receiver, scratch1, scratch2, scratch3,
554 void CompileCacheable(MacroAssembler* masm,
555 Handle<JSObject>
object,
560 Handle<JSObject> interceptor_holder,
561 LookupResult* lookup,
563 const CallOptimization& optimization,
565 ASSERT(optimization.is_constant_call());
566 ASSERT(!lookup->holder()->IsGlobalObject());
570 bool can_do_fast_api_call =
false;
571 if (optimization.is_simple_api_call() &&
572 !lookup->holder()->IsGlobalObject()) {
573 depth1 = optimization.GetPrototypeDepthOfExpectedType(
574 object, interceptor_holder);
576 depth2 = optimization.GetPrototypeDepthOfExpectedType(
577 interceptor_holder, Handle<JSObject>(lookup->holder()));
579 can_do_fast_api_call =
583 Counters* counters = masm->isolate()->counters();
584 __ IncrementCounter(counters->call_const_interceptor(), 1);
586 if (can_do_fast_api_call) {
587 __ IncrementCounter(counters->call_const_interceptor_fast_api(), 1);
588 ReserveSpaceForFastApiCall(masm, scratch1);
594 Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
596 stub_compiler_->CheckPrototypes(
object, receiver, interceptor_holder,
597 scratch1, scratch2, scratch3,
602 Label regular_invoke;
603 LoadWithInterceptor(masm, receiver, holder, interceptor_holder,
611 if (*interceptor_holder != lookup->holder()) {
612 stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
613 Handle<JSObject>(lookup->holder()),
614 scratch1, scratch2, scratch3,
625 if (can_do_fast_api_call) {
626 GenerateFastApiCall(masm, optimization, arguments_.immediate());
631 __ InvokeFunction(optimization.constant_function(), arguments_,
636 if (can_do_fast_api_call) {
637 __ bind(&miss_cleanup);
638 FreeSpaceForFastApiCall(masm, scratch1);
643 __ bind(®ular_invoke);
644 if (can_do_fast_api_call) {
645 FreeSpaceForFastApiCall(masm, scratch1);
649 void CompileRegular(MacroAssembler* masm,
650 Handle<JSObject>
object,
656 Handle<JSObject> interceptor_holder,
659 stub_compiler_->CheckPrototypes(
object, receiver, interceptor_holder,
660 scratch1, scratch2, scratch3,
667 PushInterceptorArguments(masm, receiver, holder,
name_, interceptor_holder);
669 __ CallExternalReference(
670 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
680 void LoadWithInterceptor(MacroAssembler* masm,
683 Handle<JSObject> holder_obj,
684 Label* interceptor_succeeded) {
690 CompileCallLoadPropertyWithInterceptor(masm,
701 __ CompareRoot(
rax, Heap::kNoInterceptorResultSentinelRootIndex);
705 StubCompiler* stub_compiler_;
706 const ParameterCount& arguments_;
712 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm,
Code::Kind kind) {
715 ? masm->isolate()->builtins()->LoadIC_Miss()
716 : masm->isolate()->builtins()->KeyedLoadIC_Miss();
717 __ Jump(code, RelocInfo::CODE_TARGET);
721 void StubCompiler::GenerateKeyedLoadMissForceGeneric(MacroAssembler* masm) {
723 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
724 __ Jump(code, RelocInfo::CODE_TARGET);
730 void StubCompiler::GenerateStoreField(MacroAssembler* masm,
731 Handle<JSObject>
object,
733 Handle<Map> transition,
735 Register receiver_reg,
740 LookupResult lookup(masm->isolate());
741 object->Lookup(*name, &lookup);
742 if (lookup.IsFound() && (lookup.IsReadOnly() || !lookup.IsCacheable())) {
753 __ CheckMap(receiver_reg, Handle<Map>(object->map()),
757 if (object->IsJSGlobalProxy()) {
758 __ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label);
762 if (!transition.is_null() &&
object->GetPrototype()->IsJSObject()) {
764 if (lookup.IsFound()) {
765 holder = lookup.holder();
771 }
while (holder->GetPrototype()->IsJSObject());
775 Label miss_pop, done_check;
776 CheckPrototypes(
object, receiver_reg, Handle<JSObject>(holder), name_reg,
777 scratch1, scratch2, name, &miss_pop);
782 __ bind(&done_check);
788 ASSERT(object->IsJSGlobalProxy() || !
object->IsAccessCheckNeeded());
791 if (!transition.is_null() && (
object->map()->unused_property_fields() == 0)) {
795 __ push(receiver_reg);
799 __ TailCallExternalReference(
800 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage),
807 if (!transition.is_null()) {
809 __ Move(scratch1, transition);
814 __ RecordWriteField(receiver_reg,
826 index -=
object->map()->inobject_properties();
830 int offset =
object->map()->instance_size() + (index *
kPointerSize);
835 __ movq(name_reg,
rax);
847 __ movq(name_reg,
rax);
860 static void GenerateCheckPropertyCell(MacroAssembler* masm,
861 Handle<GlobalObject> global,
865 Handle<JSGlobalPropertyCell> cell =
867 ASSERT(cell->value()->IsTheHole());
868 __ Move(scratch, cell);
870 masm->isolate()->factory()->the_hole_value());
877 static void GenerateCheckPropertyCells(MacroAssembler* masm,
878 Handle<JSObject>
object,
879 Handle<JSObject> holder,
883 Handle<JSObject> current = object;
884 while (!current.is_identical_to(holder)) {
885 if (current->IsGlobalObject()) {
886 GenerateCheckPropertyCell(masm,
887 Handle<GlobalObject>::cast(current),
892 current = Handle<JSObject>(
JSObject::cast(current->GetPrototype()));
897 #define __ ACCESS_MASM((masm()))
900 Register StubCompiler::CheckPrototypes(Handle<JSObject>
object,
902 Handle<JSObject> holder,
910 ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
911 ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
912 && !scratch2.is(scratch1));
917 Register reg = object_reg;
920 if (save_at_depth == depth) {
926 Handle<JSObject> current = object;
927 while (!current.is_identical_to(holder)) {
932 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
934 Handle<JSObject> prototype(
JSObject::cast(current->GetPrototype()));
935 if (!current->HasFastProperties() &&
936 !current->IsJSGlobalObject() &&
937 !current->IsJSGlobalProxy()) {
938 if (!name->IsSymbol()) {
939 name = factory()->LookupSymbol(name);
941 ASSERT(current->property_dictionary()->FindEntry(*name) ==
944 GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
951 bool in_new_space = heap()->InNewSpace(*prototype);
952 Handle<Map> current_map(current->map());
957 __ CheckMap(reg, Handle<Map>(current_map),
963 if (current->IsJSGlobalProxy()) {
964 __ CheckAccessGlobalProxy(reg, scratch2, miss);
974 __ Move(reg, prototype);
978 if (save_at_depth == depth) {
985 ASSERT(current.is_identical_to(holder));
988 LOG(isolate(), IntEvent(
"check-maps-depth", depth + 1));
991 __ CheckMap(reg, Handle<Map>(holder->map()),
995 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
996 if (current->IsJSGlobalProxy()) {
997 __ CheckAccessGlobalProxy(reg, scratch1, miss);
1003 GenerateCheckPropertyCells(masm(),
object, holder, name, scratch1, miss);
1010 void StubCompiler::GenerateLoadField(Handle<JSObject>
object,
1011 Handle<JSObject> holder,
1017 Handle<String> name,
1020 __ JumpIfSmi(receiver, miss);
1023 Register reg = CheckPrototypes(
1024 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1027 GenerateFastPropertyLoad(masm(),
rax, reg, holder, index);
1032 void StubCompiler::GenerateLoadCallback(Handle<JSObject>
object,
1033 Handle<JSObject> holder,
1039 Handle<AccessorInfo> callback,
1040 Handle<String> name,
1043 __ JumpIfSmi(receiver, miss);
1046 Register reg = CheckPrototypes(
object, receiver, holder, scratch1,
1047 scratch2, scratch3, name, miss);
1050 ASSERT(!scratch2.is(reg));
1055 if (heap()->InNewSpace(callback->data())) {
1056 __ Move(scratch1, callback);
1059 __ Push(Handle<Object>(callback->data()));
1061 __ PushAddress(ExternalReference::isolate_address());
1066 #if defined(__MINGW64__)
1067 Register accessor_info_arg =
rdx;
1068 Register name_arg =
rcx;
1069 #elif defined(_WIN64)
1071 Register accessor_info_arg =
r8;
1072 Register name_arg =
rdx;
1074 Register accessor_info_arg =
rsi;
1075 Register name_arg =
rdi;
1078 ASSERT(!name_arg.is(scratch2));
1079 __ movq(name_arg,
rsp);
1083 const int kStackSpace = 5;
1086 const int kArgStackSpace = 1;
1088 __ PrepareCallApiFunction(kArgStackSpace);
1098 Address getter_address = v8::ToCData<Address>(callback->getter());
1099 __ CallApiFunctionAndReturn(getter_address, kStackSpace);
1103 void StubCompiler::GenerateLoadConstant(Handle<JSObject>
object,
1104 Handle<JSObject> holder,
1109 Handle<JSFunction> value,
1110 Handle<String> name,
1113 __ JumpIfSmi(receiver, miss);
1117 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1120 __ LoadHeapObject(
rax, value);
1125 void StubCompiler::GenerateLoadInterceptor(Handle<JSObject>
object,
1126 Handle<JSObject> interceptor_holder,
1127 LookupResult* lookup,
1133 Handle<String> name,
1135 ASSERT(interceptor_holder->HasNamedInterceptor());
1136 ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
1139 __ JumpIfSmi(receiver, miss);
1144 bool compile_followup_inline =
false;
1145 if (lookup->IsFound() && lookup->IsCacheable()) {
1146 if (lookup->type() ==
FIELD) {
1147 compile_followup_inline =
true;
1148 }
else if (lookup->type() ==
CALLBACKS &&
1149 lookup->GetCallbackObject()->IsAccessorInfo()) {
1151 compile_followup_inline = callback->getter() !=
NULL &&
1152 callback->IsCompatibleReceiver(*
object);
1156 if (compile_followup_inline) {
1160 Register holder_reg = CheckPrototypes(
object, receiver, interceptor_holder,
1161 scratch1, scratch2, scratch3,
1163 ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1));
1169 bool must_perfrom_prototype_check = *interceptor_holder != lookup->holder();
1170 bool must_preserve_receiver_reg = !receiver.is(holder_reg) &&
1171 (lookup->type() ==
CALLBACKS || must_perfrom_prototype_check);
1178 if (must_preserve_receiver_reg) {
1181 __ push(holder_reg);
1187 CompileCallLoadPropertyWithInterceptor(masm(),
1191 interceptor_holder);
1195 Label interceptor_failed;
1196 __ CompareRoot(
rax, Heap::kNoInterceptorResultSentinelRootIndex);
1197 __ j(
equal, &interceptor_failed);
1198 frame_scope.GenerateLeaveFrame();
1201 __ bind(&interceptor_failed);
1204 if (must_preserve_receiver_reg) {
1213 if (must_perfrom_prototype_check) {
1214 holder_reg = CheckPrototypes(interceptor_holder,
1216 Handle<JSObject>(lookup->holder()),
1224 if (lookup->type() ==
FIELD) {
1227 GenerateFastPropertyLoad(masm(),
rax, holder_reg,
1228 Handle<JSObject>(lookup->holder()),
1229 lookup->GetFieldIndex());
1235 Handle<AccessorInfo> callback(
1244 __ push(holder_reg);
1245 __ Move(holder_reg, callback);
1247 __ PushAddress(ExternalReference::isolate_address());
1248 __ push(holder_reg);
1252 ExternalReference ref =
1253 ExternalReference(IC_Utility(IC::kLoadCallbackProperty),
1255 __ TailCallExternalReference(ref, 6, 1);
1260 Register holder_reg = CheckPrototypes(
object, receiver, interceptor_holder,
1261 scratch1, scratch2, scratch3,
1264 PushInterceptorArguments(masm(), receiver, holder_reg,
1265 name_reg, interceptor_holder);
1268 ExternalReference ref = ExternalReference(
1269 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate());
1270 __ TailCallExternalReference(ref, 6, 1);
1275 void CallStubCompiler::GenerateNameCheck(Handle<String> name, Label* miss) {
1283 void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject>
object,
1284 Handle<JSObject> holder,
1285 Handle<String> name,
1287 ASSERT(holder->IsGlobalObject());
1290 const int argc = arguments().immediate();
1297 __ JumpIfSmi(
rdx, miss);
1298 CheckPrototypes(
object,
rdx, holder,
rbx,
rax,
rdi, name, miss);
1302 void CallStubCompiler::GenerateLoadFunctionFromCell(
1303 Handle<JSGlobalPropertyCell> cell,
1304 Handle<JSFunction>
function,
1311 if (heap()->InNewSpace(*
function)) {
1317 __ JumpIfSmi(
rdi, miss);
1322 __ Move(
rax, Handle<SharedFunctionInfo>(function->shared()));
1325 __ Cmp(
rdi,
function);
1331 void CallStubCompiler::GenerateMissBranch() {
1333 isolate()->stub_cache()->ComputeCallMiss(arguments().immediate(),
1336 __ Jump(code, RelocInfo::CODE_TARGET);
1341 Handle<JSObject> holder,
1343 Handle<String> name) {
1355 GenerateNameCheck(name, &miss);
1358 const int argc = arguments().immediate();
1362 __ JumpIfSmi(
rdx, &miss);
1365 Register reg = CheckPrototypes(
object,
rdx, holder,
rbx,
rax,
rdi,
1368 GenerateFastPropertyLoad(masm(),
rdi, reg, holder, index);
1371 __ JumpIfSmi(
rdi, &miss);
1377 if (object->IsGlobalObject()) {
1387 NullCallWrapper(), call_kind);
1391 GenerateMissBranch();
1394 return GetCode(
FIELD, name);
1398 Handle<Code> CallStubCompiler::CompileArrayPushCall(
1399 Handle<Object>
object,
1400 Handle<JSObject> holder,
1401 Handle<JSGlobalPropertyCell> cell,
1402 Handle<JSFunction>
function,
1403 Handle<String> name) {
1413 if (!object->IsJSArray() || !cell.is_null())
return Handle<Code>::null();
1416 GenerateNameCheck(name, &miss);
1419 const int argc = arguments().immediate();
1423 __ JumpIfSmi(
rdx, &miss);
1425 CheckPrototypes(Handle<JSObject>::cast(
object),
rdx, holder,
rbx,
rax,
rdi,
1436 Label attempt_to_grow_elements, with_write_barrier;
1443 factory()->fixed_array_map());
1449 __ addl(
rax, Immediate(argc));
1456 __ j(
greater, &attempt_to_grow_elements);
1460 __ JumpIfNotSmi(
rcx, &with_write_barrier);
1475 __ bind(&with_write_barrier);
1479 if (FLAG_smi_only_arrays && !FLAG_trace_elements_transitions) {
1480 Label fast_object, not_fast_object;
1481 __ CheckFastObjectElements(
rbx, ¬_fast_object, Label::kNear);
1482 __ jmp(&fast_object);
1484 __ bind(¬_fast_object);
1485 __ CheckFastSmiElements(
rbx, &call_builtin);
1489 Label try_holey_map;
1500 __ jmp(&fast_object);
1502 __ bind(&try_holey_map);
1511 __ bind(&fast_object);
1513 __ CheckFastObjectElements(
rbx, &call_builtin);
1531 __ bind(&attempt_to_grow_elements);
1532 if (!FLAG_inline_new) {
1533 __ jmp(&call_builtin);
1539 Label no_fast_elements_check;
1540 __ JumpIfSmi(
rbx, &no_fast_elements_check);
1542 __ CheckFastObjectElements(
rcx, &call_builtin, Label::kFar);
1543 __ bind(&no_fast_elements_check);
1545 ExternalReference new_space_allocation_top =
1546 ExternalReference::new_space_allocation_top_address(isolate());
1547 ExternalReference new_space_allocation_limit =
1548 ExternalReference::new_space_allocation_limit_address(isolate());
1550 const int kAllocationDelta = 4;
1561 Operand limit_operand =
1562 masm()->ExternalOperand(new_space_allocation_limit);
1563 __ cmpq(
rcx, limit_operand);
1567 __ Store(new_space_allocation_top,
rcx);
1573 for (
int i = 1; i < kAllocationDelta; i++) {
1598 __ bind(&call_builtin);
1599 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush,
1606 GenerateMissBranch();
1609 return GetCode(
function);
1613 Handle<Code> CallStubCompiler::CompileArrayPopCall(
1614 Handle<Object>
object,
1615 Handle<JSObject> holder,
1616 Handle<JSGlobalPropertyCell> cell,
1617 Handle<JSFunction>
function,
1618 Handle<String> name) {
1628 if (!object->IsJSArray() || !cell.is_null())
return Handle<Code>::null();
1630 Label miss, return_undefined, call_builtin;
1631 GenerateNameCheck(name, &miss);
1634 const int argc = arguments().immediate();
1638 __ JumpIfSmi(
rdx, &miss);
1640 CheckPrototypes(Handle<JSObject>::cast(
object),
rdx, holder,
rbx,
rax,
rdi,
1648 Heap::kFixedArrayMapRootIndex);
1653 __ subl(
rcx, Immediate(1));
1657 __ LoadRoot(
r9, Heap::kTheHoleValueRootIndex);
1660 FixedArray::kHeaderSize));
1672 FixedArray::kHeaderSize),
1676 __ bind(&return_undefined);
1677 __ LoadRoot(
rax, Heap::kUndefinedValueRootIndex);
1680 __ bind(&call_builtin);
1681 __ TailCallExternalReference(
1682 ExternalReference(Builtins::c_ArrayPop, isolate()),
1687 GenerateMissBranch();
1690 return GetCode(
function);
1694 Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
1695 Handle<Object>
object,
1696 Handle<JSObject> holder,
1697 Handle<JSGlobalPropertyCell> cell,
1698 Handle<JSFunction>
function,
1699 Handle<String> name) {
1709 if (!object->IsString() || !cell.is_null())
return Handle<Code>::null();
1711 const int argc = arguments().immediate();
1715 Label index_out_of_range;
1716 Label* index_out_of_range_label = &index_out_of_range;
1720 index_out_of_range_label = &miss;
1722 GenerateNameCheck(name, &name_miss);
1725 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1729 ASSERT(!
object.is_identical_to(holder));
1730 CheckPrototypes(Handle<JSObject>(
JSObject::cast(object->GetPrototype())),
1733 Register receiver =
rbx;
1734 Register index =
rdi;
1735 Register result =
rax;
1740 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1743 StringCharCodeAtGenerator generator(receiver,
1748 index_out_of_range_label,
1750 generator.GenerateFast(masm());
1753 StubRuntimeCallHelper call_helper;
1754 generator.GenerateSlow(masm(), call_helper);
1756 if (index_out_of_range.is_linked()) {
1757 __ bind(&index_out_of_range);
1758 __ LoadRoot(
rax, Heap::kNanValueRootIndex);
1765 __ bind(&name_miss);
1766 GenerateMissBranch();
1769 return GetCode(
function);
1773 Handle<Code> CallStubCompiler::CompileStringCharAtCall(
1774 Handle<Object>
object,
1775 Handle<JSObject> holder,
1776 Handle<JSGlobalPropertyCell> cell,
1777 Handle<JSFunction>
function,
1778 Handle<String> name) {
1788 if (!object->IsString() || !cell.is_null())
return Handle<Code>::null();
1790 const int argc = arguments().immediate();
1793 Label index_out_of_range;
1794 Label* index_out_of_range_label = &index_out_of_range;
1798 index_out_of_range_label = &miss;
1800 GenerateNameCheck(name, &name_miss);
1803 GenerateDirectLoadGlobalFunctionPrototype(masm(),
1807 ASSERT(!
object.is_identical_to(holder));
1808 CheckPrototypes(Handle<JSObject>(
JSObject::cast(object->GetPrototype())),
1811 Register receiver =
rax;
1812 Register index =
rdi;
1813 Register scratch =
rdx;
1814 Register result =
rax;
1819 __ LoadRoot(index, Heap::kUndefinedValueRootIndex);
1822 StringCharAtGenerator generator(receiver,
1828 index_out_of_range_label,
1830 generator.GenerateFast(masm());
1833 StubRuntimeCallHelper call_helper;
1834 generator.GenerateSlow(masm(), call_helper);
1836 if (index_out_of_range.is_linked()) {
1837 __ bind(&index_out_of_range);
1838 __ LoadRoot(
rax, Heap::kEmptyStringRootIndex);
1844 __ bind(&name_miss);
1845 GenerateMissBranch();
1848 return GetCode(
function);
1852 Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
1853 Handle<Object>
object,
1854 Handle<JSObject> holder,
1855 Handle<JSGlobalPropertyCell> cell,
1856 Handle<JSFunction>
function,
1857 Handle<String> name) {
1868 const int argc = arguments().immediate();
1869 if (!object->IsJSObject() || argc != 1)
return Handle<Code>::null();
1872 GenerateNameCheck(name, &miss);
1874 if (cell.is_null()) {
1876 __ JumpIfSmi(rdx, &miss);
1877 CheckPrototypes(Handle<JSObject>::cast(
object), rdx, holder, rbx,
rax, rdi,
1880 ASSERT(cell->value() == *
function);
1881 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(
object), holder, name,
1883 GenerateLoadFunctionFromCell(cell,
function, &miss);
1887 Register code =
rbx;
1892 __ JumpIfNotSmi(code, &slow);
1897 StringCharFromCodeGenerator generator(code,
rax);
1898 generator.GenerateFast(masm());
1901 StubRuntimeCallHelper call_helper;
1902 generator.GenerateSlow(masm(), call_helper);
1911 NullCallWrapper(), call_kind);
1915 GenerateMissBranch();
1918 return cell.is_null() ? GetCode(
function) : GetCode(
NORMAL, name);
1922 Handle<Code> CallStubCompiler::CompileMathFloorCall(
1923 Handle<Object>
object,
1924 Handle<JSObject> holder,
1925 Handle<JSGlobalPropertyCell> cell,
1926 Handle<JSFunction>
function,
1927 Handle<String> name) {
1933 Handle<Code> CallStubCompiler::CompileMathAbsCall(
1934 Handle<Object>
object,
1935 Handle<JSObject> holder,
1936 Handle<JSGlobalPropertyCell> cell,
1937 Handle<JSFunction>
function,
1938 Handle<String> name) {
1949 const int argc = arguments().immediate();
1950 if (!object->IsJSObject() || argc != 1)
return Handle<Code>::null();
1953 GenerateNameCheck(name, &miss);
1955 if (cell.is_null()) {
1957 __ JumpIfSmi(rdx, &miss);
1958 CheckPrototypes(Handle<JSObject>::cast(
object), rdx, holder, rbx,
rax, rdi,
1961 ASSERT(cell->value() == *
function);
1962 GenerateGlobalReceiverCheck(Handle<JSObject>::cast(
object), holder, name,
1964 GenerateLoadFunctionFromCell(cell,
function, &miss);
1972 __ JumpIfNotSmi(
rax, ¬_smi);
2002 Label negative_sign;
2003 const int sign_mask_shift =
2013 __ bind(&negative_sign);
2015 __ AllocateHeapNumber(
rax, rdx, &slow);
2026 NullCallWrapper(), call_kind);
2030 GenerateMissBranch();
2033 return cell.is_null() ? GetCode(
function) : GetCode(
NORMAL, name);
2037 Handle<Code> CallStubCompiler::CompileFastApiCall(
2038 const CallOptimization& optimization,
2039 Handle<Object>
object,
2040 Handle<JSObject> holder,
2041 Handle<JSGlobalPropertyCell> cell,
2042 Handle<JSFunction>
function,
2043 Handle<String> name) {
2044 ASSERT(optimization.is_simple_api_call());
2047 if (object->IsGlobalObject())
return Handle<Code>::null();
2048 if (!cell.is_null())
return Handle<Code>::null();
2049 if (!object->IsJSObject())
return Handle<Code>::null();
2050 int depth = optimization.GetPrototypeDepthOfExpectedType(
2051 Handle<JSObject>::cast(
object), holder);
2054 Label miss, miss_before_stack_reserved;
2055 GenerateNameCheck(name, &miss_before_stack_reserved);
2058 const int argc = arguments().immediate();
2062 __ JumpIfSmi(rdx, &miss_before_stack_reserved);
2064 Counters* counters = isolate()->counters();
2065 __ IncrementCounter(counters->call_const(), 1);
2066 __ IncrementCounter(counters->call_const_fast_api(), 1);
2073 CheckPrototypes(Handle<JSObject>::cast(
object), rdx, holder, rbx,
rax, rdi,
2074 name, depth, &miss);
2080 GenerateFastApiCall(masm(), optimization, argc);
2085 __ bind(&miss_before_stack_reserved);
2086 GenerateMissBranch();
2089 return GetCode(
function);
2094 Handle<JSObject> holder,
2095 Handle<JSFunction>
function,
2096 Handle<String> name,
2109 Handle<Code> code = CompileCustomCall(
object, holder,
2110 Handle<JSGlobalPropertyCell>::null(),
2113 if (!code.is_null())
return code;
2117 GenerateNameCheck(name, &miss);
2120 const int argc = arguments().immediate();
2125 __ JumpIfSmi(rdx, &miss);
2132 Counters* counters = isolate()->counters();
2135 __ IncrementCounter(counters->call_const(), 1);
2138 CheckPrototypes(Handle<JSObject>::cast(
object), rdx, holder, rbx,
rax,
2143 if (object->IsGlobalObject()) {
2150 if (function->IsBuiltin() || !
function->shared()->is_classic_mode()) {
2155 GenerateDirectLoadGlobalFunctionPrototype(
2168 if (function->IsBuiltin() || !
function->shared()->is_classic_mode()) {
2171 __ JumpIfSmi(rdx, &fast);
2176 GenerateDirectLoadGlobalFunctionPrototype(
2189 if (function->IsBuiltin() || !
function->shared()->is_classic_mode()) {
2192 __ CompareRoot(rdx, Heap::kTrueValueRootIndex);
2194 __ CompareRoot(rdx, Heap::kFalseValueRootIndex);
2198 GenerateDirectLoadGlobalFunctionPrototype(
2215 NullCallWrapper(), call_kind);
2219 GenerateMissBranch();
2222 return GetCode(
function);
2227 Handle<JSObject> holder,
2228 Handle<String> name) {
2239 GenerateNameCheck(name, &miss);
2242 const int argc = arguments().immediate();
2244 LookupResult lookup(isolate());
2245 LookupPostInterceptor(holder, name, &lookup);
2250 CallInterceptorCompiler compiler(
this, arguments(),
rcx, extra_state_);
2251 compiler.Compile(masm(),
object, holder, name, &lookup, rdx, rbx, rdi,
rax,
2258 __ JumpIfSmi(
rax, &miss);
2264 if (object->IsGlobalObject()) {
2275 NullCallWrapper(), call_kind);
2279 GenerateMissBranch();
2287 Handle<JSObject>
object,
2288 Handle<GlobalObject> holder,
2289 Handle<JSGlobalPropertyCell> cell,
2290 Handle<JSFunction>
function,
2291 Handle<String> name) {
2303 Handle<Code> code = CompileCustomCall(
object, holder, cell,
function, name);
2305 if (!code.is_null())
return code;
2309 GenerateNameCheck(name, &miss);
2312 const int argc = arguments().immediate();
2313 GenerateGlobalReceiverCheck(
object, holder, name, &miss);
2314 GenerateLoadFunctionFromCell(cell,
function, &miss);
2317 if (object->IsGlobalObject()) {
2326 Counters* counters = isolate()->counters();
2327 __ IncrementCounter(counters->call_global_inline(), 1);
2328 ParameterCount expected(function->shared()->formal_parameter_count());
2337 NullCallWrapper(), call_kind);
2341 __ IncrementCounter(counters->call_global_inline_miss(), 1);
2342 GenerateMissBranch();
2345 return GetCode(
NORMAL, name);
2351 Handle<Map> transition,
2352 Handle<String> name) {
2362 GenerateStoreField(masm(),
2372 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
2373 __ Jump(ic, RelocInfo::CODE_TARGET);
2381 Handle<JSObject>
object,
2382 Handle<AccessorInfo> callback,
2383 Handle<String> name) {
2393 __ CheckMap(rdx, Handle<Map>(object->map()), &miss,
2397 if (object->IsJSGlobalProxy()) {
2398 __ CheckAccessGlobalProxy(rdx, rbx, &miss);
2403 ASSERT(object->IsJSGlobalProxy() || !
object->IsAccessCheckNeeded());
2413 ExternalReference store_callback_property =
2414 ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
2415 __ TailCallExternalReference(store_callback_property, 4, 1);
2419 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
2420 __ Jump(ic, RelocInfo::CODE_TARGET);
2428 Handle<JSObject> receiver,
2429 Handle<JSFunction> setter,
2430 Handle<String> name) {
2440 __ CheckMap(rdx, Handle<Map>(receiver->map()), &miss,
DO_SMI_CHECK,
2452 ParameterCount actual(1);
2465 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
2466 __ Jump(ic, RelocInfo::CODE_TARGET);
2474 Handle<JSObject> receiver,
2475 Handle<String> name) {
2485 __ CheckMap(rdx, Handle<Map>(receiver->map()), &miss,
2489 if (receiver->IsJSGlobalProxy()) {
2490 __ CheckAccessGlobalProxy(rdx, rbx, &miss);
2495 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
2505 ExternalReference store_ic_property =
2506 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate());
2507 __ TailCallExternalReference(store_ic_property, 4, 1);
2511 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
2512 __ Jump(ic, RelocInfo::CODE_TARGET);
2520 Handle<GlobalObject>
object,
2521 Handle<JSGlobalPropertyCell> cell,
2522 Handle<String> name) {
2533 Handle<Map>(object->map()));
2544 __ CompareRoot(cell_operand, Heap::kTheHoleValueRootIndex);
2548 __ movq(cell_operand,
rax);
2552 Counters* counters = isolate()->counters();
2553 __ IncrementCounter(counters->named_store_global_inline(), 1);
2558 __ IncrementCounter(counters->named_store_global_inline_miss(), 1);
2559 Handle<Code> ic = isolate()->builtins()->StoreIC_Miss();
2560 __ Jump(ic, RelocInfo::CODE_TARGET);
2563 return GetCode(
NORMAL, name);
2569 Handle<Map> transition,
2570 Handle<String> name) {
2579 Counters* counters = isolate()->counters();
2580 __ IncrementCounter(counters->keyed_store_field(), 1);
2587 GenerateStoreField(masm(),
2597 __ DecrementCounter(counters->keyed_store_field(), 1);
2598 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
2599 __ Jump(ic, RelocInfo::CODE_TARGET);
2607 Handle<Map> receiver_map) {
2615 ElementsKind elements_kind = receiver_map->elements_kind();
2616 bool is_js_array = receiver_map->instance_type() ==
JS_ARRAY_TYPE;
2618 KeyedStoreElementStub(is_js_array, elements_kind, grow_mode_).GetCode();
2622 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
2623 __ jmp(ic, RelocInfo::CODE_TARGET);
2626 return GetCode(
NORMAL, factory()->empty_string());
2641 __ JumpIfSmi(rdx, &miss, Label::kNear);
2644 int receiver_count = receiver_maps->length();
2645 for (
int i = 0; i < receiver_count; ++i) {
2647 __ Cmp(rdi, receiver_maps->at(i));
2648 if (transitioned_maps->at(i).is_null()) {
2649 __ j(
equal, handler_stubs->at(i), RelocInfo::CODE_TARGET);
2653 __ movq(rbx, transitioned_maps->at(i), RelocInfo::EMBEDDED_OBJECT);
2654 __ jmp(handler_stubs->at(i), RelocInfo::CODE_TARGET);
2660 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss();
2661 __ jmp(ic, RelocInfo::CODE_TARGET);
2669 Handle<JSObject>
object,
2670 Handle<JSObject> last) {
2679 __ JumpIfSmi(
rax, &miss);
2684 CheckPrototypes(
object,
rax, last, rbx, rdx, rdi, name, &miss);
2688 if (last->IsGlobalObject()) {
2689 GenerateCheckPropertyCell(
2690 masm(), Handle<GlobalObject>::cast(last), name, rdx, &miss);
2695 __ LoadRoot(
rax, Heap::kUndefinedValueRootIndex);
2702 return GetCode(
NONEXISTENT, factory()->empty_string());
2707 Handle<JSObject> holder,
2709 Handle<String> name) {
2717 GenerateLoadField(
object, holder,
rax, rbx, rdx, rdi, index, name, &miss);
2722 return GetCode(
FIELD, name);
2727 Handle<String> name,
2728 Handle<JSObject>
object,
2729 Handle<JSObject> holder,
2730 Handle<AccessorInfo> callback) {
2737 GenerateLoadCallback(
object, holder,
rax,
rcx, rdx, rbx, rdi, callback,
2748 Handle<String> name,
2749 Handle<JSObject> receiver,
2750 Handle<JSObject> holder,
2751 Handle<JSFunction> getter) {
2760 __ JumpIfSmi(
rax, &miss);
2761 CheckPrototypes(receiver,
rax, holder, rbx, rdx, rdi, name, &miss);
2768 ParameterCount actual(0);
2786 Handle<JSObject> holder,
2787 Handle<JSFunction> value,
2788 Handle<String> name) {
2796 GenerateLoadConstant(
object, holder,
rax, rbx, rdx, rdi, value, name, &miss);
2806 Handle<JSObject> holder,
2807 Handle<String> name) {
2814 LookupResult lookup(isolate());
2815 LookupPostInterceptor(holder, name, &lookup);
2819 GenerateLoadInterceptor(receiver, holder, &lookup,
rax,
rcx, rdx, rbx, rdi,
2830 Handle<JSObject>
object,
2831 Handle<GlobalObject> holder,
2832 Handle<JSGlobalPropertyCell> cell,
2833 Handle<String> name,
2834 bool is_dont_delete) {
2843 __ JumpIfSmi(
rax, &miss);
2844 CheckPrototypes(
object,
rax, holder, rbx, rdx, rdi, name, &miss);
2851 if (!is_dont_delete) {
2852 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
2854 }
else if (FLAG_debug_code) {
2855 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
2856 __ Check(
not_equal,
"DontDelete cells can't contain the hole");
2859 Counters* counters = isolate()->counters();
2860 __ IncrementCounter(counters->named_load_global_stub(), 1);
2865 __ IncrementCounter(counters->named_load_global_stub_miss(), 1);
2869 return GetCode(
NORMAL, name);
2874 Handle<JSObject> receiver,
2875 Handle<JSObject> holder,
2884 Counters* counters = isolate()->counters();
2885 __ IncrementCounter(counters->keyed_load_field(), 1);
2891 GenerateLoadField(receiver, holder, rdx, rbx,
rcx, rdi, index, name, &miss);
2894 __ DecrementCounter(counters->keyed_load_field(), 1);
2898 return GetCode(
FIELD, name);
2903 Handle<String> name,
2904 Handle<JSObject> receiver,
2905 Handle<JSObject> holder,
2906 Handle<AccessorInfo> callback) {
2913 Counters* counters = isolate()->counters();
2914 __ IncrementCounter(counters->keyed_load_callback(), 1);
2920 GenerateLoadCallback(receiver, holder, rdx,
rax, rbx,
rcx, rdi, callback,
2923 __ DecrementCounter(counters->keyed_load_callback(), 1);
2932 Handle<String> name,
2933 Handle<JSObject> receiver,
2934 Handle<JSObject> holder,
2935 Handle<JSFunction> value) {
2943 Counters* counters = isolate()->counters();
2944 __ IncrementCounter(counters->keyed_load_constant_function(), 1);
2950 GenerateLoadConstant(receiver, holder, rdx, rbx,
rcx, rdi,
2951 value, name, &miss);
2953 __ DecrementCounter(counters->keyed_load_constant_function(), 1);
2962 Handle<JSObject> receiver,
2963 Handle<JSObject> holder,
2964 Handle<String> name) {
2971 Counters* counters = isolate()->counters();
2972 __ IncrementCounter(counters->keyed_load_interceptor(), 1);
2978 LookupResult lookup(isolate());
2979 LookupPostInterceptor(holder, name, &lookup);
2980 GenerateLoadInterceptor(receiver, holder, &lookup, rdx,
rax,
rcx, rbx, rdi,
2983 __ DecrementCounter(counters->keyed_load_interceptor(), 1);
2992 Handle<String> name) {
3000 Counters* counters = isolate()->counters();
3001 __ IncrementCounter(counters->keyed_load_array_length(), 1);
3007 GenerateLoadArrayLength(masm(), rdx,
rcx, &miss);
3009 __ DecrementCounter(counters->keyed_load_array_length(), 1);
3018 Handle<String> name) {
3026 Counters* counters = isolate()->counters();
3027 __ IncrementCounter(counters->keyed_load_string_length(), 1);
3033 GenerateLoadStringLength(masm(), rdx,
rcx, rbx, &miss,
true);
3035 __ DecrementCounter(counters->keyed_load_string_length(), 1);
3044 Handle<String> name) {
3052 Counters* counters = isolate()->counters();
3053 __ IncrementCounter(counters->keyed_load_function_prototype(), 1);
3059 GenerateLoadFunctionPrototype(masm(), rdx,
rcx, rbx, &miss);
3061 __ DecrementCounter(counters->keyed_load_function_prototype(), 1);
3070 Handle<Map> receiver_map) {
3076 ElementsKind elements_kind = receiver_map->elements_kind();
3077 Handle<Code> stub = KeyedLoadElementStub(elements_kind).GetCode();
3081 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss();
3082 __ jmp(ic, RelocInfo::CODE_TARGET);
3085 return GetCode(
NORMAL, factory()->empty_string());
3098 __ JumpIfSmi(rdx, &miss);
3100 Register map_reg =
rbx;
3102 int receiver_count = receiver_maps->length();
3103 for (
int current = 0; current < receiver_count; ++current) {
3105 __ Cmp(map_reg, receiver_maps->at(current));
3106 __ j(
equal, handler_ics->at(current), RelocInfo::CODE_TARGET);
3120 Handle<JSFunction>
function) {
3127 Label generic_stub_call;
3130 __ Move(
r8, factory()->undefined_value());
3132 #ifdef ENABLE_DEBUGGER_SUPPORT
3146 __ JumpIfSmi(rbx, &generic_stub_call);
3155 __ Assert(
not_equal,
"Function constructed by construct stub.");
3170 __ Move(rbx, factory()->empty_fixed_array());
3189 Handle<SharedFunctionInfo> shared(function->shared());
3190 for (
int i = 0; i < shared->this_property_assignments_count(); i++) {
3191 if (shared->IsThisPropertyAssignmentArgument(i)) {
3195 int arg_number = shared->GetThisPropertyAssignmentArgument(i);
3197 __ cmpq(
rax, Immediate(arg_number));
3203 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
3209 ASSERT(function->has_initial_map());
3210 for (
int i = shared->this_property_assignments_count();
3211 i <
function->initial_map()->inobject_properties();
3229 Counters* counters = isolate()->counters();
3230 __ IncrementCounter(counters->constructed_objects(), 1);
3231 __ IncrementCounter(counters->constructed_objects_stub(), 1);
3236 __ bind(&generic_stub_call);
3237 Handle<Code> code = isolate()->builtins()->JSConstructStubGeneric();
3238 __ Jump(code, RelocInfo::CODE_TARGET);
3246 #define __ ACCESS_MASM(masm)
3250 MacroAssembler* masm) {
3256 Label slow, miss_force_generic;
3261 __ JumpIfNotSmi(
rax, &miss_force_generic);
3262 __ SmiToInteger32(rbx,
rax);
3270 __ LoadFromNumberDictionary(&slow,
rcx,
rax, rbx,
r9, rdi,
rax);
3279 Handle<Code> slow_ic =
3280 masm->isolate()->builtins()->KeyedLoadIC_Slow();
3281 __ jmp(slow_ic, RelocInfo::CODE_TARGET);
3283 __ bind(&miss_force_generic);
3289 Handle<Code> miss_ic =
3290 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3291 __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3295 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3298 XMMRegister xmm_scratch0,
3299 XMMRegister xmm_scratch1,
3304 __ JumpIfSmi(key, &key_ok);
3306 masm->isolate()->factory()->heap_number_map(),
3310 __ cvttsd2si(scratch, xmm_scratch0);
3311 __ cvtlsi2sd(xmm_scratch1, scratch);
3312 __ ucomisd(xmm_scratch1, xmm_scratch0);
3315 __ Integer32ToSmi(key, scratch);
3321 MacroAssembler* masm,
3328 Label slow, miss_force_generic;
3334 GenerateSmiKeyCheck(masm,
rax,
rcx,
xmm0,
xmm1, &miss_force_generic);
3349 switch (elements_kind) {
3394 __ JumpIfUIntNotValidSmiValue(
rcx, &box_int, Label::kNear);
3407 __ AllocateHeapNumber(
rcx, rbx, &slow);
3416 __ AllocateHeapNumber(
rcx, rbx, &slow);
3428 Counters* counters = masm->isolate()->counters();
3429 __ IncrementCounter(counters->keyed_load_external_array_slow(), 1);
3437 Handle<Code> ic = masm->isolate()->builtins()->KeyedLoadIC_Slow();
3438 __ jmp(ic, RelocInfo::CODE_TARGET);
3441 __ bind(&miss_force_generic);
3448 Handle<Code> miss_ic =
3449 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3450 __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3455 MacroAssembler* masm,
3463 Label slow, miss_force_generic;
3469 GenerateSmiKeyCheck(masm,
rcx, rbx,
xmm0,
xmm1, &miss_force_generic);
3473 __ SmiToInteger32(rdi,
rcx);
3485 Label check_heap_number;
3488 __ JumpIfNotSmi(
rax, &slow);
3490 __ JumpIfNotSmi(
rax, &check_heap_number, Label::kNear);
3493 __ SmiToInteger32(rdx,
rax);
3496 switch (elements_kind) {
3500 __ testl(rdx, Immediate(0xFFFFFF00));
3501 __ j(
zero, &done, Label::kNear);
3506 __ movb(Operand(rbx, rdi,
times_1, 0), rdx);
3510 __ movb(Operand(rbx, rdi,
times_1, 0), rdx);
3514 __ movw(Operand(rbx, rdi,
times_2, 0), rdx);
3518 __ movl(Operand(rbx, rdi,
times_4, 0), rdx);
3545 __ bind(&check_heap_number);
3583 switch (elements_kind) {
3624 Handle<Code> ic = masm->isolate()->builtins()->KeyedStoreIC_Slow();
3625 __ jmp(ic, RelocInfo::CODE_TARGET);
3628 __ bind(&miss_force_generic);
3637 Handle<Code> miss_ic =
3638 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3639 __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3649 Label miss_force_generic;
3655 GenerateSmiKeyCheck(masm,
rax,
rcx,
xmm0,
xmm1, &miss_force_generic);
3659 __ AssertFastElements(
rcx);
3670 FixedArray::kHeaderSize));
3671 __ CompareRoot(rbx, Heap::kTheHoleValueRootIndex);
3672 __ j(
equal, &miss_force_generic);
3676 __ bind(&miss_force_generic);
3677 Code* code = masm->isolate()->builtins()->builtin(
3678 Builtins::kKeyedLoadIC_MissForceGeneric);
3679 Handle<Code> ic(code);
3680 __ jmp(ic, RelocInfo::CODE_TARGET);
3685 MacroAssembler* masm) {
3691 Label miss_force_generic, slow_allocate_heapnumber;
3697 GenerateSmiKeyCheck(masm,
rax,
rcx,
xmm0,
xmm1, &miss_force_generic);
3701 __ AssertFastElements(
rcx);
3712 __ j(
equal, &miss_force_generic);
3717 __ AllocateHeapNumber(
rcx, rbx, &slow_allocate_heapnumber);
3723 __ bind(&slow_allocate_heapnumber);
3724 Handle<Code> slow_ic =
3725 masm->isolate()->builtins()->KeyedLoadIC_Slow();
3726 __ jmp(slow_ic, RelocInfo::CODE_TARGET);
3728 __ bind(&miss_force_generic);
3729 Handle<Code> miss_ic =
3730 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric();
3731 __ jmp(miss_ic, RelocInfo::CODE_TARGET);
3736 MacroAssembler* masm,
3746 Label miss_force_generic, transition_elements_kind, finish_store, grow;
3747 Label check_capacity, slow;
3753 GenerateSmiKeyCheck(masm,
rcx, rbx,
xmm0,
xmm1, &miss_force_generic);
3756 __ JumpIfNotSmi(
rax, &transition_elements_kind);
3775 Heap::kFixedArrayMapRootIndex);
3778 __ bind(&finish_store);
3799 __ bind(&miss_force_generic);
3800 Handle<Code> ic_force_generic =
3801 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3802 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3804 __ bind(&transition_elements_kind);
3805 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
3806 __ jmp(ic_miss, RelocInfo::CODE_TARGET);
3820 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex);
3832 masm->isolate()->factory()->fixed_array_map());
3835 __ LoadRoot(rbx, Heap::kTheHoleValueRootIndex);
3852 __ bind(&check_capacity);
3855 Heap::kFixedCOWArrayMapRootIndex);
3856 __ j(
equal, &miss_force_generic);
3869 __ jmp(&finish_store);
3872 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow();
3873 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
3879 MacroAssembler* masm,
3888 Label miss_force_generic, transition_elements_kind, finish_store;
3889 Label grow, slow, check_capacity;
3895 GenerateSmiKeyCheck(masm,
rcx, rbx,
xmm0,
xmm1, &miss_force_generic);
3899 __ AssertFastElements(rdi);
3915 __ bind(&finish_store);
3918 &transition_elements_kind);
3922 __ bind(&miss_force_generic);
3923 Handle<Code> ic_force_generic =
3924 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric();
3925 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET);
3927 __ bind(&transition_elements_kind);
3930 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss();
3931 __ jmp(ic_miss, RelocInfo::CODE_TARGET);
3944 __ JumpIfSmi(
rax, &value_is_smi);
3946 Heap::kHeapNumberMapRootIndex);
3948 __ bind(&value_is_smi);
3953 __ CompareRoot(rdi, Heap::kEmptyFixedArrayRootIndex);
3966 masm->isolate()->factory()->fixed_double_array_map());
3978 __ jmp(&finish_store);
3980 __ bind(&check_capacity);
3992 __ jmp(&finish_store);
3995 Handle<Code> ic_slow = masm->isolate()->builtins()->KeyedStoreIC_Slow();
3996 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4005 #endif // V8_TARGET_ARCH_X64
static const int kBitFieldOffset
Handle< Code > CompileLoadFunctionPrototype(Handle< String > name)
static const int kMaxLength
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
static const int kNotFound
static const int kCodeEntryOffset
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
static const int kPrototypeOrInitialMapOffset
static int SlotOffset(int index)
static const int kDataOffset
Handle< Code > CompileLoadNonexistent(Handle< String > name, Handle< JSObject > object, Handle< JSObject > last)
Handle< Code > CompileStoreElement(Handle< Map > receiver_map)
void GenerateProbe(MacroAssembler *masm, Code::Flags flags, Register receiver, Register name, Register scratch, Register extra, Register extra2=no_reg, Register extra3=no_reg)
static const int kFlagsOffset
static Smi * FromInt(int value)
bool IsFastObjectElementsKind(ElementsKind kind)
#define LOG(isolate, Call)
static void GenerateStoreExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Handle< Code > CompileStoreViaSetter(Handle< JSObject > receiver, Handle< JSFunction > setter, Handle< String > name)
static const int kGlobalReceiverOffset
static void GenerateLoadFastDoubleElement(MacroAssembler *masm)
static PropertyType ExtractTypeFromFlags(Flags flags)
static const int kExternalPointerOffset
static const int kHasNamedInterceptor
static const int kIsAccessCheckNeeded
List< Handle< Map > > MapHandleList
#define ASSERT(condition)
Handle< Code > CompileStoreCallback(Handle< JSObject > object, Handle< AccessorInfo > callback, Handle< String > name)
const int kPointerSizeLog2
static const int kInstanceSizeOffset
static const int kDebugInfoOffset
static const int kGlobalContextOffset
static const int kContextOffset
Handle< Code > CompileLoadField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
Handle< Code > CompileStoreInterceptor(Handle< JSObject > object, Handle< String > name)
static void GenerateNegativeLookup(MacroAssembler *masm, Label *miss, Label *done, Register receiver, Register properties, Handle< String > name, Register scratch0)
Handle< Code > CompileStoreField(Handle< JSObject > object, int index, Handle< Map > transition, Handle< String > name)
static const int kHashFieldOffset
const uint32_t kNotStringTag
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
static const int kLengthOffset
Handle< Code > CompileCallGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< JSFunction > function, Handle< String > name)
Handle< Code > CompileLoadField(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, int index)
static const int kValueOffset
const uint32_t kHoleNanUpper32
Handle< Code > CompileStoreGlobal(Handle< GlobalObject > object, Handle< JSGlobalPropertyCell > holder, Handle< String > name)
Handle< Code > CompileLoadViaGetter(Handle< String > name, Handle< JSObject > receiver, Handle< JSObject > holder, Handle< JSFunction > getter)
Handle< Code > CompileLoadConstant(Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value, Handle< String > name)
Handle< Code > CompileLoadConstant(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< JSFunction > value)
Handle< Code > CompileCallField(Handle< JSObject > object, Handle< JSObject > holder, int index, Handle< String > name)
static void GenerateStoreFastElement(MacroAssembler *masm, bool is_js_array, ElementsKind element_kind, KeyedAccessGrowMode grow_mode)
Handle< Code > CompileLoadStringLength(Handle< String > name)
Operand FieldOperand(Register object, int offset)
const uint32_t kHoleNanLower32
static bool decode(uint32_t value)
Operand StackSpaceOperand(int index)
static const int kPropertiesOffset
Handle< Code > CompileLoadGlobal(Handle< JSObject > object, Handle< GlobalObject > holder, Handle< JSGlobalPropertyCell > cell, Handle< String > name, bool is_dont_delete)
bool IsFastSmiElementsKind(ElementsKind kind)
static void GenerateMapChangeElementsTransition(MacroAssembler *masm)
static const int kDataOffset
static int SizeFor(int length)
static const int kElementsOffset
static void GenerateLoadDictionaryElement(MacroAssembler *masm)
static void GenerateLoadExternalArray(MacroAssembler *masm, ElementsKind elements_kind)
static const int kLengthOffset
static int SizeFor(int length)
static const int kHeaderSize
static const int kMapOffset
List< Handle< Code > > CodeHandleList
static const int kLengthOffset
Handle< Code > CompileCallInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
static const int kDataOffset
const Register kScratchRegister
static const int kContextOffset
static void GenerateLoadFastElement(MacroAssembler *masm)
static const uint32_t kSignMask
v8::Handle< v8::Value > Load(const v8::Arguments &args)
static void GenerateStoreFastDoubleElement(MacroAssembler *masm, bool is_js_array, KeyedAccessGrowMode grow_mode)
static const int kHeaderSize
static Handle< T > null()
#define ASSERT_EQ(v1, v2)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Handle< Code > CompileLoadArrayLength(Handle< String > name)
Handle< Code > CompileCallConstant(Handle< Object > object, Handle< JSObject > holder, Handle< JSFunction > function, Handle< String > name, CheckType check)
static AccessorInfo * cast(Object *obj)
static const int kHeaderSize
const int kHeapObjectTagSize
static Handle< JSGlobalPropertyCell > EnsurePropertyCell(Handle< GlobalObject > global, Handle< String > name)
static bool HasCustomCallGenerator(Handle< JSFunction > function)
static const int kPreallocatedArrayElements
static const int kPrototypeOffset
static const int kFlagsNotUsedInLookup
const int kInvalidProtoDepth
static const int kValueOffset
Handle< Code > CompileLoadCallback(Handle< String > name, Handle< JSObject > object, Handle< JSObject > holder, Handle< AccessorInfo > callback)
Handle< Code > CompileLoadPolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_ics)
Handle< Code > CompileLoadInterceptor(Handle< JSObject > object, Handle< JSObject > holder, Handle< String > name)
Handle< Code > CompileStorePolymorphic(MapHandleList *receiver_maps, CodeHandleList *handler_stubs, MapHandleList *transitioned_maps)
static const int kSharedFunctionInfoOffset
static const int kMaxValue
void check(i::Vector< const char > string)
static const int kExponentOffset
static const int kValueOffset
Handle< Code > CompileLoadElement(Handle< Map > receiver_map)
Handle< Code > CompileConstructStub(Handle< JSFunction > function)
static JSObject * cast(Object *obj)
static const int kInstanceTypeOffset
static JSFunction * cast(Object *obj)