| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 12 #include "src/ic/handler-compiler.h" | 12 #include "src/ic/handler-compiler.h" |
| 13 #include "src/isolate.h" | 13 #include "src/isolate.h" |
| 14 #include "src/jsregexp.h" | 14 #include "src/jsregexp.h" |
| 15 #include "src/regexp-macro-assembler.h" | 15 #include "src/regexp-macro-assembler.h" |
| 16 #include "src/runtime.h" | 16 #include "src/runtime.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 | 21 |
| 22 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
| 23 Isolate* isolate, CodeStub::Major major, | 23 Isolate* isolate, CodeStub::Major major, |
| 24 CodeStubInterfaceDescriptor* descriptor, | 24 CodeStubInterfaceDescriptor* descriptor, |
| 25 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
| 26 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
| 27 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
| 28 | 28 |
| 29 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
| 30 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( | 30 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); |
| 31 CallDescriptorKey::ArrayConstructorConstantArgCountCall); | |
| 32 descriptor->Initialize(major, call_descriptor, deopt_handler, | 31 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 33 constant_stack_parameter_count, | 32 constant_stack_parameter_count, |
| 34 JS_FUNCTION_STUB_MODE); | 33 JS_FUNCTION_STUB_MODE); |
| 35 } else { | 34 } else { |
| 36 CallInterfaceDescriptor* call_descriptor = | 35 ArrayConstructorDescriptor call_descriptor(isolate); |
| 37 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); | |
| 38 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, | 36 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, |
| 39 constant_stack_parameter_count, | 37 constant_stack_parameter_count, |
| 40 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 38 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 41 } | 39 } |
| 42 } | 40 } |
| 43 | 41 |
| 44 | 42 |
| 45 static void InitializeInternalArrayConstructorDescriptor( | 43 static void InitializeInternalArrayConstructorDescriptor( |
| 46 Isolate* isolate, CodeStub::Major major, | 44 Isolate* isolate, CodeStub::Major major, |
| 47 CodeStubInterfaceDescriptor* descriptor, | 45 CodeStubInterfaceDescriptor* descriptor, |
| 48 int constant_stack_parameter_count) { | 46 int constant_stack_parameter_count) { |
| 49 // register state | |
| 50 // rsi -- context | |
| 51 // rax -- number of arguments | |
| 52 // rdi -- constructor function | |
| 53 Address deopt_handler = Runtime::FunctionForId( | 47 Address deopt_handler = Runtime::FunctionForId( |
| 54 Runtime::kInternalArrayConstructor)->entry; | 48 Runtime::kInternalArrayConstructor)->entry; |
| 55 | 49 |
| 56 if (constant_stack_parameter_count == 0) { | 50 if (constant_stack_parameter_count == 0) { |
| 57 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( | 51 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); |
| 58 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); | |
| 59 descriptor->Initialize(major, call_descriptor, deopt_handler, | 52 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 60 constant_stack_parameter_count, | 53 constant_stack_parameter_count, |
| 61 JS_FUNCTION_STUB_MODE); | 54 JS_FUNCTION_STUB_MODE); |
| 62 } else { | 55 } else { |
| 63 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( | 56 InternalArrayConstructorDescriptor call_descriptor(isolate); |
| 64 CallDescriptorKey::InternalArrayConstructorCall); | |
| 65 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, | 57 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, |
| 66 constant_stack_parameter_count, | 58 constant_stack_parameter_count, |
| 67 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 59 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 68 } | 60 } |
| 69 } | 61 } |
| 70 | 62 |
| 71 | 63 |
| 72 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 64 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
| 73 CodeStubInterfaceDescriptor* descriptor) { | 65 CodeStubInterfaceDescriptor* descriptor) { |
| 74 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 66 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 | 526 |
| 535 __ bind(&done); | 527 __ bind(&done); |
| 536 __ IncrementCounter(counters->math_pow(), 1); | 528 __ IncrementCounter(counters->math_pow(), 1); |
| 537 __ ret(0); | 529 __ ret(0); |
| 538 } | 530 } |
| 539 } | 531 } |
| 540 | 532 |
| 541 | 533 |
| 542 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { | 534 void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
| 543 Label miss; | 535 Label miss; |
| 544 Register receiver = LoadConvention::ReceiverRegister(); | 536 Register receiver = LoadDescriptor::ReceiverRegister(); |
| 545 | 537 |
| 546 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, | 538 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r8, |
| 547 r9, &miss); | 539 r9, &miss); |
| 548 __ bind(&miss); | 540 __ bind(&miss); |
| 549 PropertyAccessCompiler::TailCallBuiltin( | 541 PropertyAccessCompiler::TailCallBuiltin( |
| 550 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 542 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
| 551 } | 543 } |
| 552 | 544 |
| 553 | 545 |
| 554 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 546 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
| (...skipping 3638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4193 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 4185 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 4194 __ PopReturnAddressTo(rcx); | 4186 __ PopReturnAddressTo(rcx); |
| 4195 int additional_offset = | 4187 int additional_offset = |
| 4196 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 4188 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| 4197 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); | 4189 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); |
| 4198 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. | 4190 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. |
| 4199 } | 4191 } |
| 4200 | 4192 |
| 4201 | 4193 |
| 4202 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4194 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { |
| 4203 EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister()); | 4195 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); |
| 4204 VectorLoadStub stub(isolate(), state()); | 4196 VectorLoadStub stub(isolate(), state()); |
| 4205 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); | 4197 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 4206 } | 4198 } |
| 4207 | 4199 |
| 4208 | 4200 |
| 4209 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 4201 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
| 4210 EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister()); | 4202 EmitLoadTypeFeedbackVector(masm, VectorLoadICDescriptor::VectorRegister()); |
| 4211 VectorKeyedLoadStub stub(isolate()); | 4203 VectorKeyedLoadStub stub(isolate()); |
| 4212 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); | 4204 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 4213 } | 4205 } |
| 4214 | 4206 |
| 4215 | 4207 |
| 4216 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 4208 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 4217 if (masm->isolate()->function_entry_hook() != NULL) { | 4209 if (masm->isolate()->function_entry_hook() != NULL) { |
| 4218 ProfileEntryHookStub stub(masm->isolate()); | 4210 ProfileEntryHookStub stub(masm->isolate()); |
| 4219 masm->CallStub(&stub); | 4211 masm->CallStub(&stub); |
| 4220 } | 4212 } |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4748 return_value_operand, | 4740 return_value_operand, |
| 4749 NULL); | 4741 NULL); |
| 4750 } | 4742 } |
| 4751 | 4743 |
| 4752 | 4744 |
| 4753 #undef __ | 4745 #undef __ |
| 4754 | 4746 |
| 4755 } } // namespace v8::internal | 4747 } } // namespace v8::internal |
| 4756 | 4748 |
| 4757 #endif // V8_TARGET_ARCH_X64 | 4749 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |