 Chromium Code Reviews
 Chromium Code Reviews Issue 552803002:
  Get CallInterfaceDescriptor directly from CodeStub.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 552803002:
  Get CallInterfaceDescriptor directly from CodeStub.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| 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, CodeStubDescriptor* descriptor, | 
| 24 CodeStubInterfaceDescriptor* descriptor, | |
| 25 int constant_stack_parameter_count) { | 24 int constant_stack_parameter_count) { | 
| 26 Address deopt_handler = Runtime::FunctionForId( | 25 Address deopt_handler = Runtime::FunctionForId( | 
| 27 Runtime::kArrayConstructor)->entry; | 26 Runtime::kArrayConstructor)->entry; | 
| 28 | 27 | 
| 29 if (constant_stack_parameter_count == 0) { | 28 if (constant_stack_parameter_count == 0) { | 
| 30 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 29 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | 
| 31 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
| 32 constant_stack_parameter_count, | |
| 33 JS_FUNCTION_STUB_MODE); | 30 JS_FUNCTION_STUB_MODE); | 
| 34 } else { | 31 } else { | 
| 35 ArrayConstructorDescriptor call_descriptor(isolate); | 32 descriptor->Initialize(rax, deopt_handler, constant_stack_parameter_count, | 
| 36 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, | |
| 37 constant_stack_parameter_count, | |
| 38 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 33 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 
| 39 } | 34 } | 
| 40 } | 35 } | 
| 41 | 36 | 
| 42 | 37 | 
| 43 static void InitializeInternalArrayConstructorDescriptor( | 38 static void InitializeInternalArrayConstructorDescriptor( | 
| 44 Isolate* isolate, CodeStub::Major major, | 39 Isolate* isolate, CodeStubDescriptor* descriptor, | 
| 45 CodeStubInterfaceDescriptor* descriptor, | |
| 46 int constant_stack_parameter_count) { | 40 int constant_stack_parameter_count) { | 
| 47 Address deopt_handler = Runtime::FunctionForId( | 41 Address deopt_handler = Runtime::FunctionForId( | 
| 48 Runtime::kInternalArrayConstructor)->entry; | 42 Runtime::kInternalArrayConstructor)->entry; | 
| 49 | 43 | 
| 50 if (constant_stack_parameter_count == 0) { | 44 if (constant_stack_parameter_count == 0) { | 
| 51 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 45 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | 
| 52 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
| 53 constant_stack_parameter_count, | |
| 54 JS_FUNCTION_STUB_MODE); | 46 JS_FUNCTION_STUB_MODE); | 
| 55 } else { | 47 } else { | 
| 56 InternalArrayConstructorDescriptor call_descriptor(isolate); | 48 descriptor->Initialize(rax, deopt_handler, constant_stack_parameter_count, | 
| 57 descriptor->Initialize(major, call_descriptor, rax, deopt_handler, | |
| 58 constant_stack_parameter_count, | |
| 59 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 49 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 
| 60 } | 50 } | 
| 61 } | 51 } | 
| 62 | 52 | 
| 63 | 53 | 
| 64 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 54 void ArrayNoArgumentConstructorStub::InitializeDescriptor( | 
| 65 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubDescriptor* descriptor) { | 
| 66 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 56 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0); | 
| 67 } | 57 } | 
| 68 | 58 | 
| 69 | 59 | 
| 70 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 60 void ArraySingleArgumentConstructorStub::InitializeDescriptor( | 
| 71 CodeStubInterfaceDescriptor* descriptor) { | 61 CodeStubDescriptor* descriptor) { | 
| 72 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); | 62 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1); | 
| 73 } | 63 } | 
| 74 | 64 | 
| 75 | 65 | 
| 76 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 66 void ArrayNArgumentsConstructorStub::InitializeDescriptor( | 
| 77 CodeStubInterfaceDescriptor* descriptor) { | 67 CodeStubDescriptor* descriptor) { | 
| 78 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); | 68 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); | 
| 79 } | 69 } | 
| 80 | 70 | 
| 81 | 71 | 
| 82 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 72 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor( | 
| 83 CodeStubInterfaceDescriptor* descriptor) { | 73 CodeStubDescriptor* descriptor) { | 
| 84 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 74 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0); | 
| 85 descriptor, 0); | |
| 86 } | 75 } | 
| 87 | 76 | 
| 88 | 77 | 
| 89 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 78 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor( | 
| 90 CodeStubInterfaceDescriptor* descriptor) { | 79 CodeStubDescriptor* descriptor) { | 
| 91 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 80 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1); | 
| 92 descriptor, 1); | |
| 93 } | 81 } | 
| 94 | 82 | 
| 95 | 83 | 
| 96 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 84 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( | 
| 97 CodeStubInterfaceDescriptor* descriptor) { | 85 CodeStubDescriptor* descriptor) { | 
| 98 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 86 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); | 
| 
mvstanton
2014/09/08 14:58:39
Very nice to see MajorKey() pulled out, thx!
 | |
