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

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

Issue 552803002: Get CallInterfaceDescriptor directly from CodeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
11 #include "src/code-stubs.h" 11 #include "src/code-stubs.h"
12 #include "src/codegen.h" 12 #include "src/codegen.h"
13 #include "src/ic/handler-compiler.h" 13 #include "src/ic/handler-compiler.h"
14 #include "src/isolate.h" 14 #include "src/isolate.h"
15 #include "src/jsregexp.h" 15 #include "src/jsregexp.h"
16 #include "src/regexp-macro-assembler.h" 16 #include "src/regexp-macro-assembler.h"
17 #include "src/runtime.h" 17 #include "src/runtime.h"
18 18
19 namespace v8 { 19 namespace v8 {
20 namespace internal { 20 namespace internal {
21 21
22 22
23 static void InitializeArrayConstructorDescriptor( 23 static void InitializeArrayConstructorDescriptor(
24 Isolate* isolate, CodeStub::Major major, 24 Isolate* isolate, CodeStubDescriptor* descriptor,
25 CodeStubInterfaceDescriptor* descriptor,
26 int constant_stack_parameter_count) { 25 int constant_stack_parameter_count) {
27 // register state 26 // register state
28 // eax -- number of arguments 27 // eax -- number of arguments
29 // edi -- function 28 // edi -- function
30 // ebx -- allocation site with elements kind 29 // ebx -- allocation site with elements kind
31 Address deopt_handler = Runtime::FunctionForId( 30 Address deopt_handler = Runtime::FunctionForId(
32 Runtime::kArrayConstructor)->entry; 31 Runtime::kArrayConstructor)->entry;
33 32
34 if (constant_stack_parameter_count == 0) { 33 if (constant_stack_parameter_count == 0) {
35 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); 34 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
36 descriptor->Initialize(major, call_descriptor, deopt_handler,
37 constant_stack_parameter_count,
38 JS_FUNCTION_STUB_MODE); 35 JS_FUNCTION_STUB_MODE);
39 } else { 36 } else {
40 ArrayConstructorDescriptor call_descriptor(isolate); 37 descriptor->Initialize(eax, deopt_handler, constant_stack_parameter_count,
41 descriptor->Initialize(major, call_descriptor, eax, deopt_handler,
42 constant_stack_parameter_count,
43 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); 38 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
44 } 39 }
45 } 40 }
46 41
47 42
48 static void InitializeInternalArrayConstructorDescriptor( 43 static void InitializeInternalArrayConstructorDescriptor(
49 Isolate* isolate, CodeStub::Major major, 44 Isolate* isolate, CodeStubDescriptor* descriptor,
50 CodeStubInterfaceDescriptor* descriptor,
51 int constant_stack_parameter_count) { 45 int constant_stack_parameter_count) {
52 // register state 46 // register state
53 // eax -- number of arguments 47 // eax -- number of arguments
54 // edi -- constructor function 48 // edi -- constructor function
55 Address deopt_handler = Runtime::FunctionForId( 49 Address deopt_handler = Runtime::FunctionForId(
56 Runtime::kInternalArrayConstructor)->entry; 50 Runtime::kInternalArrayConstructor)->entry;
57 51
58 if (constant_stack_parameter_count == 0) { 52 if (constant_stack_parameter_count == 0) {
59 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); 53 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
60 descriptor->Initialize(major, call_descriptor, deopt_handler,
61 constant_stack_parameter_count,
62 JS_FUNCTION_STUB_MODE); 54 JS_FUNCTION_STUB_MODE);
63 } else { 55 } else {
64 InternalArrayConstructorDescriptor call_descriptor(isolate); 56 descriptor->Initialize(eax, deopt_handler, constant_stack_parameter_count,
65 descriptor->Initialize(major, call_descriptor, eax, deopt_handler,
66 constant_stack_parameter_count,
67 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); 57 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
68 } 58 }
69 } 59 }
70 60
71 61
72 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 62 void ArrayNoArgumentConstructorStub::InitializeDescriptor(
73 CodeStubInterfaceDescriptor* descriptor) { 63 CodeStubDescriptor* descriptor) {
74 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); 64 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0);
75 } 65 }
76 66
77 67
78 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 68 void ArraySingleArgumentConstructorStub::InitializeDescriptor(
79 CodeStubInterfaceDescriptor* descriptor) { 69 CodeStubDescriptor* descriptor) {
80 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); 70 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1);
81 } 71 }
82 72
83 73
84 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( 74 void ArrayNArgumentsConstructorStub::InitializeDescriptor(
85 CodeStubInterfaceDescriptor* descriptor) { 75 CodeStubDescriptor* descriptor) {
86 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); 76 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
87 } 77 }
88 78
89 79
90 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( 80 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor(
91 CodeStubInterfaceDescriptor* descriptor) { 81 CodeStubDescriptor* descriptor) {
92 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), 82 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0);
93 descriptor, 0);
94 } 83 }
95 84
96 85
97 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( 86 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor(
98 CodeStubInterfaceDescriptor* descriptor) { 87 CodeStubDescriptor* descriptor) {
99 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), 88 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1);
100 descriptor, 1);
101 } 89 }
102 90
103 91
104 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( 92 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
105 CodeStubInterfaceDescriptor* descriptor) { 93 CodeStubDescriptor* descriptor) {
106 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), 94 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
107 descriptor, -1);
108 } 95 }
109 96
110 97
111 #define __ ACCESS_MASM(masm) 98 #define __ ACCESS_MASM(masm)
112 99
113 100
114 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { 101 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
102 ExternalReference miss) {
115 // Update the static counter each time a new code stub is generated. 103 // Update the static counter each time a new code stub is generated.
116 isolate()->counters()->code_stubs()->Increment(); 104 isolate()->counters()->code_stubs()->Increment();
117 105
118 CodeStubInterfaceDescriptor descriptor(this); 106 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
119 int param_count = descriptor.GetEnvironmentParameterCount(); 107 int param_count = descriptor.GetEnvironmentParameterCount();
120 { 108 {
121 // Call the runtime system in a fresh internal frame. 109 // Call the runtime system in a fresh internal frame.
122 FrameScope scope(masm, StackFrame::INTERNAL); 110 FrameScope scope(masm, StackFrame::INTERNAL);
123 DCHECK(param_count == 0 || 111 DCHECK(param_count == 0 ||
124 eax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); 112 eax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
125 // Push arguments 113 // Push arguments
126 for (int i = 0; i < param_count; ++i) { 114 for (int i = 0; i < param_count; ++i) {
127 __ push(descriptor.GetEnvironmentParameterRegister(i)); 115 __ push(descriptor.GetEnvironmentParameterRegister(i));
128 } 116 }
129 ExternalReference miss = descriptor.miss_handler();
130 __ CallExternalReference(miss, param_count); 117 __ CallExternalReference(miss, param_count);
131 } 118 }
132 119
133 __ ret(0); 120 __ ret(0);
134 } 121 }
135 122
136 123
137 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { 124 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) {
138 // We don't allow a GC during a store buffer overflow so there is no need to 125 // We don't allow a GC during a store buffer overflow so there is no need to
139 // store the registers in any particular way, but we do have to store and 126 // store the registers in any particular way, but we do have to store and
(...skipping 4538 matching lines...) Expand 10 before | Expand all | Expand 10 after
4678 Operand(ebp, 7 * kPointerSize), 4665 Operand(ebp, 7 * kPointerSize),
4679 NULL); 4666 NULL);
4680 } 4667 }
4681 4668
4682 4669
4683 #undef __ 4670 #undef __
4684 4671
4685 } } // namespace v8::internal 4672 } } // namespace v8::internal
4686 4673
4687 #endif // V8_TARGET_ARCH_IA32 4674 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698