Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 } 2343 }
2344 2344
2345 2345
2346 void CallFunctionStub::Generate(MacroAssembler* masm) { 2346 void CallFunctionStub::Generate(MacroAssembler* masm) {
2347 // rbx : cache cell for call target 2347 // rbx : cache cell for call target
2348 // rdi : the function to call 2348 // rdi : the function to call
2349 Isolate* isolate = masm->isolate(); 2349 Isolate* isolate = masm->isolate();
2350 Label slow, non_function; 2350 Label slow, non_function;
2351 StackArgumentsAccessor args(rsp, argc_); 2351 StackArgumentsAccessor args(rsp, argc_);
2352 2352
2353 // The receiver might implicitly be the global object. This is
2354 // indicated by passing the hole as the receiver to the call
2355 // function stub.
2356 if (ReceiverMightBeImplicit()) {
2357 Label call;
2358 // Get the receiver from the stack.
2359 __ movq(rax, args.GetReceiverOperand());
2360 // Call as function is indicated with the hole.
2361 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
2362 __ j(not_equal, &call, Label::kNear);
2363 // Patch the receiver on the stack with the global receiver object.
2364 __ movq(rcx, GlobalObjectOperand());
2365 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
2366 __ movq(args.GetReceiverOperand(), rcx);
2367 __ bind(&call);
2368 }
2369
2370 // Check that the function really is a JavaScript function. 2353 // Check that the function really is a JavaScript function.
2371 __ JumpIfSmi(rdi, &non_function); 2354 __ JumpIfSmi(rdi, &non_function);
2355
2372 // Goto slow case if we do not have a function. 2356 // Goto slow case if we do not have a function.
2373 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 2357 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2374 __ j(not_equal, &slow); 2358 __ j(not_equal, &slow);
2375 2359
2376 if (RecordCallTarget()) { 2360 if (RecordCallTarget()) {
2377 GenerateRecordCallTarget(masm); 2361 GenerateRecordCallTarget(masm);
2378 } 2362 }
2379 2363
2380 // Fast-case: Just invoke the function. 2364 // Fast-case: Just invoke the function.
2381 ParameterCount actual(argc_); 2365 ParameterCount actual(argc_);
2382 2366
2383 if (ReceiverMightBeImplicit()) {
2384 Label call_as_function;
2385 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
2386 __ j(equal, &call_as_function);
2387 __ InvokeFunction(rdi,
2388 actual,
2389 JUMP_FUNCTION,
2390 NullCallWrapper(),
2391 CALL_AS_METHOD);
2392 __ bind(&call_as_function);
2393 }
2394 __ InvokeFunction(rdi, 2367 __ InvokeFunction(rdi,
2395 actual, 2368 actual,
2396 JUMP_FUNCTION, 2369 JUMP_FUNCTION,
2397 NullCallWrapper(), 2370 NullCallWrapper(),
2398 CALL_AS_FUNCTION); 2371 CALL_AS_FUNCTION);
2399 2372
2400 // Slow-case: Non-function called. 2373 // Slow-case: Non-function called.
2401 __ bind(&slow); 2374 __ bind(&slow);
2402 if (RecordCallTarget()) { 2375 if (RecordCallTarget()) {
2403 // If there is a call target cache, mark it megamorphic in the 2376 // If there is a call target cache, mark it megamorphic in the
2404 // non-function case. MegamorphicSentinel is an immortal immovable 2377 // non-function case. MegamorphicSentinel is an immortal immovable
2405 // object (undefined) so no write barrier is needed. 2378 // object (undefined) so no write barrier is needed.
2406 __ Move(FieldOperand(rbx, Cell::kValueOffset), 2379 __ Move(FieldOperand(rbx, Cell::kValueOffset),
2407 TypeFeedbackCells::MegamorphicSentinel(isolate)); 2380 TypeFeedbackCells::MegamorphicSentinel(isolate));
2408 } 2381 }
2409 // Check for function proxy. 2382 // Check for function proxy.
2410 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 2383 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
2411 __ j(not_equal, &non_function); 2384 __ j(not_equal, &non_function);
2412 __ PopReturnAddressTo(rcx); 2385 __ PopReturnAddressTo(rcx);
2413 __ push(rdi); // put proxy as additional argument under return address 2386 __ push(rdi); // put proxy as additional argument under return address
2414 __ PushReturnAddressFrom(rcx); 2387 __ PushReturnAddressFrom(rcx);
2415 __ Set(rax, argc_ + 1); 2388 __ Set(rax, argc_ + 1);
2416 __ Set(rbx, 0); 2389 __ Set(rbx, 0);
2417 __ SetCallKind(rcx, CALL_AS_METHOD); 2390 __ SetCallKind(rcx, CALL_AS_FUNCTION);
2418 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); 2391 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
2419 { 2392 {
2420 Handle<Code> adaptor = 2393 Handle<Code> adaptor =
2421 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2394 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
2422 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2395 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2423 } 2396 }
2424 2397
2425 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2398 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2426 // of the original receiver from the call site). 2399 // of the original receiver from the call site).
2427 __ bind(&non_function); 2400 __ bind(&non_function);
2428 __ movq(args.GetReceiverOperand(), rdi); 2401 __ movq(args.GetReceiverOperand(), rdi);
2429 __ Set(rax, argc_); 2402 __ Set(rax, argc_);
2430 __ Set(rbx, 0); 2403 __ Set(rbx, 0);
2431 __ SetCallKind(rcx, CALL_AS_METHOD); 2404 __ SetCallKind(rcx, CALL_AS_FUNCTION);
2432 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); 2405 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION);
2433 Handle<Code> adaptor = 2406 Handle<Code> adaptor =
2434 isolate->builtins()->ArgumentsAdaptorTrampoline(); 2407 isolate->builtins()->ArgumentsAdaptorTrampoline();
2435 __ Jump(adaptor, RelocInfo::CODE_TARGET); 2408 __ Jump(adaptor, RelocInfo::CODE_TARGET);
2436 } 2409 }
2437 2410
2438 2411
2439 void CallConstructStub::Generate(MacroAssembler* masm) { 2412 void CallConstructStub::Generate(MacroAssembler* masm) {
2440 // rax : number of arguments 2413 // rax : number of arguments
2441 // rbx : cache cell for call target 2414 // rbx : cache cell for call target
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 // Do space-specific GC and retry runtime call. 2687 // Do space-specific GC and retry runtime call.
2715 GenerateCore(masm, 2688 GenerateCore(masm,
2716 &throw_normal_exception, 2689 &throw_normal_exception,
2717 &throw_termination_exception, 2690 &throw_termination_exception,
2718 &throw_out_of_memory_exception, 2691 &throw_out_of_memory_exception,
2719 true, 2692 true,
2720 false); 2693 false);
2721 2694
2722 // Do full GC and retry runtime call one final time. 2695 // Do full GC and retry runtime call one final time.
2723 Failure* failure = Failure::InternalError(); 2696 Failure* failure = Failure::InternalError();
2724 __ movq(rax, failure, RelocInfo::NONE64); 2697 __ Move(rax, failure, RelocInfo::NONE64);
2725 GenerateCore(masm, 2698 GenerateCore(masm,
2726 &throw_normal_exception, 2699 &throw_normal_exception,
2727 &throw_termination_exception, 2700 &throw_termination_exception,
2728 &throw_out_of_memory_exception, 2701 &throw_out_of_memory_exception,
2729 true, 2702 true,
2730 true); 2703 true);
2731 2704
2732 __ bind(&throw_out_of_memory_exception); 2705 __ bind(&throw_out_of_memory_exception);
2733 // Set external caught exception to false. 2706 // Set external caught exception to false.
2734 Isolate* isolate = masm->isolate(); 2707 Isolate* isolate = masm->isolate();
2735 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, 2708 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
2736 isolate); 2709 isolate);
2737 __ Set(rax, static_cast<int64_t>(false)); 2710 __ Set(rax, static_cast<int64_t>(false));
2738 __ Store(external_caught, rax); 2711 __ Store(external_caught, rax);
2739 2712
2740 // Set pending exception and rax to out of memory exception. 2713 // Set pending exception and rax to out of memory exception.
2741 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 2714 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
2742 isolate); 2715 isolate);
2743 Label already_have_failure; 2716 Label already_have_failure;
2744 JumpIfOOM(masm, rax, kScratchRegister, &already_have_failure); 2717 JumpIfOOM(masm, rax, kScratchRegister, &already_have_failure);
2745 __ movq(rax, Failure::OutOfMemoryException(0x1), RelocInfo::NONE64); 2718 __ Move(rax, Failure::OutOfMemoryException(0x1), RelocInfo::NONE64);
2746 __ bind(&already_have_failure); 2719 __ bind(&already_have_failure);
2747 __ Store(pending_exception, rax); 2720 __ Store(pending_exception, rax);
2748 // Fall through to the next label. 2721 // Fall through to the next label.
2749 2722
2750 __ bind(&throw_termination_exception); 2723 __ bind(&throw_termination_exception);
2751 __ ThrowUncatchable(rax); 2724 __ ThrowUncatchable(rax);
2752 2725
2753 __ bind(&throw_normal_exception); 2726 __ bind(&throw_normal_exception);
2754 __ Throw(rax); 2727 __ Throw(rax);
2755 } 2728 }
2756 2729
2757 2730
2758 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 2731 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
2759 Label invoke, handler_entry, exit; 2732 Label invoke, handler_entry, exit;
2760 Label not_outermost_js, not_outermost_js_2; 2733 Label not_outermost_js, not_outermost_js_2;
2761 2734
2762 ProfileEntryHookStub::MaybeCallEntryHook(masm); 2735 ProfileEntryHookStub::MaybeCallEntryHook(masm);
2763 2736
2764 { // NOLINT. Scope block confuses linter. 2737 { // NOLINT. Scope block confuses linter.
2765 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 2738 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
2766 // Set up frame. 2739 // Set up frame.
2767 __ push(rbp); 2740 __ push(rbp);
2768 __ movq(rbp, rsp); 2741 __ movq(rbp, rsp);
2769 2742
2770 // Push the stack frame type marker twice. 2743 // Push the stack frame type marker twice.
2771 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 2744 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
2772 // Scratch register is neither callee-save, nor an argument register on any 2745 // Scratch register is neither callee-save, nor an argument register on any
2773 // platform. It's free to use at this point. 2746 // platform. It's free to use at this point.
2774 // Cannot use smi-register for loading yet. 2747 // Cannot use smi-register for loading yet.
2775 __ movq(kScratchRegister, Smi::FromInt(marker), RelocInfo::NONE64); 2748 __ Move(kScratchRegister, Smi::FromInt(marker), RelocInfo::NONE64);
2776 __ push(kScratchRegister); // context slot 2749 __ push(kScratchRegister); // context slot
2777 __ push(kScratchRegister); // function slot 2750 __ push(kScratchRegister); // function slot
2778 // Save callee-saved registers (X64/Win64 calling conventions). 2751 // Save callee-saved registers (X64/Win64 calling conventions).
2779 __ push(r12); 2752 __ push(r12);
2780 __ push(r13); 2753 __ push(r13);
2781 __ push(r14); 2754 __ push(r14);
2782 __ push(r15); 2755 __ push(r15);
2783 #ifdef _WIN64 2756 #ifdef _WIN64
2784 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 2757 __ push(rdi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
2785 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI. 2758 __ push(rsi); // Only callee save in Win64 ABI, argument in AMD64 ABI.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 // Jump to a faked try block that does the invoke, with a faked catch 2806 // Jump to a faked try block that does the invoke, with a faked catch
2834 // block that sets the pending exception. 2807 // block that sets the pending exception.
2835 __ jmp(&invoke); 2808 __ jmp(&invoke);
2836 __ bind(&handler_entry); 2809 __ bind(&handler_entry);
2837 handler_offset_ = handler_entry.pos(); 2810 handler_offset_ = handler_entry.pos();
2838 // Caught exception: Store result (exception) in the pending exception 2811 // Caught exception: Store result (exception) in the pending exception
2839 // field in the JSEnv and return a failure sentinel. 2812 // field in the JSEnv and return a failure sentinel.
2840 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 2813 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
2841 isolate); 2814 isolate);
2842 __ Store(pending_exception, rax); 2815 __ Store(pending_exception, rax);
2843 __ movq(rax, Failure::Exception(), RelocInfo::NONE64); 2816 __ Move(rax, Failure::Exception(), RelocInfo::NONE64);
2844 __ jmp(&exit); 2817 __ jmp(&exit);
2845 2818
2846 // Invoke: Link this frame into the handler chain. There's only one 2819 // Invoke: Link this frame into the handler chain. There's only one
2847 // handler block in this code object, so its index is 0. 2820 // handler block in this code object, so its index is 0.
2848 __ bind(&invoke); 2821 __ bind(&invoke);
2849 __ PushTryHandler(StackHandler::JS_ENTRY, 0); 2822 __ PushTryHandler(StackHandler::JS_ENTRY, 0);
2850 2823
2851 // Clear any pending exceptions. 2824 // Clear any pending exceptions.
2852 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); 2825 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex);
2853 __ Store(pending_exception, rax); 2826 __ Store(pending_exception, rax);
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
4250 Isolate* isolate = masm->isolate(); 4223 Isolate* isolate = masm->isolate();
4251 4224
4252 // Load rcx with the allocation site. We stick an undefined dummy value here 4225 // Load rcx with the allocation site. We stick an undefined dummy value here
4253 // and replace it with the real allocation site later when we instantiate this 4226 // and replace it with the real allocation site later when we instantiate this
4254 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). 4227 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate().
4255 __ Move(rcx, handle(isolate->heap()->undefined_value())); 4228 __ Move(rcx, handle(isolate->heap()->undefined_value()));
4256 4229
4257 // Make sure that we actually patched the allocation site. 4230 // Make sure that we actually patched the allocation site.
4258 if (FLAG_debug_code) { 4231 if (FLAG_debug_code) {
4259 __ testb(rcx, Immediate(kSmiTagMask)); 4232 __ testb(rcx, Immediate(kSmiTagMask));
4260 __ Assert(zero, kExpectedAllocationSite); 4233 __ Assert(not_equal, kExpectedAllocationSite);
4261 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), 4234 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset),
4262 isolate->factory()->allocation_site_map()); 4235 isolate->factory()->allocation_site_map());
4263 __ Assert(equal, kExpectedAllocationSite); 4236 __ Assert(equal, kExpectedAllocationSite);
4264 } 4237 }
4265 4238
4266 // Tail call into the stub that handles binary operations with allocation 4239 // Tail call into the stub that handles binary operations with allocation
4267 // sites. 4240 // sites.
4268 BinaryOpWithAllocationSiteStub stub(state_); 4241 BinaryOpWithAllocationSiteStub stub(state_);
4269 __ TailCallStub(&stub); 4242 __ TailCallStub(&stub);
4270 } 4243 }
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5162 __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kPointerSize)); 5135 __ lea(arg_reg_2, Operand(rsp, (kNumSavedRegisters + 1) * kPointerSize));
5163 5136
5164 // Calculate the function address to the first arg. 5137 // Calculate the function address to the first arg.
5165 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kPointerSize)); 5138 __ movq(arg_reg_1, Operand(rsp, kNumSavedRegisters * kPointerSize));
5166 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength)); 5139 __ subq(arg_reg_1, Immediate(Assembler::kShortCallInstructionLength));
5167 5140
5168 // Save the remainder of the volatile registers. 5141 // Save the remainder of the volatile registers.
5169 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2); 5142 masm->PushCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2);
5170 5143
5171 // Call the entry hook function. 5144 // Call the entry hook function.
5172 __ movq(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()), 5145 __ Move(rax, FUNCTION_ADDR(masm->isolate()->function_entry_hook()),
5173 RelocInfo::NONE64); 5146 RelocInfo::NONE64);
5174 5147
5175 AllowExternalCallThatCantCauseGC scope(masm); 5148 AllowExternalCallThatCantCauseGC scope(masm);
5176 5149
5177 const int kArgumentCount = 2; 5150 const int kArgumentCount = 2;
5178 __ PrepareCallCFunction(kArgumentCount); 5151 __ PrepareCallCFunction(kArgumentCount);
5179 __ CallCFunction(rax, kArgumentCount); 5152 __ CallCFunction(rax, kArgumentCount);
5180 5153
5181 // Restore volatile regs. 5154 // Restore volatile regs.
5182 masm->PopCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2); 5155 masm->PopCallerSaved(kSaveFPRegs, arg_reg_1, arg_reg_2);
5183 __ pop(arg_reg_2); 5156 __ pop(arg_reg_2);
5184 __ pop(arg_reg_1); 5157 __ pop(arg_reg_1);
5185 5158
5186 __ Ret(); 5159 __ Ret();
5187 } 5160 }
5188 5161
5189 5162
5190 template<class T> 5163 template<class T>
5191 static void CreateArrayDispatch(MacroAssembler* masm, 5164 static void CreateArrayDispatch(MacroAssembler* masm,
5192 AllocationSiteOverrideMode mode) { 5165 AllocationSiteOverrideMode mode) {
5193 if (mode == DISABLE_ALLOCATION_SITES) { 5166 if (mode == DISABLE_ALLOCATION_SITES) {
5194 T stub(GetInitialFastElementsKind(), 5167 T stub(GetInitialFastElementsKind(), mode);
5195 CONTEXT_CHECK_REQUIRED,
5196 mode);
5197 __ TailCallStub(&stub); 5168 __ TailCallStub(&stub);
5198 } else if (mode == DONT_OVERRIDE) { 5169 } else if (mode == DONT_OVERRIDE) {
5199 int last_index = GetSequenceIndexFromFastElementsKind( 5170 int last_index = GetSequenceIndexFromFastElementsKind(
5200 TERMINAL_FAST_ELEMENTS_KIND); 5171 TERMINAL_FAST_ELEMENTS_KIND);
5201 for (int i = 0; i <= last_index; ++i) { 5172 for (int i = 0; i <= last_index; ++i) {
5202 Label next; 5173 Label next;
5203 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5174 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5204 __ cmpl(rdx, Immediate(kind)); 5175 __ cmpl(rdx, Immediate(kind));
5205 __ j(not_equal, &next); 5176 __ j(not_equal, &next);
5206 T stub(kind); 5177 T stub(kind);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5246 StackArgumentsAccessor args(rsp, 1, ARGUMENTS_DONT_CONTAIN_RECEIVER); 5217 StackArgumentsAccessor args(rsp, 1, ARGUMENTS_DONT_CONTAIN_RECEIVER);
5247 __ movq(rcx, args.GetArgumentOperand(0)); 5218 __ movq(rcx, args.GetArgumentOperand(0));
5248 __ testq(rcx, rcx); 5219 __ testq(rcx, rcx);
5249 __ j(zero, &normal_sequence); 5220 __ j(zero, &normal_sequence);
5250 5221
5251 if (mode == DISABLE_ALLOCATION_SITES) { 5222 if (mode == DISABLE_ALLOCATION_SITES) {
5252 ElementsKind initial = GetInitialFastElementsKind(); 5223 ElementsKind initial = GetInitialFastElementsKind();
5253 ElementsKind holey_initial = GetHoleyElementsKind(initial); 5224 ElementsKind holey_initial = GetHoleyElementsKind(initial);
5254 5225
5255 ArraySingleArgumentConstructorStub stub_holey(holey_initial, 5226 ArraySingleArgumentConstructorStub stub_holey(holey_initial,
5256 CONTEXT_CHECK_REQUIRED,
5257 DISABLE_ALLOCATION_SITES); 5227 DISABLE_ALLOCATION_SITES);
5258 __ TailCallStub(&stub_holey); 5228 __ TailCallStub(&stub_holey);
5259 5229
5260 __ bind(&normal_sequence); 5230 __ bind(&normal_sequence);
5261 ArraySingleArgumentConstructorStub stub(initial, 5231 ArraySingleArgumentConstructorStub stub(initial,
5262 CONTEXT_CHECK_REQUIRED,
5263 DISABLE_ALLOCATION_SITES); 5232 DISABLE_ALLOCATION_SITES);
5264 __ TailCallStub(&stub); 5233 __ TailCallStub(&stub);
5265 } else if (mode == DONT_OVERRIDE) { 5234 } else if (mode == DONT_OVERRIDE) {
5266 // We are going to create a holey array, but our kind is non-holey. 5235 // We are going to create a holey array, but our kind is non-holey.
5267 // Fix kind and retry (only if we have an allocation site in the cell). 5236 // Fix kind and retry (only if we have an allocation site in the cell).
5268 __ incl(rdx); 5237 __ incl(rdx);
5269 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); 5238 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset));
5270 if (FLAG_debug_code) { 5239 if (FLAG_debug_code) {
5271 Handle<Map> allocation_site_map = 5240 Handle<Map> allocation_site_map =
5272 masm->isolate()->factory()->allocation_site_map(); 5241 masm->isolate()->factory()->allocation_site_map();
(...skipping 24 matching lines...) Expand all
5297 // If we reached this point there is a problem. 5266 // If we reached this point there is a problem.
5298 __ Abort(kUnexpectedElementsKindInArrayConstructor); 5267 __ Abort(kUnexpectedElementsKindInArrayConstructor);
5299 } else { 5268 } else {
5300 UNREACHABLE(); 5269 UNREACHABLE();
5301 } 5270 }
5302 } 5271 }
5303 5272
5304 5273
5305 template<class T> 5274 template<class T>
5306 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 5275 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
5307 ElementsKind initial_kind = GetInitialFastElementsKind();
5308 ElementsKind initial_holey_kind = GetHoleyElementsKind(initial_kind);
5309
5310 int to_index = GetSequenceIndexFromFastElementsKind( 5276 int to_index = GetSequenceIndexFromFastElementsKind(
5311 TERMINAL_FAST_ELEMENTS_KIND); 5277 TERMINAL_FAST_ELEMENTS_KIND);
5312 for (int i = 0; i <= to_index; ++i) { 5278 for (int i = 0; i <= to_index; ++i) {
5313 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5279 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5314 T stub(kind); 5280 T stub(kind);
5315 stub.GetCode(isolate); 5281 stub.GetCode(isolate);
5316 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE || 5282 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
5317 (!FLAG_track_allocation_sites && 5283 T stub1(kind, DISABLE_ALLOCATION_SITES);
5318 (kind == initial_kind || kind == initial_holey_kind))) {
5319 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES);
5320 stub1.GetCode(isolate); 5284 stub1.GetCode(isolate);
5321 } 5285 }
5322 } 5286 }
5323 } 5287 }
5324 5288
5325 5289
5326 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 5290 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
5327 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 5291 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
5328 isolate); 5292 isolate);
5329 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 5293 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 __ bind(&fast_elements_case); 5485 __ bind(&fast_elements_case);
5522 GenerateCase(masm, FAST_ELEMENTS); 5486 GenerateCase(masm, FAST_ELEMENTS);
5523 } 5487 }
5524 5488
5525 5489
5526 #undef __ 5490 #undef __
5527 5491
5528 } } // namespace v8::internal 5492 } } // namespace v8::internal
5529 5493
5530 #endif // V8_TARGET_ARCH_X64 5494 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698