| 99 descriptor, -1); | |
| 100 } | 87 } | 
| 101 | 88 | 
| 102 | 89 | 
| 103 #define __ ACCESS_MASM(masm) | 90 #define __ ACCESS_MASM(masm) | 
| 104 | 91 | 
| 105 | 92 | 
| 106 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 93 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, | 
| 94 ExternalReference miss) { | |
| 107 // Update the static counter each time a new code stub is generated. | 95 // Update the static counter each time a new code stub is generated. | 
| 108 isolate()->counters()->code_stubs()->Increment(); | 96 isolate()->counters()->code_stubs()->Increment(); | 
| 109 | 97 | 
| 110 CodeStubInterfaceDescriptor descriptor(this); | 98 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); | 
| 111 int param_count = descriptor.GetEnvironmentParameterCount(); | 99 int param_count = descriptor.GetEnvironmentParameterCount(); | 
| 112 { | 100 { | 
| 113 // Call the runtime system in a fresh internal frame. | 101 // Call the runtime system in a fresh internal frame. | 
| 114 FrameScope scope(masm, StackFrame::INTERNAL); | 102 FrameScope scope(masm, StackFrame::INTERNAL); | 
| 115 DCHECK(param_count == 0 || | 103 DCHECK(param_count == 0 || | 
| 116 rax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 104 rax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 
| 117 // Push arguments | 105 // Push arguments | 
| 118 for (int i = 0; i < param_count; ++i) { | 106 for (int i = 0; i < param_count; ++i) { | 
| 119 __ Push(descriptor.GetEnvironmentParameterRegister(i)); | 107 __ Push(descriptor.GetEnvironmentParameterRegister(i)); | 
| 120 } | 108 } | 
| 121 ExternalReference miss = descriptor.miss_handler(); | |
| 122 __ CallExternalReference(miss, param_count); | 109 __ CallExternalReference(miss, param_count); | 
| 123 } | 110 } | 
| 124 | 111 | 
| 125 __ Ret(); | 112 __ Ret(); | 
| 126 } | 113 } | 
| 127 | 114 | 
| 128 | 115 | 
| 129 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 116 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 
| 130 __ PushCallerSaved(save_doubles() ? kSaveFPRegs : kDontSaveFPRegs); | 117 __ PushCallerSaved(save_doubles() ? kSaveFPRegs : kDontSaveFPRegs); | 
| 131 const int argument_count = 1; | 118 const int argument_count = 1; | 
| (...skipping 4515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4647 return_value_operand, | 4634 return_value_operand, | 
| 4648 NULL); | 4635 NULL); | 
| 4649 } | 4636 } | 
| 4650 | 4637 | 
| 4651 | 4638 | 
| 4652 #undef __ | 4639 #undef __ | 
| 4653 | 4640 | 
| 4654 } } // namespace v8::internal | 4641 } } // namespace v8::internal | 
| 4655 | 4642 | 
| 4656 #endif // V8_TARGET_ARCH_X64 | 4643 #endif // V8_TARGET_ARCH_X64 | 
| OLD | NEW |